New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to use DSL when defining Hash attributes #1172

merged 1 commit into from Apr 8, 2017


None yet
1 participant
Copy link

raphael commented Apr 8, 2017

No description provided.

@raphael raphael force-pushed the v1.hash_dsl branch from 7be37cd to 481b984 Apr 8, 2017

@raphael raphael merged commit 5d765a6 into v1 Apr 8, 2017

3 checks passed

continuous-integration/appveyor/branch AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed
continuous-integration/travis-ci/push The Travis CI build passed

@raphael raphael deleted the v1.hash_dsl branch Apr 8, 2017


This comment has been minimized.

Copy link
Member Author

raphael commented Apr 16, 2017

Here is an example that takes advantage of the DSLs:

// ValidateKey is a DSL function that defines a pattern based validation.
func ValidateKey() {

// TypeValue is a DSL function that attaches metadata.
func TypeValue() {
	Metadata("struct:field:type", "json.RawMessage", "encoding/json")

// Mappings is a Hash type with validation attached to the keys and metadata attached to the values.
var Mappings = HashOf(String, String, ValidateKey, TypeValue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment