GithubHelp home page GithubHelp logo

goe's Introduction

Go Enterprise

Common enterprise features for the Go programming language.

This is free and unencumbered software released into the public domain.

Build Status

Expression Language API

GoEL expressions provide error free access to Go types. It serves as a lightweigth alternative to unified EL, SpEL or even XPath, CSS selectors and friends.

func FancyOneLiners() {
	// Single field selection:
	upper, applicable := el.Bool(`/CharSet[0x1F]/isUpperCase`, x)

	// Escape path separator slash:
	warnings := el.Strings(`/Report/Stats["I\x2fO"]/warn[*]`, x)

	// Data modification:
	el.Assign(x, `/Nodes[7]/Cache/TTL`, 3600)

Performance

The implementation is optimized for performance. No need to precompile expressions.

goos: darwin
goarch: arm64
pkg: github.com/pascaldekloe/goe/el
BenchmarkLookups-8   	 4037929	       268.3 ns/op
BenchmarkAssigns-8   	 2855529	       419.9 ns/op

Metrics API

Yet another StatsD implementation.

var Metrics = metrics.NewDummy()

func GetSomething(w http.ResponseWriter, r *http.Request) {
	Metrics.Seen("http.something.gets", 1)
	defer Metrics.Took("http.something.get", time.Now())

Verification API

Test assertions on big objects can be cumbersome with reflect.DeepEqual and "Got %#v, want %#v". Package verify offers convenience with reporting. For example verify.Values(t, "character", got, want) might print:

--- FAIL: TestValuesDemo (0.00s)
	demo_test.go:72: verification for character:
		/Novel[6]/Title: Got "Gold Finger", want "Goldfinger"
		                          ^
		/Film[20]/Year: Got 1953 (0x7a1), want 2006 (0x7d6)

goe's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

goe's Issues

please clarify copyright

README and LICENSE have conflicting copyright statements.
Former claims that copyright is waived to "Public Domain" (i.e. there is no copyright) but the latter attribute copyright to Go Enterprice (whatever it is).

Which is the correct one?

I sincerely hope that intention was to wave off copyright entirely, instead of assigning it to some misterious entity. Nothing relevant comes up when I search for "Go Enterprice"...

I recommend to replace "Go Enterprice" with "public domain" because "Public Domain" is a term that CC0 waiver refers to.

Thanks.

Data exclusion for verify.Values

It would be super cool to have an exclude list for the verify function. Sometimes the match is gonna be between complex or deep structs and right now is mandatory to provide an exact struct match. Which is perfect plenty of times, but in some scenarios could be interesting to just care about specific values for the match.

Like, let's suppose that I'm expecting an struct like:

type PeriodCalc struct {
Something string
Blablabla string
Value string
Trace []*Log
}

But maybe I don't care about this Trace array and I want just to ignore it and check the other variables.

verify.Values should compare private fields like reflect.DeepEqual

The following test case shows that reflect.DeepEqual can compare private fields whereas verify.Values cannot. Tested with Go 1.8

type A struct {
	x bool
}

func TestA(t *testing.T) {
	got, want := &A{true}, &A{false}
	fmt.Println("DeepEqual:", reflect.DeepEqual(got, want))
	verify.Values(t, "", got, want)
}

This prints

=== RUN   TestA
DeepEqual: false
--- FAIL: TestA (0.00s)
	values.go:22: verification for  at fsm_test.go:19:
		/%!s(<nil>): Can't read private fields
FAIL
exit status 1

Problem using Big.Rational as want in the verify

Using the verify function, works perfect except if a Big.Rat variable is found in the "want" parameter. For example, this struct give problems due to that value:

&Effect{
InvoiceLineID: 400057,
Value: big.NewRat(200, 1),
Spend: big.NewRat(30, 1),
},

Also I'm attaching the log.

Thanks :D

bugBigRat.txt

LICENSE file has no license

LICENSE file contains no license.

The only relevant thing in there is

To the extent possible under law, Pascal S. de Kloe has waived all copyright and related or neighboring rights to GoE.

Whatever "GoE" is (organisation?) the abose sentence disclaims copyright in favor of "GoE" and implicit "All Rights Reserverd" still applies.

Information related to licensing is in the README.md but it would be best to mention it in LICENSE file as well.

License

Hello !

Could you add the license please ?

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.