Involved Source Files
Copyright 2013 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
yaml.go
Package-Level Type Names (total 4, none are exported)
/* sort exporteds by: | */
byIndex sorts field by index sequence.
( T) Len() int( T) Less(i, j int) bool( T) Swap(i, j int)
T : sort.Interface
T : github.com/aws/aws-sdk-go/aws/corehandlers.lener
byName sorts field by name, breaking ties with depth,
then breaking ties with "name came from json tag", then
breaking ties with index sequence.
( T) Len() int( T) Less(i, j int) bool( T) Swap(i, j int)
T : sort.Interface
T : github.com/aws/aws-sdk-go/aws/corehandlers.lener
tagOptions is the string following a comma in a struct field's "json"
tag, or the empty string. It does not include the leading comma.
Contains reports whether a comma-separated list of options
contains a particular substr flag. substr must be surrounded by a
string boundary or commas.
func parseTag(tag string) (string, tagOptions)
Package-Level Functions (total 17, in which 4 are exported)
Convert JSON to YAML.
Marshals the object into JSON then converts JSON to YAML and returns the
YAML.
Converts YAML to JSON then uses JSON to unmarshal into an object.
Convert YAML to JSON. Since JSON is a subset of YAML, passing JSON through
this method should be a no-op.
Things YAML can do that are not supported by JSON:
* In YAML you can have binary and null keys in your maps. These are invalid
in JSON. (int and float keys are converted to strings.)
* Binary data in YAML with the !!binary tag is not supported. If you want to
use binary data with this library, encode the data as base64 as usual but do
not use the !!binary tag in your YAML. This will ensure the original base64
encoded data makes it all the way through to the JSON.
asciiEqualFold is a specialization of bytes.EqualFold for use when
s is all ASCII (but may contain non-letters) and contains no
special-folding letters.
See comments on foldFunc.
cachedTypeFields is like typeFields but uses a cache to avoid repeated work.
dominantField looks through the fields, all of which are known to
have the same name, to find the single field that dominates the
others using Go's embedding rules, modified by the presence of
JSON tags. If there are multiple top-level fields, the boolean
will be false: This condition is an error in Go and we skip all
the fields.
equalFoldRight is a specialization of bytes.EqualFold when s is
known to be all ASCII (including punctuation), but contains an 's',
'S', 'k', or 'K', requiring a Unicode fold on the bytes in t.
See comments on foldFunc.
foldFunc returns one of four different case folding equivalence
functions, from most general (and slow) to fastest:
1) bytes.EqualFold, if the key s contains any non-ASCII UTF-8
2) equalFoldRight, if s contains special folding ASCII ('k', 'K', 's', 'S')
3) asciiEqualFold, no special, but includes non-letters (including _)
4) simpleLetterEqualFold, no specials, no non-letters.
The letters S and K are special because they map to 3 runes, not just 2:
* S maps to s and to U+017F 'ſ' Latin small letter long s
* k maps to K and to U+212A 'K' Kelvin sign
See http://play.golang.org/p/tTxjOc0OGo
The returned function is specialized for matching against s and
should only be given s. It's not curried for performance reasons.
indirect walks down v allocating pointers as needed,
until it gets to a non-pointer.
if it encounters an Unmarshaler, indirect stops and returns that.
if decodingNull is true, indirect stops at the last pointer so it can be set to nil.
parseTag splits a struct field's json tag into its name and
comma-separated options.
simpleLetterEqualFold is a specialization of bytes.EqualFold for
use when s is all ASCII letters (no underscores, etc) and also
doesn't contain 'k', 'K', 's', or 'S'.
See comments on foldFunc.
typeFields returns a list of fields that JSON should recognize for the given type.
The algorithm is breadth-first search over the set of structs to include - the top struct
and then any reachable anonymous structs.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.