id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
144,700 | arangodb/go-velocypack | slice.go | GetBool | func (s Slice) GetBool() (bool, error) {
if err := s.AssertType(Bool); err != nil {
return false, WithStack(err)
}
return s.IsTrue(), nil
} | go | func (s Slice) GetBool() (bool, error) {
if err := s.AssertType(Bool); err != nil {
return false, WithStack(err)
}
return s.IsTrue(), nil
} | [
"func",
"(",
"s",
"Slice",
")",
"GetBool",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"err",
":=",
"s",
".",
"AssertType",
"(",
"Bool",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"WithStack",
"(",
"err",
")",
"\n",
"}"... | // GetBool returns a boolean value from the slice.
// Returns an error if slice is not of type Bool. | [
"GetBool",
"returns",
"a",
"boolean",
"value",
"from",
"the",
"slice",
".",
"Returns",
"an",
"error",
"if",
"slice",
"is",
"not",
"of",
"type",
"Bool",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L143-L148 |
144,701 | arangodb/go-velocypack | slice.go | GetDouble | func (s Slice) GetDouble() (float64, error) {
if err := s.AssertType(Double); err != nil {
return 0.0, WithStack(err)
}
bits := binary.LittleEndian.Uint64(s[1:])
return math.Float64frombits(bits), nil
} | go | func (s Slice) GetDouble() (float64, error) {
if err := s.AssertType(Double); err != nil {
return 0.0, WithStack(err)
}
bits := binary.LittleEndian.Uint64(s[1:])
return math.Float64frombits(bits), nil
} | [
"func",
"(",
"s",
"Slice",
")",
"GetDouble",
"(",
")",
"(",
"float64",
",",
"error",
")",
"{",
"if",
"err",
":=",
"s",
".",
"AssertType",
"(",
"Double",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0.0",
",",
"WithStack",
"(",
"err",
")",
"\n",
... | // GetDouble returns a Double value from the slice.
// Returns an error if slice is not of type Double. | [
"GetDouble",
"returns",
"a",
"Double",
"value",
"from",
"the",
"slice",
".",
"Returns",
"an",
"error",
"if",
"slice",
"is",
"not",
"of",
"type",
"Double",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L152-L158 |
144,702 | arangodb/go-velocypack | slice.go | GetInt | func (s Slice) GetInt() (int64, error) {
h := s.head()
if h >= 0x20 && h <= 0x27 {
// Int T
v := readIntegerNonEmpty(s[1:], uint(h)-0x1f)
if h == 0x27 {
return toInt64(v), nil
} else {
vv := int64(v)
shift := int64(1) << ((h-0x1f)*8 - 1)
if vv < shift {
return vv, nil
} else {
return ... | go | func (s Slice) GetInt() (int64, error) {
h := s.head()
if h >= 0x20 && h <= 0x27 {
// Int T
v := readIntegerNonEmpty(s[1:], uint(h)-0x1f)
if h == 0x27 {
return toInt64(v), nil
} else {
vv := int64(v)
shift := int64(1) << ((h-0x1f)*8 - 1)
if vv < shift {
return vv, nil
} else {
return ... | [
"func",
"(",
"s",
"Slice",
")",
"GetInt",
"(",
")",
"(",
"int64",
",",
"error",
")",
"{",
"h",
":=",
"s",
".",
"head",
"(",
")",
"\n\n",
"if",
"h",
">=",
"0x20",
"&&",
"h",
"<=",
"0x27",
"{",
"// Int T",
"v",
":=",
"readIntegerNonEmpty",
"(",
... | // GetInt returns a Int value from the slice.
// Returns an error if slice is not of type Int. | [
"GetInt",
"returns",
"a",
"Int",
"value",
"from",
"the",
"slice",
".",
"Returns",
"an",
"error",
"if",
"slice",
"is",
"not",
"of",
"type",
"Int",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L162-L199 |
144,703 | arangodb/go-velocypack | slice.go | GetUInt | func (s Slice) GetUInt() (uint64, error) {
h := s.head()
if h == 0x28 {
// single byte integer
return uint64(s[1]), nil
}
if h >= 0x29 && h <= 0x2f {
// UInt
return readIntegerNonEmpty(s[1:], uint(h)-0x27), nil
}
if h >= 0x20 && h <= 0x27 {
// Int
v, err := s.GetInt()
if err != nil {
return 0,... | go | func (s Slice) GetUInt() (uint64, error) {
h := s.head()
if h == 0x28 {
// single byte integer
return uint64(s[1]), nil
}
if h >= 0x29 && h <= 0x2f {
// UInt
return readIntegerNonEmpty(s[1:], uint(h)-0x27), nil
}
if h >= 0x20 && h <= 0x27 {
// Int
v, err := s.GetInt()
if err != nil {
return 0,... | [
"func",
"(",
"s",
"Slice",
")",
"GetUInt",
"(",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"h",
":=",
"s",
".",
"head",
"(",
")",
"\n\n",
"if",
"h",
"==",
"0x28",
"{",
"// single byte integer",
"return",
"uint64",
"(",
"s",
"[",
"1",
"]",
")",
... | // GetUInt returns a UInt value from the slice.
// Returns an error if slice is not of type UInt. | [
"GetUInt",
"returns",
"a",
"UInt",
"value",
"from",
"the",
"slice",
".",
"Returns",
"an",
"error",
"if",
"slice",
"is",
"not",
"of",
"type",
"UInt",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L203-L239 |
144,704 | arangodb/go-velocypack | slice.go | GetSmallInt | func (s Slice) GetSmallInt() (int64, error) {
h := s.head()
if h >= 0x30 && h <= 0x39 {
// Smallint >= 0
return int64(h - 0x30), nil
}
if h >= 0x3a && h <= 0x3f {
// Smallint < 0
return int64(h-0x3a) - 6, nil
}
if (h >= 0x20 && h <= 0x27) || (h >= 0x28 && h <= 0x2f) {
// Int and UInt
// we'll leave... | go | func (s Slice) GetSmallInt() (int64, error) {
h := s.head()
if h >= 0x30 && h <= 0x39 {
// Smallint >= 0
return int64(h - 0x30), nil
}
if h >= 0x3a && h <= 0x3f {
// Smallint < 0
return int64(h-0x3a) - 6, nil
}
if (h >= 0x20 && h <= 0x27) || (h >= 0x28 && h <= 0x2f) {
// Int and UInt
// we'll leave... | [
"func",
"(",
"s",
"Slice",
")",
"GetSmallInt",
"(",
")",
"(",
"int64",
",",
"error",
")",
"{",
"h",
":=",
"s",
".",
"head",
"(",
")",
"\n\n",
"if",
"h",
">=",
"0x30",
"&&",
"h",
"<=",
"0x39",
"{",
"// Smallint >= 0",
"return",
"int64",
"(",
"h",
... | // GetSmallInt returns a SmallInt value from the slice.
// Returns an error if slice is not of type SmallInt. | [
"GetSmallInt",
"returns",
"a",
"SmallInt",
"value",
"from",
"the",
"slice",
".",
"Returns",
"an",
"error",
"if",
"slice",
"is",
"not",
"of",
"type",
"SmallInt",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L243-L264 |
144,705 | arangodb/go-velocypack | slice.go | GetUTCDate | func (s Slice) GetUTCDate() (time.Time, error) {
if !s.IsUTCDate() {
return time.Time{}, InvalidTypeError{"Expecting type UTCDate"}
}
v := toInt64(readIntegerFixed(s[1:], 8)) // milliseconds since epoch
sec := v / 1000
nsec := (v % 1000) * 1000000
return time.Unix(sec, nsec).UTC(), nil
} | go | func (s Slice) GetUTCDate() (time.Time, error) {
if !s.IsUTCDate() {
return time.Time{}, InvalidTypeError{"Expecting type UTCDate"}
}
v := toInt64(readIntegerFixed(s[1:], 8)) // milliseconds since epoch
sec := v / 1000
nsec := (v % 1000) * 1000000
return time.Unix(sec, nsec).UTC(), nil
} | [
"func",
"(",
"s",
"Slice",
")",
"GetUTCDate",
"(",
")",
"(",
"time",
".",
"Time",
",",
"error",
")",
"{",
"if",
"!",
"s",
".",
"IsUTCDate",
"(",
")",
"{",
"return",
"time",
".",
"Time",
"{",
"}",
",",
"InvalidTypeError",
"{",
"\"",
"\"",
"}",
"... | // GetUTCDate return the value for an UTCDate object | [
"GetUTCDate",
"return",
"the",
"value",
"for",
"an",
"UTCDate",
"object"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L267-L275 |
144,706 | arangodb/go-velocypack | slice.go | GetStringLength | func (s Slice) GetStringLength() (ValueLength, error) {
h := s.head()
if h >= 0x40 && h <= 0xbe {
// short UTF-8 String
length := h - 0x40
return ValueLength(length), nil
}
if h == 0xbf {
// long UTF-8 String
length := readIntegerFixed(s[1:], 8)
if err := checkOverflow(ValueLength(length)); err != nil ... | go | func (s Slice) GetStringLength() (ValueLength, error) {
h := s.head()
if h >= 0x40 && h <= 0xbe {
// short UTF-8 String
length := h - 0x40
return ValueLength(length), nil
}
if h == 0xbf {
// long UTF-8 String
length := readIntegerFixed(s[1:], 8)
if err := checkOverflow(ValueLength(length)); err != nil ... | [
"func",
"(",
"s",
"Slice",
")",
"GetStringLength",
"(",
")",
"(",
"ValueLength",
",",
"error",
")",
"{",
"h",
":=",
"s",
".",
"head",
"(",
")",
"\n",
"if",
"h",
">=",
"0x40",
"&&",
"h",
"<=",
"0xbe",
"{",
"// short UTF-8 String",
"length",
":=",
"h... | // GetStringLength return the length for a String object | [
"GetStringLength",
"return",
"the",
"length",
"for",
"a",
"String",
"object"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L314-L332 |
144,707 | arangodb/go-velocypack | slice.go | IsEqualString | func (s Slice) IsEqualString(value string) (bool, error) {
k, err := s.GetStringUTF8()
if err != nil {
return false, WithStack(err)
}
rc := bytes.Compare(k, []byte(value))
return rc == 0, nil
} | go | func (s Slice) IsEqualString(value string) (bool, error) {
k, err := s.GetStringUTF8()
if err != nil {
return false, WithStack(err)
}
rc := bytes.Compare(k, []byte(value))
return rc == 0, nil
} | [
"func",
"(",
"s",
"Slice",
")",
"IsEqualString",
"(",
"value",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"k",
",",
"err",
":=",
"s",
".",
"GetStringUTF8",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"WithStack",... | // IsEqualString compares the string value in the slice with the given string for equivalence. | [
"IsEqualString",
"compares",
"the",
"string",
"value",
"in",
"the",
"slice",
"with",
"the",
"given",
"string",
"for",
"equivalence",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L347-L354 |
144,708 | arangodb/go-velocypack | slice.go | GetBinary | func (s Slice) GetBinary() ([]byte, error) {
if !s.IsBinary() {
return nil, InvalidTypeError{"Expecting type Binary"}
}
h := s.head()
vpackAssert(h >= 0xc0 && h <= 0xc7)
lengthSize := uint(h - 0xbf)
length := readIntegerNonEmpty(s[1:], lengthSize)
checkOverflow(ValueLength(length))
return s[1+lengthSize : 1... | go | func (s Slice) GetBinary() ([]byte, error) {
if !s.IsBinary() {
return nil, InvalidTypeError{"Expecting type Binary"}
}
h := s.head()
vpackAssert(h >= 0xc0 && h <= 0xc7)
lengthSize := uint(h - 0xbf)
length := readIntegerNonEmpty(s[1:], lengthSize)
checkOverflow(ValueLength(length))
return s[1+lengthSize : 1... | [
"func",
"(",
"s",
"Slice",
")",
"GetBinary",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"!",
"s",
".",
"IsBinary",
"(",
")",
"{",
"return",
"nil",
",",
"InvalidTypeError",
"{",
"\"",
"\"",
"}",
"\n",
"}",
"\n\n",
"h",
":=",
... | // GetBinary return the value for a Binary object | [
"GetBinary",
"return",
"the",
"value",
"for",
"a",
"Binary",
"object"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L357-L369 |
144,709 | arangodb/go-velocypack | slice.go | GetBinaryLength | func (s Slice) GetBinaryLength() (ValueLength, error) {
if !s.IsBinary() {
return 0, InvalidTypeError{"Expecting type Binary"}
}
h := s.head()
vpackAssert(h >= 0xc0 && h <= 0xc7)
lengthSize := uint(h - 0xbf)
length := readIntegerNonEmpty(s[1:], lengthSize)
return ValueLength(length), nil
} | go | func (s Slice) GetBinaryLength() (ValueLength, error) {
if !s.IsBinary() {
return 0, InvalidTypeError{"Expecting type Binary"}
}
h := s.head()
vpackAssert(h >= 0xc0 && h <= 0xc7)
lengthSize := uint(h - 0xbf)
length := readIntegerNonEmpty(s[1:], lengthSize)
return ValueLength(length), nil
} | [
"func",
"(",
"s",
"Slice",
")",
"GetBinaryLength",
"(",
")",
"(",
"ValueLength",
",",
"error",
")",
"{",
"if",
"!",
"s",
".",
"IsBinary",
"(",
")",
"{",
"return",
"0",
",",
"InvalidTypeError",
"{",
"\"",
"\"",
"}",
"\n",
"}",
"\n\n",
"h",
":=",
"... | // GetBinaryLength return the length for a Binary object | [
"GetBinaryLength",
"return",
"the",
"length",
"for",
"a",
"Binary",
"object"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L372-L383 |
144,710 | arangodb/go-velocypack | slice.go | Length | func (s Slice) Length() (ValueLength, error) {
if !s.IsArray() && !s.IsObject() {
return 0, InvalidTypeError{"Expecting type Array or Object"}
}
h := s.head()
if h == 0x01 || h == 0x0a {
// special case: empty!
return 0, nil
}
if h == 0x13 || h == 0x14 {
// compact Array or Object
end := readVariableV... | go | func (s Slice) Length() (ValueLength, error) {
if !s.IsArray() && !s.IsObject() {
return 0, InvalidTypeError{"Expecting type Array or Object"}
}
h := s.head()
if h == 0x01 || h == 0x0a {
// special case: empty!
return 0, nil
}
if h == 0x13 || h == 0x14 {
// compact Array or Object
end := readVariableV... | [
"func",
"(",
"s",
"Slice",
")",
"Length",
"(",
")",
"(",
"ValueLength",
",",
"error",
")",
"{",
"if",
"!",
"s",
".",
"IsArray",
"(",
")",
"&&",
"!",
"s",
".",
"IsObject",
"(",
")",
"{",
"return",
"0",
",",
"InvalidTypeError",
"{",
"\"",
"\"",
"... | // Length return the number of members for an Array or Object object | [
"Length",
"return",
"the",
"number",
"of",
"members",
"for",
"an",
"Array",
"or",
"Object",
"object"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L386-L424 |
144,711 | arangodb/go-velocypack | slice.go | At | func (s Slice) At(index ValueLength) (Slice, error) {
if !s.IsArray() {
return nil, InvalidTypeError{"Expecting type Array"}
}
if result, err := s.getNth(index); err != nil {
return nil, WithStack(err)
} else {
return result, nil
}
} | go | func (s Slice) At(index ValueLength) (Slice, error) {
if !s.IsArray() {
return nil, InvalidTypeError{"Expecting type Array"}
}
if result, err := s.getNth(index); err != nil {
return nil, WithStack(err)
} else {
return result, nil
}
} | [
"func",
"(",
"s",
"Slice",
")",
"At",
"(",
"index",
"ValueLength",
")",
"(",
"Slice",
",",
"error",
")",
"{",
"if",
"!",
"s",
".",
"IsArray",
"(",
")",
"{",
"return",
"nil",
",",
"InvalidTypeError",
"{",
"\"",
"\"",
"}",
"\n",
"}",
"\n\n",
"if",
... | // At extracts the array value at the specified index. | [
"At",
"extracts",
"the",
"array",
"value",
"at",
"the",
"specified",
"index",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L427-L437 |
144,712 | arangodb/go-velocypack | slice.go | KeyAt | func (s Slice) KeyAt(index ValueLength, translate ...bool) (Slice, error) {
if !s.IsObject() {
return nil, InvalidTypeError{"Expecting type Object"}
}
return s.getNthKey(index, optionalBool(translate, true))
} | go | func (s Slice) KeyAt(index ValueLength, translate ...bool) (Slice, error) {
if !s.IsObject() {
return nil, InvalidTypeError{"Expecting type Object"}
}
return s.getNthKey(index, optionalBool(translate, true))
} | [
"func",
"(",
"s",
"Slice",
")",
"KeyAt",
"(",
"index",
"ValueLength",
",",
"translate",
"...",
"bool",
")",
"(",
"Slice",
",",
"error",
")",
"{",
"if",
"!",
"s",
".",
"IsObject",
"(",
")",
"{",
"return",
"nil",
",",
"InvalidTypeError",
"{",
"\"",
"... | // KeyAt extracts a key from an Object at the specified index. | [
"KeyAt",
"extracts",
"a",
"key",
"from",
"an",
"Object",
"at",
"the",
"specified",
"index",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L440-L446 |
144,713 | arangodb/go-velocypack | slice.go | ValueAt | func (s Slice) ValueAt(index ValueLength) (Slice, error) {
if !s.IsObject() {
return nil, InvalidTypeError{"Expecting type Object"}
}
key, err := s.getNthKey(index, false)
if err != nil {
return nil, WithStack(err)
}
byteSize, err := key.ByteSize()
if err != nil {
return nil, WithStack(err)
}
return Sli... | go | func (s Slice) ValueAt(index ValueLength) (Slice, error) {
if !s.IsObject() {
return nil, InvalidTypeError{"Expecting type Object"}
}
key, err := s.getNthKey(index, false)
if err != nil {
return nil, WithStack(err)
}
byteSize, err := key.ByteSize()
if err != nil {
return nil, WithStack(err)
}
return Sli... | [
"func",
"(",
"s",
"Slice",
")",
"ValueAt",
"(",
"index",
"ValueLength",
")",
"(",
"Slice",
",",
"error",
")",
"{",
"if",
"!",
"s",
".",
"IsObject",
"(",
")",
"{",
"return",
"nil",
",",
"InvalidTypeError",
"{",
"\"",
"\"",
"}",
"\n",
"}",
"\n\n",
... | // ValueAt extracts a value from an Object at the specified index | [
"ValueAt",
"extracts",
"a",
"value",
"from",
"an",
"Object",
"at",
"the",
"specified",
"index"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L449-L463 |
144,714 | arangodb/go-velocypack | slice.go | HasKey | func (s Slice) HasKey(keyPath ...string) (bool, error) {
if result, err := s.Get(keyPath...); err != nil {
return false, WithStack(err)
} else {
return !result.IsNone(), nil
}
} | go | func (s Slice) HasKey(keyPath ...string) (bool, error) {
if result, err := s.Get(keyPath...); err != nil {
return false, WithStack(err)
} else {
return !result.IsNone(), nil
}
} | [
"func",
"(",
"s",
"Slice",
")",
"HasKey",
"(",
"keyPath",
"...",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"result",
",",
"err",
":=",
"s",
".",
"Get",
"(",
"keyPath",
"...",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"false",
... | // HasKey returns true if the slice is an object that has a given key path. | [
"HasKey",
"returns",
"true",
"if",
"the",
"slice",
"is",
"an",
"object",
"that",
"has",
"a",
"given",
"key",
"path",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L581-L587 |
144,715 | arangodb/go-velocypack | slice.go | getNthOffset | func (s Slice) getNthOffset(index ValueLength) (ValueLength, error) {
vpackAssert(s.IsArray() || s.IsObject())
h := s.head()
if h == 0x13 || h == 0x14 {
// compact Array or Object
l, err := s.getNthOffsetFromCompact(index)
if err != nil {
return 0, WithStack(err)
}
return l, nil
}
if h == 0x01 || h... | go | func (s Slice) getNthOffset(index ValueLength) (ValueLength, error) {
vpackAssert(s.IsArray() || s.IsObject())
h := s.head()
if h == 0x13 || h == 0x14 {
// compact Array or Object
l, err := s.getNthOffsetFromCompact(index)
if err != nil {
return 0, WithStack(err)
}
return l, nil
}
if h == 0x01 || h... | [
"func",
"(",
"s",
"Slice",
")",
"getNthOffset",
"(",
"index",
"ValueLength",
")",
"(",
"ValueLength",
",",
"error",
")",
"{",
"vpackAssert",
"(",
"s",
".",
"IsArray",
"(",
")",
"||",
"s",
".",
"IsObject",
"(",
")",
")",
"\n\n",
"h",
":=",
"s",
".",... | // get the offset for the nth member from an Array or Object type | [
"get",
"the",
"offset",
"for",
"the",
"nth",
"member",
"from",
"an",
"Array",
"or",
"Object",
"type"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L635-L705 |
144,716 | arangodb/go-velocypack | slice.go | getNthOffsetFromCompact | func (s Slice) getNthOffsetFromCompact(index ValueLength) (ValueLength, error) {
end := ValueLength(readVariableValueLength(s, 1, false))
n := ValueLength(readVariableValueLength(s, end-1, true))
if index >= n {
return 0, WithStack(IndexOutOfBoundsError)
}
h := s.head()
offset := ValueLength(1 + getVariableVal... | go | func (s Slice) getNthOffsetFromCompact(index ValueLength) (ValueLength, error) {
end := ValueLength(readVariableValueLength(s, 1, false))
n := ValueLength(readVariableValueLength(s, end-1, true))
if index >= n {
return 0, WithStack(IndexOutOfBoundsError)
}
h := s.head()
offset := ValueLength(1 + getVariableVal... | [
"func",
"(",
"s",
"Slice",
")",
"getNthOffsetFromCompact",
"(",
"index",
"ValueLength",
")",
"(",
"ValueLength",
",",
"error",
")",
"{",
"end",
":=",
"ValueLength",
"(",
"readVariableValueLength",
"(",
"s",
",",
"1",
",",
"false",
")",
")",
"\n",
"n",
":... | // get the offset for the nth member from a compact Array or Object type | [
"get",
"the",
"offset",
"for",
"the",
"nth",
"member",
"from",
"a",
"compact",
"Array",
"or",
"Object",
"type"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L708-L736 |
144,717 | arangodb/go-velocypack | slice.go | getNth | func (s Slice) getNth(index ValueLength) (Slice, error) {
vpackAssert(s.IsArray())
offset, err := s.getNthOffset(index)
if err != nil {
return nil, WithStack(err)
}
return Slice(s[offset:]), nil
} | go | func (s Slice) getNth(index ValueLength) (Slice, error) {
vpackAssert(s.IsArray())
offset, err := s.getNthOffset(index)
if err != nil {
return nil, WithStack(err)
}
return Slice(s[offset:]), nil
} | [
"func",
"(",
"s",
"Slice",
")",
"getNth",
"(",
"index",
"ValueLength",
")",
"(",
"Slice",
",",
"error",
")",
"{",
"vpackAssert",
"(",
"s",
".",
"IsArray",
"(",
")",
")",
"\n\n",
"offset",
",",
"err",
":=",
"s",
".",
"getNthOffset",
"(",
"index",
")... | // extract the nth member from an Array | [
"extract",
"the",
"nth",
"member",
"from",
"an",
"Array"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L739-L747 |
144,718 | arangodb/go-velocypack | slice.go | getNthKey | func (s Slice) getNthKey(index ValueLength, translate bool) (Slice, error) {
vpackAssert(s.Type() == Object)
offset, err := s.getNthOffset(index)
if err != nil {
return nil, WithStack(err)
}
result := Slice(s[offset:])
if translate {
result, err = result.makeKey()
if err != nil {
return nil, WithStack(e... | go | func (s Slice) getNthKey(index ValueLength, translate bool) (Slice, error) {
vpackAssert(s.Type() == Object)
offset, err := s.getNthOffset(index)
if err != nil {
return nil, WithStack(err)
}
result := Slice(s[offset:])
if translate {
result, err = result.makeKey()
if err != nil {
return nil, WithStack(e... | [
"func",
"(",
"s",
"Slice",
")",
"getNthKey",
"(",
"index",
"ValueLength",
",",
"translate",
"bool",
")",
"(",
"Slice",
",",
"error",
")",
"{",
"vpackAssert",
"(",
"s",
".",
"Type",
"(",
")",
"==",
"Object",
")",
"\n\n",
"offset",
",",
"err",
":=",
... | // getNthKey extract the nth member from an Object | [
"getNthKey",
"extract",
"the",
"nth",
"member",
"from",
"an",
"Object"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L750-L765 |
144,719 | arangodb/go-velocypack | slice.go | getNthValue | func (s Slice) getNthValue(index ValueLength) (Slice, error) {
key, err := s.getNthKey(index, false)
if err != nil {
return nil, WithStack(err)
}
value, err := key.Next()
return value, WithStack(err)
} | go | func (s Slice) getNthValue(index ValueLength) (Slice, error) {
key, err := s.getNthKey(index, false)
if err != nil {
return nil, WithStack(err)
}
value, err := key.Next()
return value, WithStack(err)
} | [
"func",
"(",
"s",
"Slice",
")",
"getNthValue",
"(",
"index",
"ValueLength",
")",
"(",
"Slice",
",",
"error",
")",
"{",
"key",
",",
"err",
":=",
"s",
".",
"getNthKey",
"(",
"index",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // getNthValue extract the nth value from an Object | [
"getNthValue",
"extract",
"the",
"nth",
"value",
"from",
"an",
"Object"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L768-L775 |
144,720 | arangodb/go-velocypack | slice.go | searchObjectKeyLinear | func (s Slice) searchObjectKeyLinear(attribute string, ieBase, offsetSize, n ValueLength) (Slice, error) {
useTranslator := attributeTranslator != nil
for index := ValueLength(0); index < n; index++ {
offset := ValueLength(ieBase + index*offsetSize)
key := Slice(s[readIntegerNonEmpty(s[offset:], uint(offsetSize)... | go | func (s Slice) searchObjectKeyLinear(attribute string, ieBase, offsetSize, n ValueLength) (Slice, error) {
useTranslator := attributeTranslator != nil
for index := ValueLength(0); index < n; index++ {
offset := ValueLength(ieBase + index*offsetSize)
key := Slice(s[readIntegerNonEmpty(s[offset:], uint(offsetSize)... | [
"func",
"(",
"s",
"Slice",
")",
"searchObjectKeyLinear",
"(",
"attribute",
"string",
",",
"ieBase",
",",
"offsetSize",
",",
"n",
"ValueLength",
")",
"(",
"Slice",
",",
"error",
")",
"{",
"useTranslator",
":=",
"attributeTranslator",
"!=",
"nil",
"\n\n",
"for... | // perform a linear search for the specified attribute inside an Object | [
"perform",
"a",
"linear",
"search",
"for",
"the",
"specified",
"attribute",
"inside",
"an",
"Object"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L792-L828 |
144,721 | arangodb/go-velocypack | slice.go | translate | func (s Slice) translate() (Slice, error) {
if !s.IsSmallInt() && !s.IsUInt() {
return nil, WithStack(InvalidTypeError{"Cannot translate key of this type"})
}
if attributeTranslator == nil {
return nil, WithStack(NeedAttributeTranslatorError)
}
return s.translateUnchecked(), nil
} | go | func (s Slice) translate() (Slice, error) {
if !s.IsSmallInt() && !s.IsUInt() {
return nil, WithStack(InvalidTypeError{"Cannot translate key of this type"})
}
if attributeTranslator == nil {
return nil, WithStack(NeedAttributeTranslatorError)
}
return s.translateUnchecked(), nil
} | [
"func",
"(",
"s",
"Slice",
")",
"translate",
"(",
")",
"(",
"Slice",
",",
"error",
")",
"{",
"if",
"!",
"s",
".",
"IsSmallInt",
"(",
")",
"&&",
"!",
"s",
".",
"IsUInt",
"(",
")",
"{",
"return",
"nil",
",",
"WithStack",
"(",
"InvalidTypeError",
"{... | // translates an integer key into a string | [
"translates",
"an",
"integer",
"key",
"into",
"a",
"string"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L893-L901 |
144,722 | arangodb/go-velocypack | slice.go | translateUnchecked | func (s Slice) translateUnchecked() Slice {
id := s.getUIntUnchecked()
key := attributeTranslator.IDToString(id)
if key == "" {
return nil
}
return StringSlice(key)
} | go | func (s Slice) translateUnchecked() Slice {
id := s.getUIntUnchecked()
key := attributeTranslator.IDToString(id)
if key == "" {
return nil
}
return StringSlice(key)
} | [
"func",
"(",
"s",
"Slice",
")",
"translateUnchecked",
"(",
")",
"Slice",
"{",
"id",
":=",
"s",
".",
"getUIntUnchecked",
"(",
")",
"\n",
"key",
":=",
"attributeTranslator",
".",
"IDToString",
"(",
"id",
")",
"\n",
"if",
"key",
"==",
"\"",
"\"",
"{",
"... | // translates an integer key into a string, without checks | [
"translates",
"an",
"integer",
"key",
"into",
"a",
"string",
"without",
"checks"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice.go#L920-L927 |
144,723 | arangodb/go-velocypack | encoder.go | Encode | func (e *Encoder) Encode(v interface{}) (err error) {
defer func() {
if r := recover(); r != nil {
if _, ok := r.(runtime.Error); ok {
panic(r)
}
if s, ok := r.(string); ok {
panic(s)
}
err = r.(error)
}
}()
e.b.Clear()
reflectValue(&e.b, reflect.ValueOf(v), encoderOptions{})
if _, err :... | go | func (e *Encoder) Encode(v interface{}) (err error) {
defer func() {
if r := recover(); r != nil {
if _, ok := r.(runtime.Error); ok {
panic(r)
}
if s, ok := r.(string); ok {
panic(s)
}
err = r.(error)
}
}()
e.b.Clear()
reflectValue(&e.b, reflect.ValueOf(v), encoderOptions{})
if _, err :... | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"Encode",
"(",
"v",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"r",
":=",
"recover",
"(",
")",
";",
"r",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":... | // Encode writes the Velocypack encoding of v to the stream. | [
"Encode",
"writes",
"the",
"Velocypack",
"encoding",
"of",
"v",
"to",
"the",
"stream",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/encoder.go#L125-L143 |
144,724 | arangodb/go-velocypack | slice_type.go | IsType | func (s Slice) IsType(t ValueType) bool {
return typeMap[s.head()] == t
} | go | func (s Slice) IsType(t ValueType) bool {
return typeMap[s.head()] == t
} | [
"func",
"(",
"s",
"Slice",
")",
"IsType",
"(",
"t",
"ValueType",
")",
"bool",
"{",
"return",
"typeMap",
"[",
"s",
".",
"head",
"(",
")",
"]",
"==",
"t",
"\n",
"}"
] | // IsType returns true when the vpack type of the slice is equal to the given type.
// Returns false otherwise. | [
"IsType",
"returns",
"true",
"when",
"the",
"vpack",
"type",
"of",
"the",
"slice",
"is",
"equal",
"to",
"the",
"given",
"type",
".",
"Returns",
"false",
"otherwise",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice_type.go#L34-L36 |
144,725 | arangodb/go-velocypack | slice_type.go | AssertType | func (s Slice) AssertType(t ValueType) error {
if found := typeMap[s.head()]; found != t {
return WithStack(InvalidTypeError{Message: fmt.Sprintf("expected type '%s', got '%s'", t, found)})
}
return nil
} | go | func (s Slice) AssertType(t ValueType) error {
if found := typeMap[s.head()]; found != t {
return WithStack(InvalidTypeError{Message: fmt.Sprintf("expected type '%s', got '%s'", t, found)})
}
return nil
} | [
"func",
"(",
"s",
"Slice",
")",
"AssertType",
"(",
"t",
"ValueType",
")",
"error",
"{",
"if",
"found",
":=",
"typeMap",
"[",
"s",
".",
"head",
"(",
")",
"]",
";",
"found",
"!=",
"t",
"{",
"return",
"WithStack",
"(",
"InvalidTypeError",
"{",
"Message"... | // AssertType returns an error when the vpack type of the slice different from the given type.
// Returns nil otherwise. | [
"AssertType",
"returns",
"an",
"error",
"when",
"the",
"vpack",
"type",
"of",
"the",
"slice",
"different",
"from",
"the",
"given",
"type",
".",
"Returns",
"nil",
"otherwise",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice_type.go#L40-L45 |
144,726 | arangodb/go-velocypack | slice_type.go | AssertTypeAny | func (s Slice) AssertTypeAny(t ...ValueType) error {
found := typeMap[s.head()]
for _, x := range t {
if x == found {
return nil
}
}
return WithStack(InvalidTypeError{Message: fmt.Sprintf("expected types '%q', got '%s'", t, found)})
} | go | func (s Slice) AssertTypeAny(t ...ValueType) error {
found := typeMap[s.head()]
for _, x := range t {
if x == found {
return nil
}
}
return WithStack(InvalidTypeError{Message: fmt.Sprintf("expected types '%q', got '%s'", t, found)})
} | [
"func",
"(",
"s",
"Slice",
")",
"AssertTypeAny",
"(",
"t",
"...",
"ValueType",
")",
"error",
"{",
"found",
":=",
"typeMap",
"[",
"s",
".",
"head",
"(",
")",
"]",
"\n",
"for",
"_",
",",
"x",
":=",
"range",
"t",
"{",
"if",
"x",
"==",
"found",
"{"... | // AssertTypeAny returns an error when the vpack type of the slice different from all of the given types.
// Returns nil otherwise. | [
"AssertTypeAny",
"returns",
"an",
"error",
"when",
"the",
"vpack",
"type",
"of",
"the",
"slice",
"different",
"from",
"all",
"of",
"the",
"given",
"types",
".",
"Returns",
"nil",
"otherwise",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/slice_type.go#L49-L57 |
144,727 | arangodb/go-velocypack | object_iterator.go | NewObjectIterator | func NewObjectIterator(s Slice, allowRandomIteration ...bool) (*ObjectIterator, error) {
if !s.IsObject() {
return nil, InvalidTypeError{"Expected Object slice"}
}
size, err := s.Length()
if err != nil {
return nil, WithStack(err)
}
i := &ObjectIterator{
s: s,
position: 0,
size: size,
}
if ... | go | func NewObjectIterator(s Slice, allowRandomIteration ...bool) (*ObjectIterator, error) {
if !s.IsObject() {
return nil, InvalidTypeError{"Expected Object slice"}
}
size, err := s.Length()
if err != nil {
return nil, WithStack(err)
}
i := &ObjectIterator{
s: s,
position: 0,
size: size,
}
if ... | [
"func",
"NewObjectIterator",
"(",
"s",
"Slice",
",",
"allowRandomIteration",
"...",
"bool",
")",
"(",
"*",
"ObjectIterator",
",",
"error",
")",
"{",
"if",
"!",
"s",
".",
"IsObject",
"(",
")",
"{",
"return",
"nil",
",",
"InvalidTypeError",
"{",
"\"",
"\""... | // NewObjectIterator initializes an iterator at position 0 of the given object slice. | [
"NewObjectIterator",
"initializes",
"an",
"iterator",
"at",
"position",
"0",
"of",
"the",
"given",
"object",
"slice",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/object_iterator.go#L33-L54 |
144,728 | arangodb/go-velocypack | object_iterator.go | Key | func (i *ObjectIterator) Key(translate bool) (Slice, error) {
if i.position >= i.size {
return nil, WithStack(IndexOutOfBoundsError)
}
if current := i.current; current != nil {
if translate {
key, err := current.makeKey()
return key, WithStack(err)
}
return current, nil
}
key, err := i.s.getNthKey(i.... | go | func (i *ObjectIterator) Key(translate bool) (Slice, error) {
if i.position >= i.size {
return nil, WithStack(IndexOutOfBoundsError)
}
if current := i.current; current != nil {
if translate {
key, err := current.makeKey()
return key, WithStack(err)
}
return current, nil
}
key, err := i.s.getNthKey(i.... | [
"func",
"(",
"i",
"*",
"ObjectIterator",
")",
"Key",
"(",
"translate",
"bool",
")",
"(",
"Slice",
",",
"error",
")",
"{",
"if",
"i",
".",
"position",
">=",
"i",
".",
"size",
"{",
"return",
"nil",
",",
"WithStack",
"(",
"IndexOutOfBoundsError",
")",
"... | // Key returns the key of the current position of the iterator | [
"Key",
"returns",
"the",
"key",
"of",
"the",
"current",
"position",
"of",
"the",
"iterator"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/object_iterator.go#L67-L80 |
144,729 | arangodb/go-velocypack | object_iterator.go | Next | func (i *ObjectIterator) Next() error {
i.position++
if i.position < i.size && i.current != nil {
var err error
// skip over key
i.current, err = i.current.Next()
if err != nil {
return WithStack(err)
}
// skip over value
i.current, err = i.current.Next()
if err != nil {
return WithStack(err)
... | go | func (i *ObjectIterator) Next() error {
i.position++
if i.position < i.size && i.current != nil {
var err error
// skip over key
i.current, err = i.current.Next()
if err != nil {
return WithStack(err)
}
// skip over value
i.current, err = i.current.Next()
if err != nil {
return WithStack(err)
... | [
"func",
"(",
"i",
"*",
"ObjectIterator",
")",
"Next",
"(",
")",
"error",
"{",
"i",
".",
"position",
"++",
"\n",
"if",
"i",
".",
"position",
"<",
"i",
".",
"size",
"&&",
"i",
".",
"current",
"!=",
"nil",
"{",
"var",
"err",
"error",
"\n",
"// skip ... | // Next moves to the next position. | [
"Next",
"moves",
"to",
"the",
"next",
"position",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/object_iterator.go#L96-L114 |
144,730 | arangodb/go-velocypack | builder_index_vector.go | RemoveLast | func (iv *indexVector) RemoveLast() {
l := len(*iv)
if l > 0 {
*iv = (*iv)[:l-1]
}
} | go | func (iv *indexVector) RemoveLast() {
l := len(*iv)
if l > 0 {
*iv = (*iv)[:l-1]
}
} | [
"func",
"(",
"iv",
"*",
"indexVector",
")",
"RemoveLast",
"(",
")",
"{",
"l",
":=",
"len",
"(",
"*",
"iv",
")",
"\n",
"if",
"l",
">",
"0",
"{",
"*",
"iv",
"=",
"(",
"*",
"iv",
")",
"[",
":",
"l",
"-",
"1",
"]",
"\n",
"}",
"\n",
"}"
] | // RemoveLast removes the last index position from the end of the list. | [
"RemoveLast",
"removes",
"the",
"last",
"index",
"position",
"from",
"the",
"end",
"of",
"the",
"list",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder_index_vector.go#L39-L44 |
144,731 | arangodb/go-velocypack | builder.go | Bytes | func (b *Builder) Bytes() ([]byte, error) {
if !b.IsClosed() {
return nil, WithStack(BuilderNotClosedError)
}
return b.buf, nil
} | go | func (b *Builder) Bytes() ([]byte, error) {
if !b.IsClosed() {
return nil, WithStack(BuilderNotClosedError)
}
return b.buf, nil
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"Bytes",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"!",
"b",
".",
"IsClosed",
"(",
")",
"{",
"return",
"nil",
",",
"WithStack",
"(",
"BuilderNotClosedError",
")",
"\n",
"}",
"\n",
"retur... | // Bytes return the generated bytes.
// The returned slice is shared with the builder itself, so you must not modify it.
// When the builder is not closed, an error is returned. | [
"Bytes",
"return",
"the",
"generated",
"bytes",
".",
"The",
"returned",
"slice",
"is",
"shared",
"with",
"the",
"builder",
"itself",
"so",
"you",
"must",
"not",
"modify",
"it",
".",
"When",
"the",
"builder",
"is",
"not",
"closed",
"an",
"error",
"is",
"r... | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L66-L71 |
144,732 | arangodb/go-velocypack | builder.go | Slice | func (b *Builder) Slice() (Slice, error) {
if b.buf.IsEmpty() {
return Slice{}, nil
}
bytes, err := b.Bytes()
return bytes, WithStack(err)
} | go | func (b *Builder) Slice() (Slice, error) {
if b.buf.IsEmpty() {
return Slice{}, nil
}
bytes, err := b.Bytes()
return bytes, WithStack(err)
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"Slice",
"(",
")",
"(",
"Slice",
",",
"error",
")",
"{",
"if",
"b",
".",
"buf",
".",
"IsEmpty",
"(",
")",
"{",
"return",
"Slice",
"{",
"}",
",",
"nil",
"\n",
"}",
"\n",
"bytes",
",",
"err",
":=",
"b",
... | // Slice returns a slice of the result. | [
"Slice",
"returns",
"a",
"slice",
"of",
"the",
"result",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L74-L80 |
144,733 | arangodb/go-velocypack | builder.go | WriteTo | func (b *Builder) WriteTo(w io.Writer) (int64, error) {
if !b.IsClosed() {
return 0, WithStack(BuilderNotClosedError)
}
if n, err := w.Write(b.buf); err != nil {
return 0, WithStack(err)
} else {
return int64(n), nil
}
} | go | func (b *Builder) WriteTo(w io.Writer) (int64, error) {
if !b.IsClosed() {
return 0, WithStack(BuilderNotClosedError)
}
if n, err := w.Write(b.buf); err != nil {
return 0, WithStack(err)
} else {
return int64(n), nil
}
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"if",
"!",
"b",
".",
"IsClosed",
"(",
")",
"{",
"return",
"0",
",",
"WithStack",
"(",
"BuilderNotClosedError",
")",
"\n",
... | // WriteTo writes the generated bytes to the given writer.
// When the builder is not closed, an error is returned. | [
"WriteTo",
"writes",
"the",
"generated",
"bytes",
"to",
"the",
"given",
"writer",
".",
"When",
"the",
"builder",
"is",
"not",
"closed",
"an",
"error",
"is",
"returned",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L84-L93 |
144,734 | arangodb/go-velocypack | builder.go | Size | func (b *Builder) Size() (ValueLength, error) {
if !b.IsClosed() {
return 0, WithStack(BuilderNotClosedError)
}
return b.buf.Len(), nil
} | go | func (b *Builder) Size() (ValueLength, error) {
if !b.IsClosed() {
return 0, WithStack(BuilderNotClosedError)
}
return b.buf.Len(), nil
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"Size",
"(",
")",
"(",
"ValueLength",
",",
"error",
")",
"{",
"if",
"!",
"b",
".",
"IsClosed",
"(",
")",
"{",
"return",
"0",
",",
"WithStack",
"(",
"BuilderNotClosedError",
")",
"\n",
"}",
"\n",
"return",
"b",... | // Size returns the actual size of the generated slice.
// Returns an error when builder is not closed. | [
"Size",
"returns",
"the",
"actual",
"size",
"of",
"the",
"generated",
"slice",
".",
"Returns",
"an",
"error",
"when",
"builder",
"is",
"not",
"closed",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L97-L102 |
144,735 | arangodb/go-velocypack | builder.go | IsOpenObject | func (b *Builder) IsOpenObject() bool {
if b.stack.IsEmpty() {
return false
}
tos, _ := b.stack.Tos()
h := b.buf[tos]
return h == 0x0b || h == 0x014
} | go | func (b *Builder) IsOpenObject() bool {
if b.stack.IsEmpty() {
return false
}
tos, _ := b.stack.Tos()
h := b.buf[tos]
return h == 0x0b || h == 0x014
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"IsOpenObject",
"(",
")",
"bool",
"{",
"if",
"b",
".",
"stack",
".",
"IsEmpty",
"(",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"tos",
",",
"_",
":=",
"b",
".",
"stack",
".",
"Tos",
"(",
")",
"\n",
"h... | // IsOpenObject returns true when the builder has an open object at the top of the stack. | [
"IsOpenObject",
"returns",
"true",
"when",
"the",
"builder",
"has",
"an",
"open",
"object",
"at",
"the",
"top",
"of",
"the",
"stack",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L110-L117 |
144,736 | arangodb/go-velocypack | builder.go | OpenObject | func (b *Builder) OpenObject(unindexed ...bool) error {
var vType byte
if optionalBool(unindexed, false) {
vType = 0x14
} else {
vType = 0x0b
}
return WithStack(b.openCompoundValue(vType))
} | go | func (b *Builder) OpenObject(unindexed ...bool) error {
var vType byte
if optionalBool(unindexed, false) {
vType = 0x14
} else {
vType = 0x0b
}
return WithStack(b.openCompoundValue(vType))
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"OpenObject",
"(",
"unindexed",
"...",
"bool",
")",
"error",
"{",
"var",
"vType",
"byte",
"\n",
"if",
"optionalBool",
"(",
"unindexed",
",",
"false",
")",
"{",
"vType",
"=",
"0x14",
"\n",
"}",
"else",
"{",
"vTyp... | // OpenObject starts a new object.
// This must be closed using Close. | [
"OpenObject",
"starts",
"a",
"new",
"object",
".",
"This",
"must",
"be",
"closed",
"using",
"Close",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L131-L139 |
144,737 | arangodb/go-velocypack | builder.go | HasKey | func (b *Builder) HasKey(key string) (bool, error) {
if b.stack.IsEmpty() {
return false, WithStack(BuilderNeedOpenObjectError)
}
tos, _ := b.stack.Tos()
h := b.buf[tos]
if h != 0x0b && h != 0x14 {
return false, WithStack(BuilderNeedOpenObjectError)
}
index := b.index[b.stack.Len()-1]
if index.IsEmpty() {
... | go | func (b *Builder) HasKey(key string) (bool, error) {
if b.stack.IsEmpty() {
return false, WithStack(BuilderNeedOpenObjectError)
}
tos, _ := b.stack.Tos()
h := b.buf[tos]
if h != 0x0b && h != 0x14 {
return false, WithStack(BuilderNeedOpenObjectError)
}
index := b.index[b.stack.Len()-1]
if index.IsEmpty() {
... | [
"func",
"(",
"b",
"*",
"Builder",
")",
"HasKey",
"(",
"key",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"b",
".",
"stack",
".",
"IsEmpty",
"(",
")",
"{",
"return",
"false",
",",
"WithStack",
"(",
"BuilderNeedOpenObjectError",
")",
"\n"... | // HasKey checks whether an Object value has a specific key attribute. | [
"HasKey",
"checks",
"whether",
"an",
"Object",
"value",
"has",
"a",
"specific",
"key",
"attribute",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L298-L324 |
144,738 | arangodb/go-velocypack | builder.go | GetKey | func (b *Builder) GetKey(key string) (Slice, error) {
if b.stack.IsEmpty() {
return nil, WithStack(BuilderNeedOpenObjectError)
}
tos, _ := b.stack.Tos()
h := b.buf[tos]
if h != 0x0b && h != 0x14 {
return nil, WithStack(BuilderNeedOpenObjectError)
}
index := b.index[b.stack.Len()-1]
if index.IsEmpty() {
re... | go | func (b *Builder) GetKey(key string) (Slice, error) {
if b.stack.IsEmpty() {
return nil, WithStack(BuilderNeedOpenObjectError)
}
tos, _ := b.stack.Tos()
h := b.buf[tos]
if h != 0x0b && h != 0x14 {
return nil, WithStack(BuilderNeedOpenObjectError)
}
index := b.index[b.stack.Len()-1]
if index.IsEmpty() {
re... | [
"func",
"(",
"b",
"*",
"Builder",
")",
"GetKey",
"(",
"key",
"string",
")",
"(",
"Slice",
",",
"error",
")",
"{",
"if",
"b",
".",
"stack",
".",
"IsEmpty",
"(",
")",
"{",
"return",
"nil",
",",
"WithStack",
"(",
"BuilderNeedOpenObjectError",
")",
"\n",... | // GetKey returns the value for a specific key of an Object value.
// Returns Slice of type None when key is not found. | [
"GetKey",
"returns",
"the",
"value",
"for",
"a",
"specific",
"key",
"of",
"an",
"Object",
"value",
".",
"Returns",
"Slice",
"of",
"type",
"None",
"when",
"key",
"is",
"not",
"found",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L328-L358 |
144,739 | arangodb/go-velocypack | builder.go | addBool | func (b *Builder) addBool(v bool) {
if v {
b.addTrue()
} else {
b.addFalse()
}
} | go | func (b *Builder) addBool(v bool) {
if v {
b.addTrue()
} else {
b.addFalse()
}
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"addBool",
"(",
"v",
"bool",
")",
"{",
"if",
"v",
"{",
"b",
".",
"addTrue",
"(",
")",
"\n",
"}",
"else",
"{",
"b",
".",
"addFalse",
"(",
")",
"\n",
"}",
"\n",
"}"
] | // addBool adds a bool value to the buffer. | [
"addBool",
"adds",
"a",
"bool",
"value",
"to",
"the",
"buffer",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L393-L399 |
144,740 | arangodb/go-velocypack | builder.go | addDouble | func (b *Builder) addDouble(v float64) {
bits := math.Float64bits(v)
b.buf.ReserveSpace(9)
b.buf.WriteByte(0x1b)
binary.LittleEndian.PutUint64(b.buf.Grow(8), bits)
} | go | func (b *Builder) addDouble(v float64) {
bits := math.Float64bits(v)
b.buf.ReserveSpace(9)
b.buf.WriteByte(0x1b)
binary.LittleEndian.PutUint64(b.buf.Grow(8), bits)
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"addDouble",
"(",
"v",
"float64",
")",
"{",
"bits",
":=",
"math",
".",
"Float64bits",
"(",
"v",
")",
"\n",
"b",
".",
"buf",
".",
"ReserveSpace",
"(",
"9",
")",
"\n",
"b",
".",
"buf",
".",
"WriteByte",
"(",
... | // addDouble adds a double value to the buffer. | [
"addDouble",
"adds",
"a",
"double",
"value",
"to",
"the",
"buffer",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L402-L407 |
144,741 | arangodb/go-velocypack | builder.go | addInt | func (b *Builder) addInt(v int64) {
if v >= 0 && v <= 9 {
b.buf.WriteByte(0x30 + byte(v))
} else if v < 0 && v >= -6 {
b.buf.WriteByte(byte(0x40 + int(v)))
} else {
b.appendInt(v, 0x1f)
}
} | go | func (b *Builder) addInt(v int64) {
if v >= 0 && v <= 9 {
b.buf.WriteByte(0x30 + byte(v))
} else if v < 0 && v >= -6 {
b.buf.WriteByte(byte(0x40 + int(v)))
} else {
b.appendInt(v, 0x1f)
}
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"addInt",
"(",
"v",
"int64",
")",
"{",
"if",
"v",
">=",
"0",
"&&",
"v",
"<=",
"9",
"{",
"b",
".",
"buf",
".",
"WriteByte",
"(",
"0x30",
"+",
"byte",
"(",
"v",
")",
")",
"\n",
"}",
"else",
"if",
"v",
... | // addInt adds an int value to the buffer. | [
"addInt",
"adds",
"an",
"int",
"value",
"to",
"the",
"buffer",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L410-L418 |
144,742 | arangodb/go-velocypack | builder.go | addUInt | func (b *Builder) addUInt(v uint64) {
if v <= 9 {
b.buf.WriteByte(0x30 + byte(v))
} else {
b.appendUInt(v, 0x27)
}
} | go | func (b *Builder) addUInt(v uint64) {
if v <= 9 {
b.buf.WriteByte(0x30 + byte(v))
} else {
b.appendUInt(v, 0x27)
}
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"addUInt",
"(",
"v",
"uint64",
")",
"{",
"if",
"v",
"<=",
"9",
"{",
"b",
".",
"buf",
".",
"WriteByte",
"(",
"0x30",
"+",
"byte",
"(",
"v",
")",
")",
"\n",
"}",
"else",
"{",
"b",
".",
"appendUInt",
"(",
... | // addUInt adds an uint value to the buffer. | [
"addUInt",
"adds",
"an",
"uint",
"value",
"to",
"the",
"buffer",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L421-L427 |
144,743 | arangodb/go-velocypack | builder.go | addUTCDate | func (b *Builder) addUTCDate(v int64) {
x := toUInt64(v)
dst := b.buf.Grow(9)
dst[0] = 0x1c
setLength(dst[1:], ValueLength(x), 8)
} | go | func (b *Builder) addUTCDate(v int64) {
x := toUInt64(v)
dst := b.buf.Grow(9)
dst[0] = 0x1c
setLength(dst[1:], ValueLength(x), 8)
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"addUTCDate",
"(",
"v",
"int64",
")",
"{",
"x",
":=",
"toUInt64",
"(",
"v",
")",
"\n",
"dst",
":=",
"b",
".",
"buf",
".",
"Grow",
"(",
"9",
")",
"\n",
"dst",
"[",
"0",
"]",
"=",
"0x1c",
"\n",
"setLength"... | // addUTCDate adds an UTC date value to the buffer. | [
"addUTCDate",
"adds",
"an",
"UTC",
"date",
"value",
"to",
"the",
"buffer",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L430-L435 |
144,744 | arangodb/go-velocypack | builder.go | addString | func (b *Builder) addString(v string) {
strLen := uint(len(v))
if strLen > 126 {
// long string
dst := b.buf.Grow(1 + 8 + strLen)
dst[0] = 0xbf
setLength(dst[1:], ValueLength(strLen), 8) // string length
copy(dst[9:], v) // string data
} else {
dst := b.buf.Grow(1 + strLen)
ds... | go | func (b *Builder) addString(v string) {
strLen := uint(len(v))
if strLen > 126 {
// long string
dst := b.buf.Grow(1 + 8 + strLen)
dst[0] = 0xbf
setLength(dst[1:], ValueLength(strLen), 8) // string length
copy(dst[9:], v) // string data
} else {
dst := b.buf.Grow(1 + strLen)
ds... | [
"func",
"(",
"b",
"*",
"Builder",
")",
"addString",
"(",
"v",
"string",
")",
"{",
"strLen",
":=",
"uint",
"(",
"len",
"(",
"v",
")",
")",
"\n",
"if",
"strLen",
">",
"126",
"{",
"// long string",
"dst",
":=",
"b",
".",
"buf",
".",
"Grow",
"(",
"... | // addString adds a string value to the buffer. | [
"addString",
"adds",
"a",
"string",
"value",
"to",
"the",
"buffer",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L438-L451 |
144,745 | arangodb/go-velocypack | builder.go | addBinary | func (b *Builder) addBinary(v []byte) {
l := uint(len(v))
b.buf.ReserveSpace(1 + 8 + l)
b.appendUInt(uint64(l), 0xbf) // data length
b.buf.Write(v) // data
} | go | func (b *Builder) addBinary(v []byte) {
l := uint(len(v))
b.buf.ReserveSpace(1 + 8 + l)
b.appendUInt(uint64(l), 0xbf) // data length
b.buf.Write(v) // data
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"addBinary",
"(",
"v",
"[",
"]",
"byte",
")",
"{",
"l",
":=",
"uint",
"(",
"len",
"(",
"v",
")",
")",
"\n",
"b",
".",
"buf",
".",
"ReserveSpace",
"(",
"1",
"+",
"8",
"+",
"l",
")",
"\n",
"b",
".",
"a... | // addBinary adds a binary value to the buffer. | [
"addBinary",
"adds",
"a",
"binary",
"value",
"to",
"the",
"buffer",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L454-L459 |
144,746 | arangodb/go-velocypack | builder.go | AddKeyValue | func (b *Builder) AddKeyValue(key string, v Value) error {
if err := b.addInternalKeyValue(key, v); err != nil {
return WithStack(err)
}
return nil
} | go | func (b *Builder) AddKeyValue(key string, v Value) error {
if err := b.addInternalKeyValue(key, v); err != nil {
return WithStack(err)
}
return nil
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"AddKeyValue",
"(",
"key",
"string",
",",
"v",
"Value",
")",
"error",
"{",
"if",
"err",
":=",
"b",
".",
"addInternalKeyValue",
"(",
"key",
",",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"WithStack",
"(... | // AddKeyValue adds a key+value to an open object. | [
"AddKeyValue",
"adds",
"a",
"key",
"+",
"value",
"to",
"an",
"open",
"object",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L503-L508 |
144,747 | arangodb/go-velocypack | builder.go | AddValuesFromIterator | func (b *Builder) AddValuesFromIterator(it *ArrayIterator) error {
if b.stack.IsEmpty() {
return WithStack(BuilderNeedOpenArrayError)
}
tos, _ := b.stack.Tos()
h := b.buf[tos]
if h != 0x06 && h != 0x13 {
return WithStack(BuilderNeedOpenArrayError)
}
for it.IsValid() {
v, err := it.Value()
if err != nil {... | go | func (b *Builder) AddValuesFromIterator(it *ArrayIterator) error {
if b.stack.IsEmpty() {
return WithStack(BuilderNeedOpenArrayError)
}
tos, _ := b.stack.Tos()
h := b.buf[tos]
if h != 0x06 && h != 0x13 {
return WithStack(BuilderNeedOpenArrayError)
}
for it.IsValid() {
v, err := it.Value()
if err != nil {... | [
"func",
"(",
"b",
"*",
"Builder",
")",
"AddValuesFromIterator",
"(",
"it",
"*",
"ArrayIterator",
")",
"error",
"{",
"if",
"b",
".",
"stack",
".",
"IsEmpty",
"(",
")",
"{",
"return",
"WithStack",
"(",
"BuilderNeedOpenArrayError",
")",
"\n",
"}",
"\n",
"to... | // AddValuesFromIterator adds values to an array from the given iterator.
// The array must be opened before a call to this function and the array is left open Intentionally. | [
"AddValuesFromIterator",
"adds",
"values",
"to",
"an",
"array",
"from",
"the",
"given",
"iterator",
".",
"The",
"array",
"must",
"be",
"opened",
"before",
"a",
"call",
"to",
"this",
"function",
"and",
"the",
"array",
"is",
"left",
"open",
"Intentionally",
".... | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L512-L534 |
144,748 | arangodb/go-velocypack | builder.go | AddKeyValuesFromIterator | func (b *Builder) AddKeyValuesFromIterator(it *ObjectIterator) error {
if b.stack.IsEmpty() {
return WithStack(BuilderNeedOpenObjectError)
}
tos, _ := b.stack.Tos()
h := b.buf[tos]
if h != 0x0b && h != 0x14 {
return WithStack(BuilderNeedOpenObjectError)
}
if b.keyWritten {
return WithStack(BuilderKeyAlread... | go | func (b *Builder) AddKeyValuesFromIterator(it *ObjectIterator) error {
if b.stack.IsEmpty() {
return WithStack(BuilderNeedOpenObjectError)
}
tos, _ := b.stack.Tos()
h := b.buf[tos]
if h != 0x0b && h != 0x14 {
return WithStack(BuilderNeedOpenObjectError)
}
if b.keyWritten {
return WithStack(BuilderKeyAlread... | [
"func",
"(",
"b",
"*",
"Builder",
")",
"AddKeyValuesFromIterator",
"(",
"it",
"*",
"ObjectIterator",
")",
"error",
"{",
"if",
"b",
".",
"stack",
".",
"IsEmpty",
"(",
")",
"{",
"return",
"WithStack",
"(",
"BuilderNeedOpenObjectError",
")",
"\n",
"}",
"\n",
... | // AddKeyValuesFromIterator adds values to an object from the given iterator.
// The object must be opened before a call to this function and the object is left open Intentionally. | [
"AddKeyValuesFromIterator",
"adds",
"values",
"to",
"an",
"object",
"from",
"the",
"given",
"iterator",
".",
"The",
"object",
"must",
"be",
"opened",
"before",
"a",
"call",
"to",
"this",
"function",
"and",
"the",
"object",
"is",
"left",
"open",
"Intentionally"... | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L538-L571 |
144,749 | arangodb/go-velocypack | builder.go | intLength | func intLength(value int64) uint {
if value >= -0x80 && value <= 0x7f {
// shortcut for the common case
return 1
}
var x uint64
if value >= 0 {
x = uint64(value)
} else {
x = uint64(-(value + 1))
}
xSize := uint(0)
for {
xSize++
x >>= 8
if x < 0x80 {
return xSize + 1
}
}
} | go | func intLength(value int64) uint {
if value >= -0x80 && value <= 0x7f {
// shortcut for the common case
return 1
}
var x uint64
if value >= 0 {
x = uint64(value)
} else {
x = uint64(-(value + 1))
}
xSize := uint(0)
for {
xSize++
x >>= 8
if x < 0x80 {
return xSize + 1
}
}
} | [
"func",
"intLength",
"(",
"value",
"int64",
")",
"uint",
"{",
"if",
"value",
">=",
"-",
"0x80",
"&&",
"value",
"<=",
"0x7f",
"{",
"// shortcut for the common case",
"return",
"1",
"\n",
"}",
"\n",
"var",
"x",
"uint64",
"\n",
"if",
"value",
">=",
"0",
"... | // returns number of bytes required to store the value in 2s-complement | [
"returns",
"number",
"of",
"bytes",
"required",
"to",
"store",
"the",
"value",
"in",
"2s",
"-",
"complement"
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L574-L593 |
144,750 | arangodb/go-velocypack | builder.go | addCompoundValue | func (b *Builder) addCompoundValue(vType byte) {
pos := b.buf.Len()
b.stack.Push(pos)
stackLen := b.stack.Len()
toAdd := stackLen - len(b.index)
for toAdd > 0 {
newIndex := make(indexVector, 0, 16) // Pre-allocate 16 entries so we don't have to allocate memory for the first 16 entries
b.index = append(b.index,... | go | func (b *Builder) addCompoundValue(vType byte) {
pos := b.buf.Len()
b.stack.Push(pos)
stackLen := b.stack.Len()
toAdd := stackLen - len(b.index)
for toAdd > 0 {
newIndex := make(indexVector, 0, 16) // Pre-allocate 16 entries so we don't have to allocate memory for the first 16 entries
b.index = append(b.index,... | [
"func",
"(",
"b",
"*",
"Builder",
")",
"addCompoundValue",
"(",
"vType",
"byte",
")",
"{",
"pos",
":=",
"b",
".",
"buf",
".",
"Len",
"(",
")",
"\n",
"b",
".",
"stack",
".",
"Push",
"(",
"pos",
")",
"\n",
"stackLen",
":=",
"b",
".",
"stack",
"."... | // addCompoundValue adds the start of a component value to the stream & stack. | [
"addCompoundValue",
"adds",
"the",
"start",
"of",
"a",
"component",
"value",
"to",
"the",
"stream",
"&",
"stack",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L670-L682 |
144,751 | arangodb/go-velocypack | builder.go | checkAttributeUniqueness | func (b *Builder) checkAttributeUniqueness(obj Slice) error {
vpackAssert(b.BuilderOptions.CheckAttributeUniqueness)
n, err := obj.Length()
if err != nil {
return WithStack(err)
}
if obj.IsSorted() {
// object attributes are sorted
previous, err := obj.KeyAt(0)
if err != nil {
return WithStack(err)
}... | go | func (b *Builder) checkAttributeUniqueness(obj Slice) error {
vpackAssert(b.BuilderOptions.CheckAttributeUniqueness)
n, err := obj.Length()
if err != nil {
return WithStack(err)
}
if obj.IsSorted() {
// object attributes are sorted
previous, err := obj.KeyAt(0)
if err != nil {
return WithStack(err)
}... | [
"func",
"(",
"b",
"*",
"Builder",
")",
"checkAttributeUniqueness",
"(",
"obj",
"Slice",
")",
"error",
"{",
"vpackAssert",
"(",
"b",
".",
"BuilderOptions",
".",
"CheckAttributeUniqueness",
")",
"\n",
"n",
",",
"err",
":=",
"obj",
".",
"Length",
"(",
")",
... | // checkAttributeUniqueness checks the given slice for duplicate keys.
// It returns an error when duplicate keys are found, nil otherwise. | [
"checkAttributeUniqueness",
"checks",
"the",
"given",
"slice",
"for",
"duplicate",
"keys",
".",
"It",
"returns",
"an",
"error",
"when",
"duplicate",
"keys",
"are",
"found",
"nil",
"otherwise",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/builder.go#L750-L812 |
144,752 | arangodb/go-velocypack | dumper.go | NewDumper | func NewDumper(w io.Writer, options *DumperOptions) *Dumper {
d := &Dumper{
w: w,
}
if options != nil {
d.options = *options
}
return d
} | go | func NewDumper(w io.Writer, options *DumperOptions) *Dumper {
d := &Dumper{
w: w,
}
if options != nil {
d.options = *options
}
return d
} | [
"func",
"NewDumper",
"(",
"w",
"io",
".",
"Writer",
",",
"options",
"*",
"DumperOptions",
")",
"*",
"Dumper",
"{",
"d",
":=",
"&",
"Dumper",
"{",
"w",
":",
"w",
",",
"}",
"\n",
"if",
"options",
"!=",
"nil",
"{",
"d",
".",
"options",
"=",
"*",
"... | // NewDumper creates a new dumper around the given writer, with an optional options. | [
"NewDumper",
"creates",
"a",
"new",
"dumper",
"around",
"the",
"given",
"writer",
"with",
"an",
"optional",
"options",
"."
] | 7896a965b4adc3bcc556b17d494537e30b4c1bd7 | https://github.com/arangodb/go-velocypack/blob/7896a965b4adc3bcc556b17d494537e30b4c1bd7/dumper.go#L54-L62 |
144,753 | aclindsa/ofxgo | constants.go | NewOfxVersion | func NewOfxVersion(s string) (ofxVersion, error) {
var e ofxVersion
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewOfxVersion(s string) (ofxVersion, error) {
var e ofxVersion
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewOfxVersion",
"(",
"s",
"string",
")",
"(",
"ofxVersion",
",",
"error",
")",
"{",
"var",
"e",
"ofxVersion",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
... | // NewOfxVersion returns returns an 'enum' value of type ofxVersion given its
// string representation | [
"NewOfxVersion",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"ofxVersion",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L81-L88 |
144,754 | aclindsa/ofxgo | constants.go | NewAcctType | func NewAcctType(s string) (acctType, error) {
var e acctType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewAcctType(s string) (acctType, error) {
var e acctType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewAcctType",
"(",
"s",
"string",
")",
"(",
"acctType",
",",
"error",
")",
"{",
"var",
"e",
"acctType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
... | // NewAcctType returns returns an 'enum' value of type acctType given its
// string representation | [
"NewAcctType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"acctType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L149-L156 |
144,755 | aclindsa/ofxgo | constants.go | NewTrnType | func NewTrnType(s string) (trnType, error) {
var e trnType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewTrnType(s string) (trnType, error) {
var e trnType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewTrnType",
"(",
"s",
"string",
")",
"(",
"trnType",
",",
"error",
")",
"{",
"var",
"e",
"trnType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"... | // NewTrnType returns returns an 'enum' value of type trnType given its
// string representation | [
"NewTrnType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"trnType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L230-L237 |
144,756 | aclindsa/ofxgo | constants.go | NewImageType | func NewImageType(s string) (imageType, error) {
var e imageType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewImageType(s string) (imageType, error) {
var e imageType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewImageType",
"(",
"s",
"string",
")",
"(",
"imageType",
",",
"error",
")",
"{",
"var",
"e",
"imageType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}... | // NewImageType returns returns an 'enum' value of type imageType given its
// string representation | [
"NewImageType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"imageType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L296-L303 |
144,757 | aclindsa/ofxgo | constants.go | NewImageRefType | func NewImageRefType(s string) (imageRefType, error) {
var e imageRefType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewImageRefType(s string) (imageRefType, error) {
var e imageRefType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewImageRefType",
"(",
"s",
"string",
")",
"(",
"imageRefType",
",",
"error",
")",
"{",
"var",
"e",
"imageRefType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"... | // NewImageRefType returns returns an 'enum' value of type imageRefType given its
// string representation | [
"NewImageRefType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"imageRefType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L362-L369 |
144,758 | aclindsa/ofxgo | constants.go | NewCheckSup | func NewCheckSup(s string) (checkSup, error) {
var e checkSup
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewCheckSup(s string) (checkSup, error) {
var e checkSup
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewCheckSup",
"(",
"s",
"string",
")",
"(",
"checkSup",
",",
"error",
")",
"{",
"var",
"e",
"checkSup",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
... | // NewCheckSup returns returns an 'enum' value of type checkSup given its
// string representation | [
"NewCheckSup",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"checkSup",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L428-L435 |
144,759 | aclindsa/ofxgo | constants.go | NewCorrectAction | func NewCorrectAction(s string) (correctAction, error) {
var e correctAction
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewCorrectAction(s string) (correctAction, error) {
var e correctAction
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewCorrectAction",
"(",
"s",
"string",
")",
"(",
"correctAction",
",",
"error",
")",
"{",
"var",
"e",
"correctAction",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
... | // NewCorrectAction returns returns an 'enum' value of type correctAction given its
// string representation | [
"NewCorrectAction",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"correctAction",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L493-L500 |
144,760 | aclindsa/ofxgo | constants.go | NewBalType | func NewBalType(s string) (balType, error) {
var e balType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewBalType(s string) (balType, error) {
var e balType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewBalType",
"(",
"s",
"string",
")",
"(",
"balType",
",",
"error",
")",
"{",
"var",
"e",
"balType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"... | // NewBalType returns returns an 'enum' value of type balType given its
// string representation | [
"NewBalType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"balType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L559-L566 |
144,761 | aclindsa/ofxgo | constants.go | NewInv401kSource | func NewInv401kSource(s string) (inv401kSource, error) {
var e inv401kSource
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewInv401kSource(s string) (inv401kSource, error) {
var e inv401kSource
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewInv401kSource",
"(",
"s",
"string",
")",
"(",
"inv401kSource",
",",
"error",
")",
"{",
"var",
"e",
"inv401kSource",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
... | // NewInv401kSource returns returns an 'enum' value of type inv401kSource given its
// string representation | [
"NewInv401kSource",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"inv401kSource",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L629-L636 |
144,762 | aclindsa/ofxgo | constants.go | NewSubAcctType | func NewSubAcctType(s string) (subAcctType, error) {
var e subAcctType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewSubAcctType(s string) (subAcctType, error) {
var e subAcctType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewSubAcctType",
"(",
"s",
"string",
")",
"(",
"subAcctType",
",",
"error",
")",
"{",
"var",
"e",
"subAcctType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n"... | // NewSubAcctType returns returns an 'enum' value of type subAcctType given its
// string representation | [
"NewSubAcctType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"subAcctType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L696-L703 |
144,763 | aclindsa/ofxgo | constants.go | NewBuyType | func NewBuyType(s string) (buyType, error) {
var e buyType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewBuyType(s string) (buyType, error) {
var e buyType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewBuyType",
"(",
"s",
"string",
")",
"(",
"buyType",
",",
"error",
")",
"{",
"var",
"e",
"buyType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"... | // NewBuyType returns returns an 'enum' value of type buyType given its
// string representation | [
"NewBuyType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"buyType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L761-L768 |
144,764 | aclindsa/ofxgo | constants.go | NewOptAction | func NewOptAction(s string) (optAction, error) {
var e optAction
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewOptAction(s string) (optAction, error) {
var e optAction
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewOptAction",
"(",
"s",
"string",
")",
"(",
"optAction",
",",
"error",
")",
"{",
"var",
"e",
"optAction",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}... | // NewOptAction returns returns an 'enum' value of type optAction given its
// string representation | [
"NewOptAction",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"optAction",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L827-L834 |
144,765 | aclindsa/ofxgo | constants.go | NewTferAction | func NewTferAction(s string) (tferAction, error) {
var e tferAction
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewTferAction(s string) (tferAction, error) {
var e tferAction
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewTferAction",
"(",
"s",
"string",
")",
"(",
"tferAction",
",",
"error",
")",
"{",
"var",
"e",
"tferAction",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
... | // NewTferAction returns returns an 'enum' value of type tferAction given its
// string representation | [
"NewTferAction",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"tferAction",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L892-L899 |
144,766 | aclindsa/ofxgo | constants.go | NewPosType | func NewPosType(s string) (posType, error) {
var e posType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewPosType(s string) (posType, error) {
var e posType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewPosType",
"(",
"s",
"string",
")",
"(",
"posType",
",",
"error",
")",
"{",
"var",
"e",
"posType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"... | // NewPosType returns returns an 'enum' value of type posType given its
// string representation | [
"NewPosType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"posType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L957-L964 |
144,767 | aclindsa/ofxgo | constants.go | NewSecured | func NewSecured(s string) (secured, error) {
var e secured
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewSecured(s string) (secured, error) {
var e secured
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewSecured",
"(",
"s",
"string",
")",
"(",
"secured",
",",
"error",
")",
"{",
"var",
"e",
"secured",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"... | // NewSecured returns returns an 'enum' value of type secured given its
// string representation | [
"NewSecured",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"secured",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L1022-L1029 |
144,768 | aclindsa/ofxgo | constants.go | NewDuration | func NewDuration(s string) (duration, error) {
var e duration
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewDuration(s string) (duration, error) {
var e duration
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewDuration",
"(",
"s",
"string",
")",
"(",
"duration",
",",
"error",
")",
"{",
"var",
"e",
"duration",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
... | // NewDuration returns returns an 'enum' value of type duration given its
// string representation | [
"NewDuration",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"duration",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L1088-L1095 |
144,769 | aclindsa/ofxgo | constants.go | NewRestriction | func NewRestriction(s string) (restriction, error) {
var e restriction
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewRestriction(s string) (restriction, error) {
var e restriction
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewRestriction",
"(",
"s",
"string",
")",
"(",
"restriction",
",",
"error",
")",
"{",
"var",
"e",
"restriction",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n"... | // NewRestriction returns returns an 'enum' value of type restriction given its
// string representation | [
"NewRestriction",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"restriction",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L1154-L1161 |
144,770 | aclindsa/ofxgo | constants.go | NewUnitType | func NewUnitType(s string) (unitType, error) {
var e unitType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewUnitType(s string) (unitType, error) {
var e unitType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewUnitType",
"(",
"s",
"string",
")",
"(",
"unitType",
",",
"error",
")",
"{",
"var",
"e",
"unitType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
... | // NewUnitType returns returns an 'enum' value of type unitType given its
// string representation | [
"NewUnitType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"unitType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L1219-L1226 |
144,771 | aclindsa/ofxgo | constants.go | NewOptBuyType | func NewOptBuyType(s string) (optBuyType, error) {
var e optBuyType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewOptBuyType(s string) (optBuyType, error) {
var e optBuyType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewOptBuyType",
"(",
"s",
"string",
")",
"(",
"optBuyType",
",",
"error",
")",
"{",
"var",
"e",
"optBuyType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
... | // NewOptBuyType returns returns an 'enum' value of type optBuyType given its
// string representation | [
"NewOptBuyType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"optBuyType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L1284-L1291 |
144,772 | aclindsa/ofxgo | constants.go | NewSellType | func NewSellType(s string) (sellType, error) {
var e sellType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewSellType(s string) (sellType, error) {
var e sellType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewSellType",
"(",
"s",
"string",
")",
"(",
"sellType",
",",
"error",
")",
"{",
"var",
"e",
"sellType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
... | // NewSellType returns returns an 'enum' value of type sellType given its
// string representation | [
"NewSellType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"sellType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L1349-L1356 |
144,773 | aclindsa/ofxgo | constants.go | NewLoanPmtFreq | func NewLoanPmtFreq(s string) (loanPmtFreq, error) {
var e loanPmtFreq
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewLoanPmtFreq(s string) (loanPmtFreq, error) {
var e loanPmtFreq
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewLoanPmtFreq",
"(",
"s",
"string",
")",
"(",
"loanPmtFreq",
",",
"error",
")",
"{",
"var",
"e",
"loanPmtFreq",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n"... | // NewLoanPmtFreq returns returns an 'enum' value of type loanPmtFreq given its
// string representation | [
"NewLoanPmtFreq",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"loanPmtFreq",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L1422-L1429 |
144,774 | aclindsa/ofxgo | constants.go | NewIncomeType | func NewIncomeType(s string) (incomeType, error) {
var e incomeType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewIncomeType(s string) (incomeType, error) {
var e incomeType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewIncomeType",
"(",
"s",
"string",
")",
"(",
"incomeType",
",",
"error",
")",
"{",
"var",
"e",
"incomeType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
... | // NewIncomeType returns returns an 'enum' value of type incomeType given its
// string representation | [
"NewIncomeType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"incomeType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L1490-L1497 |
144,775 | aclindsa/ofxgo | constants.go | NewSellReason | func NewSellReason(s string) (sellReason, error) {
var e sellReason
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewSellReason(s string) (sellReason, error) {
var e sellReason
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewSellReason",
"(",
"s",
"string",
")",
"(",
"sellReason",
",",
"error",
")",
"{",
"var",
"e",
"sellReason",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
... | // NewSellReason returns returns an 'enum' value of type sellReason given its
// string representation | [
"NewSellReason",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"sellReason",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L1556-L1563 |
144,776 | aclindsa/ofxgo | constants.go | NewOptSellType | func NewOptSellType(s string) (optSellType, error) {
var e optSellType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewOptSellType(s string) (optSellType, error) {
var e optSellType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewOptSellType",
"(",
"s",
"string",
")",
"(",
"optSellType",
",",
"error",
")",
"{",
"var",
"e",
"optSellType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n"... | // NewOptSellType returns returns an 'enum' value of type optSellType given its
// string representation | [
"NewOptSellType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"optSellType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L1621-L1628 |
144,777 | aclindsa/ofxgo | constants.go | NewRelType | func NewRelType(s string) (relType, error) {
var e relType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewRelType(s string) (relType, error) {
var e relType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewRelType",
"(",
"s",
"string",
")",
"(",
"relType",
",",
"error",
")",
"{",
"var",
"e",
"relType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"... | // NewRelType returns returns an 'enum' value of type relType given its
// string representation | [
"NewRelType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"relType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L1688-L1695 |
144,778 | aclindsa/ofxgo | constants.go | NewCharType | func NewCharType(s string) (charType, error) {
var e charType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewCharType(s string) (charType, error) {
var e charType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewCharType",
"(",
"s",
"string",
")",
"(",
"charType",
",",
"error",
")",
"{",
"var",
"e",
"charType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
... | // NewCharType returns returns an 'enum' value of type charType given its
// string representation | [
"NewCharType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"charType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L1755-L1762 |
144,779 | aclindsa/ofxgo | constants.go | NewSyncMode | func NewSyncMode(s string) (syncMode, error) {
var e syncMode
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewSyncMode(s string) (syncMode, error) {
var e syncMode
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewSyncMode",
"(",
"s",
"string",
")",
"(",
"syncMode",
",",
"error",
")",
"{",
"var",
"e",
"syncMode",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
... | // NewSyncMode returns returns an 'enum' value of type syncMode given its
// string representation | [
"NewSyncMode",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"syncMode",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L1820-L1827 |
144,780 | aclindsa/ofxgo | constants.go | NewOfxSec | func NewOfxSec(s string) (ofxSec, error) {
var e ofxSec
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewOfxSec(s string) (ofxSec, error) {
var e ofxSec
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewOfxSec",
"(",
"s",
"string",
")",
"(",
"ofxSec",
",",
"error",
")",
"{",
"var",
"e",
"ofxSec",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n"... | // NewOfxSec returns returns an 'enum' value of type ofxSec given its
// string representation | [
"NewOfxSec",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"ofxSec",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L1885-L1892 |
144,781 | aclindsa/ofxgo | constants.go | NewDebtType | func NewDebtType(s string) (debtType, error) {
var e debtType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewDebtType(s string) (debtType, error) {
var e debtType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewDebtType",
"(",
"s",
"string",
")",
"(",
"debtType",
",",
"error",
")",
"{",
"var",
"e",
"debtType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
... | // NewDebtType returns returns an 'enum' value of type debtType given its
// string representation | [
"NewDebtType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"debtType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L1950-L1957 |
144,782 | aclindsa/ofxgo | constants.go | NewDebtClass | func NewDebtClass(s string) (debtClass, error) {
var e debtClass
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewDebtClass(s string) (debtClass, error) {
var e debtClass
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewDebtClass",
"(",
"s",
"string",
")",
"(",
"debtClass",
",",
"error",
")",
"{",
"var",
"e",
"debtClass",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}... | // NewDebtClass returns returns an 'enum' value of type debtClass given its
// string representation | [
"NewDebtClass",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"debtClass",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L2017-L2024 |
144,783 | aclindsa/ofxgo | constants.go | NewCouponFreq | func NewCouponFreq(s string) (couponFreq, error) {
var e couponFreq
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewCouponFreq(s string) (couponFreq, error) {
var e couponFreq
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewCouponFreq",
"(",
"s",
"string",
")",
"(",
"couponFreq",
",",
"error",
")",
"{",
"var",
"e",
"couponFreq",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
... | // NewCouponFreq returns returns an 'enum' value of type couponFreq given its
// string representation | [
"NewCouponFreq",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"couponFreq",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L2085-L2092 |
144,784 | aclindsa/ofxgo | constants.go | NewCallType | func NewCallType(s string) (callType, error) {
var e callType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewCallType(s string) (callType, error) {
var e callType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewCallType",
"(",
"s",
"string",
")",
"(",
"callType",
",",
"error",
")",
"{",
"var",
"e",
"callType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
... | // NewCallType returns returns an 'enum' value of type callType given its
// string representation | [
"NewCallType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"callType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L2152-L2159 |
144,785 | aclindsa/ofxgo | constants.go | NewAssetClass | func NewAssetClass(s string) (assetClass, error) {
var e assetClass
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewAssetClass(s string) (assetClass, error) {
var e assetClass
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewAssetClass",
"(",
"s",
"string",
")",
"(",
"assetClass",
",",
"error",
")",
"{",
"var",
"e",
"assetClass",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
... | // NewAssetClass returns returns an 'enum' value of type assetClass given its
// string representation | [
"NewAssetClass",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"assetClass",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L2222-L2229 |
144,786 | aclindsa/ofxgo | constants.go | NewMfType | func NewMfType(s string) (mfType, error) {
var e mfType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewMfType(s string) (mfType, error) {
var e mfType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewMfType",
"(",
"s",
"string",
")",
"(",
"mfType",
",",
"error",
")",
"{",
"var",
"e",
"mfType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n"... | // NewMfType returns returns an 'enum' value of type mfType given its
// string representation | [
"NewMfType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"mfType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L2288-L2295 |
144,787 | aclindsa/ofxgo | constants.go | NewOptType | func NewOptType(s string) (optType, error) {
var e optType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewOptType(s string) (optType, error) {
var e optType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewOptType",
"(",
"s",
"string",
")",
"(",
"optType",
",",
"error",
")",
"{",
"var",
"e",
"optType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"... | // NewOptType returns returns an 'enum' value of type optType given its
// string representation | [
"NewOptType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"optType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L2353-L2360 |
144,788 | aclindsa/ofxgo | constants.go | NewStockType | func NewStockType(s string) (stockType, error) {
var e stockType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewStockType(s string) (stockType, error) {
var e stockType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewStockType",
"(",
"s",
"string",
")",
"(",
"stockType",
",",
"error",
")",
"{",
"var",
"e",
"stockType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}... | // NewStockType returns returns an 'enum' value of type stockType given its
// string representation | [
"NewStockType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"stockType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L2420-L2427 |
144,789 | aclindsa/ofxgo | constants.go | NewHolderType | func NewHolderType(s string) (holderType, error) {
var e holderType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewHolderType(s string) (holderType, error) {
var e holderType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewHolderType",
"(",
"s",
"string",
")",
"(",
"holderType",
",",
"error",
")",
"{",
"var",
"e",
"holderType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
... | // NewHolderType returns returns an 'enum' value of type holderType given its
// string representation | [
"NewHolderType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"holderType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L2488-L2495 |
144,790 | aclindsa/ofxgo | constants.go | NewAcctClassification | func NewAcctClassification(s string) (acctClassification, error) {
var e acctClassification
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewAcctClassification(s string) (acctClassification, error) {
var e acctClassification
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewAcctClassification",
"(",
"s",
"string",
")",
"(",
"acctClassification",
",",
"error",
")",
"{",
"var",
"e",
"acctClassification",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
... | // NewAcctClassification returns returns an 'enum' value of type acctClassification given its
// string representation | [
"NewAcctClassification",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"acctClassification",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L2555-L2562 |
144,791 | aclindsa/ofxgo | constants.go | NewSvcStatus | func NewSvcStatus(s string) (svcStatus, error) {
var e svcStatus
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewSvcStatus(s string) (svcStatus, error) {
var e svcStatus
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewSvcStatus",
"(",
"s",
"string",
")",
"(",
"svcStatus",
",",
"error",
")",
"{",
"var",
"e",
"svcStatus",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}... | // NewSvcStatus returns returns an 'enum' value of type svcStatus given its
// string representation | [
"NewSvcStatus",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"svcStatus",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L2621-L2628 |
144,792 | aclindsa/ofxgo | constants.go | NewUsProductType | func NewUsProductType(s string) (usProductType, error) {
var e usProductType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | go | func NewUsProductType(s string) (usProductType, error) {
var e usProductType
err := e.FromString(s)
if err != nil {
return 0, err
}
return e, nil
} | [
"func",
"NewUsProductType",
"(",
"s",
"string",
")",
"(",
"usProductType",
",",
"error",
")",
"{",
"var",
"e",
"usProductType",
"\n",
"err",
":=",
"e",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
... | // NewUsProductType returns returns an 'enum' value of type usProductType given its
// string representation | [
"NewUsProductType",
"returns",
"returns",
"an",
"enum",
"value",
"of",
"type",
"usProductType",
"given",
"its",
"string",
"representation"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/constants.go#L2695-L2702 |
144,793 | aclindsa/ofxgo | client.go | GetClient | func GetClient(URL string, bc *BasicClient) Client {
clients := []struct {
URL string
Func clientCreationFunc
}{
{"https://ofx.discovercard.com", NewDiscoverCardClient},
{"https://vesnc.vanguard.com/us/OfxDirectConnectServlet", NewVanguardClient},
}
for _, client := range clients {
if client.URL == strin... | go | func GetClient(URL string, bc *BasicClient) Client {
clients := []struct {
URL string
Func clientCreationFunc
}{
{"https://ofx.discovercard.com", NewDiscoverCardClient},
{"https://vesnc.vanguard.com/us/OfxDirectConnectServlet", NewVanguardClient},
}
for _, client := range clients {
if client.URL == strin... | [
"func",
"GetClient",
"(",
"URL",
"string",
",",
"bc",
"*",
"BasicClient",
")",
"Client",
"{",
"clients",
":=",
"[",
"]",
"struct",
"{",
"URL",
"string",
"\n",
"Func",
"clientCreationFunc",
"\n",
"}",
"{",
"{",
"\"",
"\"",
",",
"NewDiscoverCardClient",
"}... | // GetClient returns a new Client for a given URL. It attempts to find a
// specialized client for this URL, but simply returns the passed-in
// BasicClient if no such match is found. | [
"GetClient",
"returns",
"a",
"new",
"Client",
"for",
"a",
"given",
"URL",
".",
"It",
"attempts",
"to",
"find",
"a",
"specialized",
"client",
"for",
"this",
"URL",
"but",
"simply",
"returns",
"the",
"passed",
"-",
"in",
"BasicClient",
"if",
"no",
"such",
... | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/client.go#L61-L75 |
144,794 | aclindsa/ofxgo | client.go | clientRequestNoParse | func clientRequestNoParse(c Client, r *Request) (*http.Response, error) {
r.SetClientFields(c)
b, err := r.Marshal()
if err != nil {
return nil, err
}
return c.RawRequest(r.URL, b)
} | go | func clientRequestNoParse(c Client, r *Request) (*http.Response, error) {
r.SetClientFields(c)
b, err := r.Marshal()
if err != nil {
return nil, err
}
return c.RawRequest(r.URL, b)
} | [
"func",
"clientRequestNoParse",
"(",
"c",
"Client",
",",
"r",
"*",
"Request",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"r",
".",
"SetClientFields",
"(",
"c",
")",
"\n\n",
"b",
",",
"err",
":=",
"r",
".",
"Marshal",
"(",
")",
... | // clientRequestNoParse can be used for building clients' RequestNoParse
// methods if they require fairly standard behavior | [
"clientRequestNoParse",
"can",
"be",
"used",
"for",
"building",
"clients",
"RequestNoParse",
"methods",
"if",
"they",
"require",
"fairly",
"standard",
"behavior"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/client.go#L79-L88 |
144,795 | aclindsa/ofxgo | client.go | clientRequest | func clientRequest(c Client, r *Request) (*Response, error) {
response, err := c.RequestNoParse(r)
if err != nil {
return nil, err
}
defer response.Body.Close()
ofxresp, err := ParseResponse(response.Body)
if err != nil {
return nil, err
}
return ofxresp, nil
} | go | func clientRequest(c Client, r *Request) (*Response, error) {
response, err := c.RequestNoParse(r)
if err != nil {
return nil, err
}
defer response.Body.Close()
ofxresp, err := ParseResponse(response.Body)
if err != nil {
return nil, err
}
return ofxresp, nil
} | [
"func",
"clientRequest",
"(",
"c",
"Client",
",",
"r",
"*",
"Request",
")",
"(",
"*",
"Response",
",",
"error",
")",
"{",
"response",
",",
"err",
":=",
"c",
".",
"RequestNoParse",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",... | // clientRequest can be used for building clients' Request methods if they
// require fairly standard behavior | [
"clientRequest",
"can",
"be",
"used",
"for",
"building",
"clients",
"Request",
"methods",
"if",
"they",
"require",
"fairly",
"standard",
"behavior"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/client.go#L92-L104 |
144,796 | aclindsa/ofxgo | basic_client.go | OfxVersion | func (c *BasicClient) OfxVersion() ofxVersion {
if c.SpecVersion.Valid() {
return c.SpecVersion
}
return OfxVersion203
} | go | func (c *BasicClient) OfxVersion() ofxVersion {
if c.SpecVersion.Valid() {
return c.SpecVersion
}
return OfxVersion203
} | [
"func",
"(",
"c",
"*",
"BasicClient",
")",
"OfxVersion",
"(",
")",
"ofxVersion",
"{",
"if",
"c",
".",
"SpecVersion",
".",
"Valid",
"(",
")",
"{",
"return",
"c",
".",
"SpecVersion",
"\n",
"}",
"\n",
"return",
"OfxVersion203",
"\n",
"}"
] | // OfxVersion returns the OFX specification version this BasicClient will marshal
// Requests as. Defaults to "203" if the client's SpecVersion field is empty. | [
"OfxVersion",
"returns",
"the",
"OFX",
"specification",
"version",
"this",
"BasicClient",
"will",
"marshal",
"Requests",
"as",
".",
"Defaults",
"to",
"203",
"if",
"the",
"client",
"s",
"SpecVersion",
"field",
"is",
"empty",
"."
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/basic_client.go#L26-L31 |
144,797 | aclindsa/ofxgo | basic_client.go | ID | func (c *BasicClient) ID() String {
if len(c.AppID) > 0 {
return String(c.AppID)
}
return String("OFXGO")
} | go | func (c *BasicClient) ID() String {
if len(c.AppID) > 0 {
return String(c.AppID)
}
return String("OFXGO")
} | [
"func",
"(",
"c",
"*",
"BasicClient",
")",
"ID",
"(",
")",
"String",
"{",
"if",
"len",
"(",
"c",
".",
"AppID",
")",
">",
"0",
"{",
"return",
"String",
"(",
"c",
".",
"AppID",
")",
"\n",
"}",
"\n",
"return",
"String",
"(",
"\"",
"\"",
")",
"\n... | // ID returns this BasicClient's OFX AppID field, defaulting to "OFXGO" if
// unspecified. | [
"ID",
"returns",
"this",
"BasicClient",
"s",
"OFX",
"AppID",
"field",
"defaulting",
"to",
"OFXGO",
"if",
"unspecified",
"."
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/basic_client.go#L35-L40 |
144,798 | aclindsa/ofxgo | basic_client.go | Version | func (c *BasicClient) Version() String {
if len(c.AppVer) > 0 {
return String(c.AppVer)
}
return String("0001")
} | go | func (c *BasicClient) Version() String {
if len(c.AppVer) > 0 {
return String(c.AppVer)
}
return String("0001")
} | [
"func",
"(",
"c",
"*",
"BasicClient",
")",
"Version",
"(",
")",
"String",
"{",
"if",
"len",
"(",
"c",
".",
"AppVer",
")",
">",
"0",
"{",
"return",
"String",
"(",
"c",
".",
"AppVer",
")",
"\n",
"}",
"\n",
"return",
"String",
"(",
"\"",
"\"",
")"... | // Version returns this BasicClient's version number as a string, defaulting to
// "0001" if unspecified. | [
"Version",
"returns",
"this",
"BasicClient",
"s",
"version",
"number",
"as",
"a",
"string",
"defaulting",
"to",
"0001",
"if",
"unspecified",
"."
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/basic_client.go#L44-L49 |
144,799 | aclindsa/ofxgo | invstmt.go | UnmarshalXML | func (p *PositionList) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
for {
tok, err := nextNonWhitespaceToken(d)
if err != nil {
return err
} else if end, ok := tok.(xml.EndElement); ok && end.Name.Local == start.Name.Local {
// If we found the end of our starting element, we're done parsing... | go | func (p *PositionList) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
for {
tok, err := nextNonWhitespaceToken(d)
if err != nil {
return err
} else if end, ok := tok.(xml.EndElement); ok && end.Name.Local == start.Name.Local {
// If we found the end of our starting element, we're done parsing... | [
"func",
"(",
"p",
"*",
"PositionList",
")",
"UnmarshalXML",
"(",
"d",
"*",
"xml",
".",
"Decoder",
",",
"start",
"xml",
".",
"StartElement",
")",
"error",
"{",
"for",
"{",
"tok",
",",
"err",
":=",
"nextNonWhitespaceToken",
"(",
"d",
")",
"\n",
"if",
"... | // UnmarshalXML handles unmarshalling a PositionList from an XML string | [
"UnmarshalXML",
"handles",
"unmarshalling",
"a",
"PositionList",
"from",
"an",
"XML",
"string"
] | f41286cac7db7d418bb483e19a58de0aae9be786 | https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/invstmt.go#L838-L885 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.