Skip to content
Wraps reflect to provide a standard abstraction layer to get named values from objects.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci updated headers Mar 3, 2019
gtg fix to getting values from map[string]string Apr 5, 2019
scripts initial work Oct 30, 2018
.gitignore initial work Oct 30, 2018
AUTHORS initial work Oct 30, 2018
CONTRIBUTING.md initial work Oct 30, 2018
LICENSE initial work Oct 30, 2018
README.md initial work Oct 30, 2018

README.md

CircleCI Go Report Card GoDoc license

go-try-get

Description

go-try-get aka (GTG) is a package that wraps around the reflect package to provide a standard abstraction layer for getting values by name from objects (structs, maps, and single-value "property" functions). GTG is used by:

For example, with GTG, you can provide a single pathways for an API to process structs and maps, allowing automated structured input from systems, as well as user-based input unmarshaled from JSON.

Usage

Go

You can import go-try-get as a library with:

import (
  "github.com/spatialcurrent/go-try-get/gtg"
)
...
object := map[string]string{"yo":"yo"}
...
if gtg.TryGetString(object, "yo", "what") == "yo" {
  ...
}
...

See gtg in GoDoc for information on how to use Go API.

Contributing

Spatial Current, Inc. is currently accepting pull requests for this repository. We'd love to have your contributions! Please see Contributing.md for how to get started.

License

This work is distributed under the MIT License. See LICENSE file.

You can’t perform that action at this time.