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
partition
stringclasses
1 value
francoispqt/gojay
decode_stream.go
Err
func (dec *StreamDecoder) Err() error { select { case <-dec.done: dec.mux.RLock() defer dec.mux.RUnlock() return dec.err default: return nil } }
go
func (dec *StreamDecoder) Err() error { select { case <-dec.done: dec.mux.RLock() defer dec.mux.RUnlock() return dec.err default: return nil } }
[ "func", "(", "dec", "*", "StreamDecoder", ")", "Err", "(", ")", "error", "{", "select", "{", "case", "<-", "dec", ".", "done", ":", "dec", ".", "mux", ".", "RLock", "(", ")", "\n", "defer", "dec", ".", "mux", ".", "RUnlock", "(", ")", "\n", "return", "dec", ".", "err", "\n", "default", ":", "return", "nil", "\n", "}", "\n", "}" ]
// Err returns nil if Done is not yet closed. // If Done is closed, Err returns a non-nil error explaining why. // It implements context.Context
[ "Err", "returns", "nil", "if", "Done", "is", "not", "yet", "closed", ".", "If", "Done", "is", "closed", "Err", "returns", "a", "non", "-", "nil", "error", "explaining", "why", ".", "It", "implements", "context", ".", "Context" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_stream.go#L101-L110
train
francoispqt/gojay
gojay/codegen/options.go
NewOptionsWithFlagSet
func NewOptionsWithFlagSet(set *flag.FlagSet) *Options { toolbox.Dump(set) var result = &Options{} result.Dest = set.Lookup(optionKeyDest).Value.String() result.Source = set.Lookup(optionKeySource).Value.String() result.PoolObjects = toolbox.AsBoolean(set.Lookup(optionKeyPoolObjects).Value.String()) result.TagName = set.Lookup(optionKeyTagName).Value.String() result.Types = strings.Split(set.Lookup(optionKeyTypes).Value.String(), ",") result.Pkg = set.Lookup(optionKeyPkg).Value.String() if result.Source == "" { result.Source = url.NewResource(".").ParsedURL.Path } return result }
go
func NewOptionsWithFlagSet(set *flag.FlagSet) *Options { toolbox.Dump(set) var result = &Options{} result.Dest = set.Lookup(optionKeyDest).Value.String() result.Source = set.Lookup(optionKeySource).Value.String() result.PoolObjects = toolbox.AsBoolean(set.Lookup(optionKeyPoolObjects).Value.String()) result.TagName = set.Lookup(optionKeyTagName).Value.String() result.Types = strings.Split(set.Lookup(optionKeyTypes).Value.String(), ",") result.Pkg = set.Lookup(optionKeyPkg).Value.String() if result.Source == "" { result.Source = url.NewResource(".").ParsedURL.Path } return result }
[ "func", "NewOptionsWithFlagSet", "(", "set", "*", "flag", ".", "FlagSet", ")", "*", "Options", "{", "toolbox", ".", "Dump", "(", "set", ")", "\n\n", "var", "result", "=", "&", "Options", "{", "}", "\n", "result", ".", "Dest", "=", "set", ".", "Lookup", "(", "optionKeyDest", ")", ".", "Value", ".", "String", "(", ")", "\n", "result", ".", "Source", "=", "set", ".", "Lookup", "(", "optionKeySource", ")", ".", "Value", ".", "String", "(", ")", "\n", "result", ".", "PoolObjects", "=", "toolbox", ".", "AsBoolean", "(", "set", ".", "Lookup", "(", "optionKeyPoolObjects", ")", ".", "Value", ".", "String", "(", ")", ")", "\n", "result", ".", "TagName", "=", "set", ".", "Lookup", "(", "optionKeyTagName", ")", ".", "Value", ".", "String", "(", ")", "\n", "result", ".", "Types", "=", "strings", ".", "Split", "(", "set", ".", "Lookup", "(", "optionKeyTypes", ")", ".", "Value", ".", "String", "(", ")", ",", "\"", "\"", ")", "\n", "result", ".", "Pkg", "=", "set", ".", "Lookup", "(", "optionKeyPkg", ")", ".", "Value", ".", "String", "(", ")", "\n", "if", "result", ".", "Source", "==", "\"", "\"", "{", "result", ".", "Source", "=", "url", ".", "NewResource", "(", "\"", "\"", ")", ".", "ParsedURL", ".", "Path", "\n", "}", "\n", "return", "result", "\n", "}" ]
//NewOptionsWithFlagSet creates a new options for the supplide flagset
[ "NewOptionsWithFlagSet", "creates", "a", "new", "options", "for", "the", "supplide", "flagset" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/gojay/codegen/options.go#L41-L55
train
francoispqt/gojay
decode.go
UnmarshalJSONArray
func UnmarshalJSONArray(data []byte, v UnmarshalerJSONArray) error { dec := borrowDecoder(nil, 0) defer dec.Release() dec.data = make([]byte, len(data)) copy(dec.data, data) dec.length = len(data) _, err := dec.decodeArray(v) if err != nil { return err } if dec.err != nil { return dec.err } return nil }
go
func UnmarshalJSONArray(data []byte, v UnmarshalerJSONArray) error { dec := borrowDecoder(nil, 0) defer dec.Release() dec.data = make([]byte, len(data)) copy(dec.data, data) dec.length = len(data) _, err := dec.decodeArray(v) if err != nil { return err } if dec.err != nil { return dec.err } return nil }
[ "func", "UnmarshalJSONArray", "(", "data", "[", "]", "byte", ",", "v", "UnmarshalerJSONArray", ")", "error", "{", "dec", ":=", "borrowDecoder", "(", "nil", ",", "0", ")", "\n", "defer", "dec", ".", "Release", "(", ")", "\n", "dec", ".", "data", "=", "make", "(", "[", "]", "byte", ",", "len", "(", "data", ")", ")", "\n", "copy", "(", "dec", ".", "data", ",", "data", ")", "\n", "dec", ".", "length", "=", "len", "(", "data", ")", "\n", "_", ",", "err", ":=", "dec", ".", "decodeArray", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "dec", ".", "err", "!=", "nil", "{", "return", "dec", ".", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// UnmarshalJSONArray parses the JSON-encoded data and stores the result in the value pointed to by v. // // v must implement UnmarshalerJSONArray. // // If a JSON value is not appropriate for a given target type, or if a JSON number // overflows the target type, UnmarshalJSONArray skips that field and completes the unmarshaling as best it can.
[ "UnmarshalJSONArray", "parses", "the", "JSON", "-", "encoded", "data", "and", "stores", "the", "result", "in", "the", "value", "pointed", "to", "by", "v", ".", "v", "must", "implement", "UnmarshalerJSONArray", ".", "If", "a", "JSON", "value", "is", "not", "appropriate", "for", "a", "given", "target", "type", "or", "if", "a", "JSON", "number", "overflows", "the", "target", "type", "UnmarshalJSONArray", "skips", "that", "field", "and", "completes", "the", "unmarshaling", "as", "best", "it", "can", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode.go#L14-L28
train
francoispqt/gojay
decode.go
UnmarshalJSONObject
func UnmarshalJSONObject(data []byte, v UnmarshalerJSONObject) error { dec := borrowDecoder(nil, 0) defer dec.Release() dec.data = make([]byte, len(data)) copy(dec.data, data) dec.length = len(data) _, err := dec.decodeObject(v) if err != nil { return err } if dec.err != nil { return dec.err } return nil }
go
func UnmarshalJSONObject(data []byte, v UnmarshalerJSONObject) error { dec := borrowDecoder(nil, 0) defer dec.Release() dec.data = make([]byte, len(data)) copy(dec.data, data) dec.length = len(data) _, err := dec.decodeObject(v) if err != nil { return err } if dec.err != nil { return dec.err } return nil }
[ "func", "UnmarshalJSONObject", "(", "data", "[", "]", "byte", ",", "v", "UnmarshalerJSONObject", ")", "error", "{", "dec", ":=", "borrowDecoder", "(", "nil", ",", "0", ")", "\n", "defer", "dec", ".", "Release", "(", ")", "\n", "dec", ".", "data", "=", "make", "(", "[", "]", "byte", ",", "len", "(", "data", ")", ")", "\n", "copy", "(", "dec", ".", "data", ",", "data", ")", "\n", "dec", ".", "length", "=", "len", "(", "data", ")", "\n", "_", ",", "err", ":=", "dec", ".", "decodeObject", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "dec", ".", "err", "!=", "nil", "{", "return", "dec", ".", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// UnmarshalJSONObject parses the JSON-encoded data and stores the result in the value pointed to by v. // // v must implement UnmarshalerJSONObject. // // If a JSON value is not appropriate for a given target type, or if a JSON number // overflows the target type, UnmarshalJSONObject skips that field and completes the unmarshaling as best it can.
[ "UnmarshalJSONObject", "parses", "the", "JSON", "-", "encoded", "data", "and", "stores", "the", "result", "in", "the", "value", "pointed", "to", "by", "v", ".", "v", "must", "implement", "UnmarshalerJSONObject", ".", "If", "a", "JSON", "value", "is", "not", "appropriate", "for", "a", "given", "target", "type", "or", "if", "a", "JSON", "number", "overflows", "the", "target", "type", "UnmarshalJSONObject", "skips", "that", "field", "and", "completes", "the", "unmarshaling", "as", "best", "it", "can", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode.go#L36-L50
train
francoispqt/gojay
examples/websocket/main.go
main
func main() { done := make(chan error) createServer(done) // add our clients connection for i := 0; i < 100; i++ { i := i go createClient("ws://localhost:8070/ws", "http://localhost/", i) } // handle server's termination log.Fatal(<-done) }
go
func main() { done := make(chan error) createServer(done) // add our clients connection for i := 0; i < 100; i++ { i := i go createClient("ws://localhost:8070/ws", "http://localhost/", i) } // handle server's termination log.Fatal(<-done) }
[ "func", "main", "(", ")", "{", "done", ":=", "make", "(", "chan", "error", ")", "\n", "createServer", "(", "done", ")", "\n", "// add our clients connection", "for", "i", ":=", "0", ";", "i", "<", "100", ";", "i", "++", "{", "i", ":=", "i", "\n", "go", "createClient", "(", "\"", "\"", ",", "\"", "\"", ",", "i", ")", "\n", "}", "\n", "// handle server's termination", "log", ".", "Fatal", "(", "<-", "done", ")", "\n", "}" ]
// Our main function
[ "Our", "main", "function" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/examples/websocket/main.go#L65-L75
train
francoispqt/gojay
decode_object.go
UnmarshalJSONObject
func (f DecodeObjectFunc) UnmarshalJSONObject(dec *Decoder, k string) error { return f(dec, k) }
go
func (f DecodeObjectFunc) UnmarshalJSONObject(dec *Decoder, k string) error { return f(dec, k) }
[ "func", "(", "f", "DecodeObjectFunc", ")", "UnmarshalJSONObject", "(", "dec", "*", "Decoder", ",", "k", "string", ")", "error", "{", "return", "f", "(", "dec", ",", "k", ")", "\n", "}" ]
// UnmarshalJSONObject implements UnmarshalerJSONObject.
[ "UnmarshalJSONObject", "implements", "UnmarshalerJSONObject", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_object.go#L349-L351
train
francoispqt/gojay
decode_object.go
Object
func (dec *Decoder) Object(value UnmarshalerJSONObject) error { initialKeysDone := dec.keysDone initialChild := dec.child dec.keysDone = 0 dec.called = 0 dec.child |= 1 newCursor, err := dec.decodeObject(value) if err != nil { return err } dec.cursor = newCursor dec.keysDone = initialKeysDone dec.child = initialChild dec.called |= 1 return nil }
go
func (dec *Decoder) Object(value UnmarshalerJSONObject) error { initialKeysDone := dec.keysDone initialChild := dec.child dec.keysDone = 0 dec.called = 0 dec.child |= 1 newCursor, err := dec.decodeObject(value) if err != nil { return err } dec.cursor = newCursor dec.keysDone = initialKeysDone dec.child = initialChild dec.called |= 1 return nil }
[ "func", "(", "dec", "*", "Decoder", ")", "Object", "(", "value", "UnmarshalerJSONObject", ")", "error", "{", "initialKeysDone", ":=", "dec", ".", "keysDone", "\n", "initialChild", ":=", "dec", ".", "child", "\n", "dec", ".", "keysDone", "=", "0", "\n", "dec", ".", "called", "=", "0", "\n", "dec", ".", "child", "|=", "1", "\n", "newCursor", ",", "err", ":=", "dec", ".", "decodeObject", "(", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "dec", ".", "cursor", "=", "newCursor", "\n", "dec", ".", "keysDone", "=", "initialKeysDone", "\n", "dec", ".", "child", "=", "initialChild", "\n", "dec", ".", "called", "|=", "1", "\n", "return", "nil", "\n", "}" ]
// Object decodes the JSON value within an object or an array to a UnmarshalerJSONObject.
[ "Object", "decodes", "the", "JSON", "value", "within", "an", "object", "or", "an", "array", "to", "a", "UnmarshalerJSONObject", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_object.go#L371-L386
train
francoispqt/gojay
decode_object.go
ObjectNull
func (dec *Decoder) ObjectNull(v interface{}) error { initialKeysDone := dec.keysDone initialChild := dec.child dec.keysDone = 0 dec.called = 0 dec.child |= 1 newCursor, err := dec.decodeObjectNull(v) if err != nil { return err } dec.cursor = newCursor dec.keysDone = initialKeysDone dec.child = initialChild dec.called |= 1 return nil }
go
func (dec *Decoder) ObjectNull(v interface{}) error { initialKeysDone := dec.keysDone initialChild := dec.child dec.keysDone = 0 dec.called = 0 dec.child |= 1 newCursor, err := dec.decodeObjectNull(v) if err != nil { return err } dec.cursor = newCursor dec.keysDone = initialKeysDone dec.child = initialChild dec.called |= 1 return nil }
[ "func", "(", "dec", "*", "Decoder", ")", "ObjectNull", "(", "v", "interface", "{", "}", ")", "error", "{", "initialKeysDone", ":=", "dec", ".", "keysDone", "\n", "initialChild", ":=", "dec", ".", "child", "\n", "dec", ".", "keysDone", "=", "0", "\n", "dec", ".", "called", "=", "0", "\n", "dec", ".", "child", "|=", "1", "\n", "newCursor", ",", "err", ":=", "dec", ".", "decodeObjectNull", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "dec", ".", "cursor", "=", "newCursor", "\n", "dec", ".", "keysDone", "=", "initialKeysDone", "\n", "dec", ".", "child", "=", "initialChild", "\n", "dec", ".", "called", "|=", "1", "\n", "return", "nil", "\n", "}" ]
// ObjectNull decodes the JSON value within an object or an array to a UnmarshalerJSONObject. // v should be a pointer to an UnmarshalerJSONObject, // if `null` value is encountered in JSON, it will leave the value v untouched, // else it will create a new instance of the UnmarshalerJSONObject behind v.
[ "ObjectNull", "decodes", "the", "JSON", "value", "within", "an", "object", "or", "an", "array", "to", "a", "UnmarshalerJSONObject", ".", "v", "should", "be", "a", "pointer", "to", "an", "UnmarshalerJSONObject", "if", "null", "value", "is", "encountered", "in", "JSON", "it", "will", "leave", "the", "value", "v", "untouched", "else", "it", "will", "create", "a", "new", "instance", "of", "the", "UnmarshalerJSONObject", "behind", "v", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_object.go#L392-L407
train
francoispqt/gojay
decode_sqlnull.go
DecodeSQLNullString
func (dec *Decoder) DecodeSQLNullString(v *sql.NullString) error { if dec.isPooled == 1 { panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) } return dec.decodeSQLNullString(v) }
go
func (dec *Decoder) DecodeSQLNullString(v *sql.NullString) error { if dec.isPooled == 1 { panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) } return dec.decodeSQLNullString(v) }
[ "func", "(", "dec", "*", "Decoder", ")", "DecodeSQLNullString", "(", "v", "*", "sql", ".", "NullString", ")", "error", "{", "if", "dec", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledDecoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "return", "dec", ".", "decodeSQLNullString", "(", "v", ")", "\n", "}" ]
// DecodeSQLNullString decodes a sql.NullString
[ "DecodeSQLNullString", "decodes", "a", "sql", ".", "NullString" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_sqlnull.go#L6-L11
train
francoispqt/gojay
decode_sqlnull.go
DecodeSQLNullInt64
func (dec *Decoder) DecodeSQLNullInt64(v *sql.NullInt64) error { if dec.isPooled == 1 { panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) } return dec.decodeSQLNullInt64(v) }
go
func (dec *Decoder) DecodeSQLNullInt64(v *sql.NullInt64) error { if dec.isPooled == 1 { panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) } return dec.decodeSQLNullInt64(v) }
[ "func", "(", "dec", "*", "Decoder", ")", "DecodeSQLNullInt64", "(", "v", "*", "sql", ".", "NullInt64", ")", "error", "{", "if", "dec", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledDecoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "return", "dec", ".", "decodeSQLNullInt64", "(", "v", ")", "\n", "}" ]
// DecodeSQLNullInt64 decodes a sql.NullInt64
[ "DecodeSQLNullInt64", "decodes", "a", "sql", ".", "NullInt64" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_sqlnull.go#L24-L29
train
francoispqt/gojay
decode_sqlnull.go
DecodeSQLNullFloat64
func (dec *Decoder) DecodeSQLNullFloat64(v *sql.NullFloat64) error { if dec.isPooled == 1 { panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) } return dec.decodeSQLNullFloat64(v) }
go
func (dec *Decoder) DecodeSQLNullFloat64(v *sql.NullFloat64) error { if dec.isPooled == 1 { panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) } return dec.decodeSQLNullFloat64(v) }
[ "func", "(", "dec", "*", "Decoder", ")", "DecodeSQLNullFloat64", "(", "v", "*", "sql", ".", "NullFloat64", ")", "error", "{", "if", "dec", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledDecoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "return", "dec", ".", "decodeSQLNullFloat64", "(", "v", ")", "\n", "}" ]
// DecodeSQLNullFloat64 decodes a sql.NullString with the given format
[ "DecodeSQLNullFloat64", "decodes", "a", "sql", ".", "NullString", "with", "the", "given", "format" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_sqlnull.go#L42-L47
train
francoispqt/gojay
decode_sqlnull.go
DecodeSQLNullBool
func (dec *Decoder) DecodeSQLNullBool(v *sql.NullBool) error { if dec.isPooled == 1 { panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) } return dec.decodeSQLNullBool(v) }
go
func (dec *Decoder) DecodeSQLNullBool(v *sql.NullBool) error { if dec.isPooled == 1 { panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) } return dec.decodeSQLNullBool(v) }
[ "func", "(", "dec", "*", "Decoder", ")", "DecodeSQLNullBool", "(", "v", "*", "sql", ".", "NullBool", ")", "error", "{", "if", "dec", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledDecoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "return", "dec", ".", "decodeSQLNullBool", "(", "v", ")", "\n", "}" ]
// DecodeSQLNullBool decodes a sql.NullString with the given format
[ "DecodeSQLNullBool", "decodes", "a", "sql", ".", "NullString", "with", "the", "given", "format" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_sqlnull.go#L60-L65
train
francoispqt/gojay
encode_builder.go
writeByte
func (enc *Encoder) writeByte(c byte) { enc.buf = append(enc.buf, c) }
go
func (enc *Encoder) writeByte(c byte) { enc.buf = append(enc.buf, c) }
[ "func", "(", "enc", "*", "Encoder", ")", "writeByte", "(", "c", "byte", ")", "{", "enc", ".", "buf", "=", "append", "(", "enc", ".", "buf", ",", "c", ")", "\n", "}" ]
// WriteByte appends the byte c to b's Buffer. // The returned error is always nil.
[ "WriteByte", "appends", "the", "byte", "c", "to", "b", "s", "Buffer", ".", "The", "returned", "error", "is", "always", "nil", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_builder.go#L28-L30
train
francoispqt/gojay
encode_builder.go
writeString
func (enc *Encoder) writeString(s string) { enc.buf = append(enc.buf, s...) }
go
func (enc *Encoder) writeString(s string) { enc.buf = append(enc.buf, s...) }
[ "func", "(", "enc", "*", "Encoder", ")", "writeString", "(", "s", "string", ")", "{", "enc", ".", "buf", "=", "append", "(", "enc", ".", "buf", ",", "s", "...", ")", "\n", "}" ]
// WriteString appends the contents of s to b's Buffer. // It returns the length of s and a nil error.
[ "WriteString", "appends", "the", "contents", "of", "s", "to", "b", "s", "Buffer", ".", "It", "returns", "the", "length", "of", "s", "and", "a", "nil", "error", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_builder.go#L34-L36
train
francoispqt/gojay
encode.go
Write
func (enc *Encoder) Write() (int, error) { i, err := enc.w.Write(enc.buf) enc.buf = enc.buf[:0] return i, err }
go
func (enc *Encoder) Write() (int, error) { i, err := enc.w.Write(enc.buf) enc.buf = enc.buf[:0] return i, err }
[ "func", "(", "enc", "*", "Encoder", ")", "Write", "(", ")", "(", "int", ",", "error", ")", "{", "i", ",", "err", ":=", "enc", ".", "w", ".", "Write", "(", "enc", ".", "buf", ")", "\n", "enc", ".", "buf", "=", "enc", ".", "buf", "[", ":", "0", "]", "\n", "return", "i", ",", "err", "\n", "}" ]
// Write writes to the io.Writer and resets the buffer.
[ "Write", "writes", "to", "the", "io", ".", "Writer", "and", "resets", "the", "buffer", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode.go#L193-L197
train
francoispqt/gojay
decode_array.go
Array
func (dec *Decoder) Array(v UnmarshalerJSONArray) error { newCursor, err := dec.decodeArray(v) if err != nil { return err } dec.cursor = newCursor dec.called |= 1 return nil }
go
func (dec *Decoder) Array(v UnmarshalerJSONArray) error { newCursor, err := dec.decodeArray(v) if err != nil { return err } dec.cursor = newCursor dec.called |= 1 return nil }
[ "func", "(", "dec", "*", "Decoder", ")", "Array", "(", "v", "UnmarshalerJSONArray", ")", "error", "{", "newCursor", ",", "err", ":=", "dec", ".", "decodeArray", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "dec", ".", "cursor", "=", "newCursor", "\n", "dec", ".", "called", "|=", "1", "\n", "return", "nil", "\n", "}" ]
// Array decodes the JSON value within an object or an array to a UnmarshalerJSONArray.
[ "Array", "decodes", "the", "JSON", "value", "within", "an", "object", "or", "an", "array", "to", "a", "UnmarshalerJSONArray", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_array.go#L220-L228
train
francoispqt/gojay
decode_array.go
ArrayNull
func (dec *Decoder) ArrayNull(v interface{}) error { newCursor, err := dec.decodeArrayNull(v) if err != nil { return err } dec.cursor = newCursor dec.called |= 1 return nil }
go
func (dec *Decoder) ArrayNull(v interface{}) error { newCursor, err := dec.decodeArrayNull(v) if err != nil { return err } dec.cursor = newCursor dec.called |= 1 return nil }
[ "func", "(", "dec", "*", "Decoder", ")", "ArrayNull", "(", "v", "interface", "{", "}", ")", "error", "{", "newCursor", ",", "err", ":=", "dec", ".", "decodeArrayNull", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "dec", ".", "cursor", "=", "newCursor", "\n", "dec", ".", "called", "|=", "1", "\n", "return", "nil", "\n", "}" ]
// ArrayNull decodes the JSON value within an object or an array to a UnmarshalerJSONArray. // v should be a pointer to an UnmarshalerJSONArray, // if `null` value is encountered in JSON, it will leave the value v untouched, // else it will create a new instance of the UnmarshalerJSONArray behind v.
[ "ArrayNull", "decodes", "the", "JSON", "value", "within", "an", "object", "or", "an", "array", "to", "a", "UnmarshalerJSONArray", ".", "v", "should", "be", "a", "pointer", "to", "an", "UnmarshalerJSONArray", "if", "null", "value", "is", "encountered", "in", "JSON", "it", "will", "leave", "the", "value", "v", "untouched", "else", "it", "will", "create", "a", "new", "instance", "of", "the", "UnmarshalerJSONArray", "behind", "v", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_array.go#L234-L242
train
francoispqt/gojay
decode_time.go
DecodeTime
func (dec *Decoder) DecodeTime(v *time.Time, format string) error { if dec.isPooled == 1 { panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) } return dec.decodeTime(v, format) }
go
func (dec *Decoder) DecodeTime(v *time.Time, format string) error { if dec.isPooled == 1 { panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) } return dec.decodeTime(v, format) }
[ "func", "(", "dec", "*", "Decoder", ")", "DecodeTime", "(", "v", "*", "time", ".", "Time", ",", "format", "string", ")", "error", "{", "if", "dec", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledDecoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "return", "dec", ".", "decodeTime", "(", "v", ",", "format", ")", "\n", "}" ]
// DecodeTime decodes time with the given format
[ "DecodeTime", "decodes", "time", "with", "the", "given", "format" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_time.go#L8-L13
train
francoispqt/gojay
encode_number_float.go
EncodeFloat
func (enc *Encoder) EncodeFloat(n float64) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeFloat(n) _, err := enc.Write() if err != nil { return err } return nil }
go
func (enc *Encoder) EncodeFloat(n float64) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeFloat(n) _, err := enc.Write() if err != nil { return err } return nil }
[ "func", "(", "enc", "*", "Encoder", ")", "EncodeFloat", "(", "n", "float64", ")", "error", "{", "if", "enc", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledEncoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "_", ",", "_", "=", "enc", ".", "encodeFloat", "(", "n", ")", "\n", "_", ",", "err", ":=", "enc", ".", "Write", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// EncodeFloat encodes a float64 to JSON
[ "EncodeFloat", "encodes", "a", "float64", "to", "JSON" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L6-L16
train
francoispqt/gojay
encode_number_float.go
encodeFloat
func (enc *Encoder) encodeFloat(n float64) ([]byte, error) { enc.buf = strconv.AppendFloat(enc.buf, n, 'f', -1, 64) return enc.buf, nil }
go
func (enc *Encoder) encodeFloat(n float64) ([]byte, error) { enc.buf = strconv.AppendFloat(enc.buf, n, 'f', -1, 64) return enc.buf, nil }
[ "func", "(", "enc", "*", "Encoder", ")", "encodeFloat", "(", "n", "float64", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "enc", ".", "buf", "=", "strconv", ".", "AppendFloat", "(", "enc", ".", "buf", ",", "n", ",", "'f'", ",", "-", "1", ",", "64", ")", "\n", "return", "enc", ".", "buf", ",", "nil", "\n", "}" ]
// encodeFloat encodes a float64 to JSON
[ "encodeFloat", "encodes", "a", "float64", "to", "JSON" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L19-L22
train
francoispqt/gojay
encode_number_float.go
EncodeFloat32
func (enc *Encoder) EncodeFloat32(n float32) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeFloat32(n) _, err := enc.Write() if err != nil { return err } return nil }
go
func (enc *Encoder) EncodeFloat32(n float32) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeFloat32(n) _, err := enc.Write() if err != nil { return err } return nil }
[ "func", "(", "enc", "*", "Encoder", ")", "EncodeFloat32", "(", "n", "float32", ")", "error", "{", "if", "enc", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledEncoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "_", ",", "_", "=", "enc", ".", "encodeFloat32", "(", "n", ")", "\n", "_", ",", "err", ":=", "enc", ".", "Write", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// EncodeFloat32 encodes a float32 to JSON
[ "EncodeFloat32", "encodes", "a", "float32", "to", "JSON" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L25-L35
train
francoispqt/gojay
encode_number_float.go
AddFloatKey
func (enc *Encoder) AddFloatKey(key string, v float64) { enc.Float64Key(key, v) }
go
func (enc *Encoder) AddFloatKey(key string, v float64) { enc.Float64Key(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddFloatKey", "(", "key", "string", ",", "v", "float64", ")", "{", "enc", ".", "Float64Key", "(", "key", ",", "v", ")", "\n", "}" ]
// AddFloatKey adds a float64 to be encoded, must be used inside an object as it will encode a key
[ "AddFloatKey", "adds", "a", "float64", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L77-L79
train
francoispqt/gojay
encode_number_float.go
AddFloatKeyOmitEmpty
func (enc *Encoder) AddFloatKeyOmitEmpty(key string, v float64) { enc.Float64KeyOmitEmpty(key, v) }
go
func (enc *Encoder) AddFloatKeyOmitEmpty(key string, v float64) { enc.Float64KeyOmitEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddFloatKeyOmitEmpty", "(", "key", "string", ",", "v", "float64", ")", "{", "enc", ".", "Float64KeyOmitEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddFloatKeyOmitEmpty adds a float64 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key
[ "AddFloatKeyOmitEmpty", "adds", "a", "float64", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L83-L85
train
francoispqt/gojay
encode_number_float.go
AddFloatKeyNullEmpty
func (enc *Encoder) AddFloatKeyNullEmpty(key string, v float64) { enc.Float64KeyNullEmpty(key, v) }
go
func (enc *Encoder) AddFloatKeyNullEmpty(key string, v float64) { enc.Float64KeyNullEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddFloatKeyNullEmpty", "(", "key", "string", ",", "v", "float64", ")", "{", "enc", ".", "Float64KeyNullEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddFloatKeyNullEmpty adds a float64 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key
[ "AddFloatKeyNullEmpty", "adds", "a", "float64", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L89-L91
train
francoispqt/gojay
encode_number_float.go
FloatKey
func (enc *Encoder) FloatKey(key string, v float64) { enc.Float64Key(key, v) }
go
func (enc *Encoder) FloatKey(key string, v float64) { enc.Float64Key(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "FloatKey", "(", "key", "string", ",", "v", "float64", ")", "{", "enc", ".", "Float64Key", "(", "key", ",", "v", ")", "\n", "}" ]
// FloatKey adds a float64 to be encoded, must be used inside an object as it will encode a key
[ "FloatKey", "adds", "a", "float64", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L94-L96
train
francoispqt/gojay
encode_number_float.go
FloatKeyOmitEmpty
func (enc *Encoder) FloatKeyOmitEmpty(key string, v float64) { enc.Float64KeyOmitEmpty(key, v) }
go
func (enc *Encoder) FloatKeyOmitEmpty(key string, v float64) { enc.Float64KeyOmitEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "FloatKeyOmitEmpty", "(", "key", "string", ",", "v", "float64", ")", "{", "enc", ".", "Float64KeyOmitEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// FloatKeyOmitEmpty adds a float64 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key
[ "FloatKeyOmitEmpty", "adds", "a", "float64", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L100-L102
train
francoispqt/gojay
encode_number_float.go
FloatKeyNullEmpty
func (enc *Encoder) FloatKeyNullEmpty(key string, v float64) { enc.Float64KeyNullEmpty(key, v) }
go
func (enc *Encoder) FloatKeyNullEmpty(key string, v float64) { enc.Float64KeyNullEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "FloatKeyNullEmpty", "(", "key", "string", ",", "v", "float64", ")", "{", "enc", ".", "Float64KeyNullEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// FloatKeyNullEmpty adds a float64 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key
[ "FloatKeyNullEmpty", "adds", "a", "float64", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L106-L108
train
francoispqt/gojay
encode_number_float.go
AddFloat64Key
func (enc *Encoder) AddFloat64Key(key string, v float64) { enc.FloatKey(key, v) }
go
func (enc *Encoder) AddFloat64Key(key string, v float64) { enc.FloatKey(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddFloat64Key", "(", "key", "string", ",", "v", "float64", ")", "{", "enc", ".", "FloatKey", "(", "key", ",", "v", ")", "\n", "}" ]
// AddFloat64Key adds a float64 to be encoded, must be used inside an object as it will encode a key
[ "AddFloat64Key", "adds", "a", "float64", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L161-L163
train
francoispqt/gojay
encode_number_float.go
AddFloat64KeyOmitEmpty
func (enc *Encoder) AddFloat64KeyOmitEmpty(key string, v float64) { enc.FloatKeyOmitEmpty(key, v) }
go
func (enc *Encoder) AddFloat64KeyOmitEmpty(key string, v float64) { enc.FloatKeyOmitEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddFloat64KeyOmitEmpty", "(", "key", "string", ",", "v", "float64", ")", "{", "enc", ".", "FloatKeyOmitEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddFloat64KeyOmitEmpty adds a float64 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key
[ "AddFloat64KeyOmitEmpty", "adds", "a", "float64", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L167-L169
train
francoispqt/gojay
encode_number_float.go
Float64Key
func (enc *Encoder) Float64Key(key string, value float64) { if enc.hasKeys { if !enc.keyExists(key) { return } } r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.grow(10) enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKey) enc.buf = strconv.AppendFloat(enc.buf, value, 'f', -1, 64) }
go
func (enc *Encoder) Float64Key(key string, value float64) { if enc.hasKeys { if !enc.keyExists(key) { return } } r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.grow(10) enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKey) enc.buf = strconv.AppendFloat(enc.buf, value, 'f', -1, 64) }
[ "func", "(", "enc", "*", "Encoder", ")", "Float64Key", "(", "key", "string", ",", "value", "float64", ")", "{", "if", "enc", ".", "hasKeys", "{", "if", "!", "enc", ".", "keyExists", "(", "key", ")", "{", "return", "\n", "}", "\n", "}", "\n", "r", ":=", "enc", ".", "getPreviousRune", "(", ")", "\n", "if", "r", "!=", "'{'", "{", "enc", ".", "writeByte", "(", "','", ")", "\n", "}", "\n", "enc", ".", "grow", "(", "10", ")", "\n", "enc", ".", "writeByte", "(", "'\"'", ")", "\n", "enc", ".", "writeStringEscape", "(", "key", ")", "\n", "enc", ".", "writeBytes", "(", "objKey", ")", "\n", "enc", ".", "buf", "=", "strconv", ".", "AppendFloat", "(", "enc", ".", "buf", ",", "value", ",", "'f'", ",", "-", "1", ",", "64", ")", "\n", "}" ]
// Float64Key adds a float64 to be encoded, must be used inside an object as it will encode a key
[ "Float64Key", "adds", "a", "float64", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L172-L187
train
francoispqt/gojay
encode_number_float.go
Float64KeyOmitEmpty
func (enc *Encoder) Float64KeyOmitEmpty(key string, v float64) { if enc.hasKeys { if !enc.keyExists(key) { return } } if v == 0 { return } enc.grow(10 + len(key)) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKey) enc.buf = strconv.AppendFloat(enc.buf, v, 'f', -1, 64) }
go
func (enc *Encoder) Float64KeyOmitEmpty(key string, v float64) { if enc.hasKeys { if !enc.keyExists(key) { return } } if v == 0 { return } enc.grow(10 + len(key)) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKey) enc.buf = strconv.AppendFloat(enc.buf, v, 'f', -1, 64) }
[ "func", "(", "enc", "*", "Encoder", ")", "Float64KeyOmitEmpty", "(", "key", "string", ",", "v", "float64", ")", "{", "if", "enc", ".", "hasKeys", "{", "if", "!", "enc", ".", "keyExists", "(", "key", ")", "{", "return", "\n", "}", "\n", "}", "\n", "if", "v", "==", "0", "{", "return", "\n", "}", "\n", "enc", ".", "grow", "(", "10", "+", "len", "(", "key", ")", ")", "\n", "r", ":=", "enc", ".", "getPreviousRune", "(", ")", "\n", "if", "r", "!=", "'{'", "{", "enc", ".", "writeByte", "(", "','", ")", "\n", "}", "\n", "enc", ".", "writeByte", "(", "'\"'", ")", "\n", "enc", ".", "writeStringEscape", "(", "key", ")", "\n", "enc", ".", "writeBytes", "(", "objKey", ")", "\n", "enc", ".", "buf", "=", "strconv", ".", "AppendFloat", "(", "enc", ".", "buf", ",", "v", ",", "'f'", ",", "-", "1", ",", "64", ")", "\n", "}" ]
// Float64KeyOmitEmpty adds a float64 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key
[ "Float64KeyOmitEmpty", "adds", "a", "float64", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L191-L209
train
francoispqt/gojay
encode_number_float.go
AddFloat32Key
func (enc *Encoder) AddFloat32Key(key string, v float32) { enc.Float32Key(key, v) }
go
func (enc *Encoder) AddFloat32Key(key string, v float32) { enc.Float32Key(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddFloat32Key", "(", "key", "string", ",", "v", "float32", ")", "{", "enc", ".", "Float32Key", "(", "key", ",", "v", ")", "\n", "}" ]
// AddFloat32Key adds a float32 to be encoded, must be used inside an object as it will encode a key
[ "AddFloat32Key", "adds", "a", "float32", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L290-L292
train
francoispqt/gojay
encode_number_float.go
AddFloat32KeyOmitEmpty
func (enc *Encoder) AddFloat32KeyOmitEmpty(key string, v float32) { enc.Float32KeyOmitEmpty(key, v) }
go
func (enc *Encoder) AddFloat32KeyOmitEmpty(key string, v float32) { enc.Float32KeyOmitEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddFloat32KeyOmitEmpty", "(", "key", "string", ",", "v", "float32", ")", "{", "enc", ".", "Float32KeyOmitEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddFloat32KeyOmitEmpty adds a float64 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key
[ "AddFloat32KeyOmitEmpty", "adds", "a", "float64", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L296-L298
train
francoispqt/gojay
encode_number_float.go
AddFloat32KeyNullEmpty
func (enc *Encoder) AddFloat32KeyNullEmpty(key string, v float32) { enc.Float32KeyNullEmpty(key, v) }
go
func (enc *Encoder) AddFloat32KeyNullEmpty(key string, v float32) { enc.Float32KeyNullEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddFloat32KeyNullEmpty", "(", "key", "string", ",", "v", "float32", ")", "{", "enc", ".", "Float32KeyNullEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddFloat32KeyNullEmpty adds a float64 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key
[ "AddFloat32KeyNullEmpty", "adds", "a", "float64", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_float.go#L302-L304
train
francoispqt/gojay
encode_number_int.go
EncodeInt
func (enc *Encoder) EncodeInt(n int) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeInt(n) _, err := enc.Write() if err != nil { return err } return nil }
go
func (enc *Encoder) EncodeInt(n int) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeInt(n) _, err := enc.Write() if err != nil { return err } return nil }
[ "func", "(", "enc", "*", "Encoder", ")", "EncodeInt", "(", "n", "int", ")", "error", "{", "if", "enc", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledEncoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "_", ",", "_", "=", "enc", ".", "encodeInt", "(", "n", ")", "\n", "_", ",", "err", ":=", "enc", ".", "Write", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// EncodeInt encodes an int to JSON
[ "EncodeInt", "encodes", "an", "int", "to", "JSON" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L6-L16
train
francoispqt/gojay
encode_number_int.go
EncodeInt64
func (enc *Encoder) EncodeInt64(n int64) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeInt64(n) _, err := enc.Write() if err != nil { return err } return nil }
go
func (enc *Encoder) EncodeInt64(n int64) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeInt64(n) _, err := enc.Write() if err != nil { return err } return nil }
[ "func", "(", "enc", "*", "Encoder", ")", "EncodeInt64", "(", "n", "int64", ")", "error", "{", "if", "enc", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledEncoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "_", ",", "_", "=", "enc", ".", "encodeInt64", "(", "n", ")", "\n", "_", ",", "err", ":=", "enc", ".", "Write", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// EncodeInt64 encodes an int64 to JSON
[ "EncodeInt64", "encodes", "an", "int64", "to", "JSON" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L25-L35
train
francoispqt/gojay
encode_number_int.go
encodeInt64
func (enc *Encoder) encodeInt64(n int64) ([]byte, error) { enc.buf = strconv.AppendInt(enc.buf, n, 10) return enc.buf, nil }
go
func (enc *Encoder) encodeInt64(n int64) ([]byte, error) { enc.buf = strconv.AppendInt(enc.buf, n, 10) return enc.buf, nil }
[ "func", "(", "enc", "*", "Encoder", ")", "encodeInt64", "(", "n", "int64", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "enc", ".", "buf", "=", "strconv", ".", "AppendInt", "(", "enc", ".", "buf", ",", "n", ",", "10", ")", "\n", "return", "enc", ".", "buf", ",", "nil", "\n", "}" ]
// encodeInt64 encodes an int to JSON
[ "encodeInt64", "encodes", "an", "int", "to", "JSON" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L38-L41
train
francoispqt/gojay
encode_number_int.go
AddIntKey
func (enc *Encoder) AddIntKey(key string, v int) { enc.IntKey(key, v) }
go
func (enc *Encoder) AddIntKey(key string, v int) { enc.IntKey(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddIntKey", "(", "key", "string", ",", "v", "int", ")", "{", "enc", ".", "IntKey", "(", "key", ",", "v", ")", "\n", "}" ]
// AddIntKey adds an int to be encoded, must be used inside an object as it will encode a key
[ "AddIntKey", "adds", "an", "int", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L100-L102
train
francoispqt/gojay
encode_number_int.go
AddIntKeyOmitEmpty
func (enc *Encoder) AddIntKeyOmitEmpty(key string, v int) { enc.IntKeyOmitEmpty(key, v) }
go
func (enc *Encoder) AddIntKeyOmitEmpty(key string, v int) { enc.IntKeyOmitEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddIntKeyOmitEmpty", "(", "key", "string", ",", "v", "int", ")", "{", "enc", ".", "IntKeyOmitEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddIntKeyOmitEmpty adds an int to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key.
[ "AddIntKeyOmitEmpty", "adds", "an", "int", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L106-L108
train
francoispqt/gojay
encode_number_int.go
AddIntKeyNullEmpty
func (enc *Encoder) AddIntKeyNullEmpty(key string, v int) { enc.IntKeyNullEmpty(key, v) }
go
func (enc *Encoder) AddIntKeyNullEmpty(key string, v int) { enc.IntKeyNullEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddIntKeyNullEmpty", "(", "key", "string", ",", "v", "int", ")", "{", "enc", ".", "IntKeyNullEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddIntKeyNullEmpty adds an int to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key.
[ "AddIntKeyNullEmpty", "adds", "an", "int", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L112-L114
train
francoispqt/gojay
encode_number_int.go
IntKey
func (enc *Encoder) IntKey(key string, v int) { if enc.hasKeys { if !enc.keyExists(key) { return } } enc.grow(10 + len(key)) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKey) enc.buf = strconv.AppendInt(enc.buf, int64(v), 10) }
go
func (enc *Encoder) IntKey(key string, v int) { if enc.hasKeys { if !enc.keyExists(key) { return } } enc.grow(10 + len(key)) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKey) enc.buf = strconv.AppendInt(enc.buf, int64(v), 10) }
[ "func", "(", "enc", "*", "Encoder", ")", "IntKey", "(", "key", "string", ",", "v", "int", ")", "{", "if", "enc", ".", "hasKeys", "{", "if", "!", "enc", ".", "keyExists", "(", "key", ")", "{", "return", "\n", "}", "\n", "}", "\n", "enc", ".", "grow", "(", "10", "+", "len", "(", "key", ")", ")", "\n", "r", ":=", "enc", ".", "getPreviousRune", "(", ")", "\n", "if", "r", "!=", "'{'", "{", "enc", ".", "writeByte", "(", "','", ")", "\n", "}", "\n", "enc", ".", "writeByte", "(", "'\"'", ")", "\n", "enc", ".", "writeStringEscape", "(", "key", ")", "\n", "enc", ".", "writeBytes", "(", "objKey", ")", "\n", "enc", ".", "buf", "=", "strconv", ".", "AppendInt", "(", "enc", ".", "buf", ",", "int64", "(", "v", ")", ",", "10", ")", "\n", "}" ]
// IntKey adds an int to be encoded, must be used inside an object as it will encode a key
[ "IntKey", "adds", "an", "int", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L117-L132
train
francoispqt/gojay
encode_number_int.go
AddInt64Key
func (enc *Encoder) AddInt64Key(key string, v int64) { enc.Int64Key(key, v) }
go
func (enc *Encoder) AddInt64Key(key string, v int64) { enc.Int64Key(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddInt64Key", "(", "key", "string", ",", "v", "int64", ")", "{", "enc", ".", "Int64Key", "(", "key", ",", "v", ")", "\n", "}" ]
// AddInt64Key adds an int64 to be encoded, must be used inside an object as it will encode a key
[ "AddInt64Key", "adds", "an", "int64", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L236-L238
train
francoispqt/gojay
encode_number_int.go
AddInt64KeyOmitEmpty
func (enc *Encoder) AddInt64KeyOmitEmpty(key string, v int64) { enc.Int64KeyOmitEmpty(key, v) }
go
func (enc *Encoder) AddInt64KeyOmitEmpty(key string, v int64) { enc.Int64KeyOmitEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddInt64KeyOmitEmpty", "(", "key", "string", ",", "v", "int64", ")", "{", "enc", ".", "Int64KeyOmitEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddInt64KeyOmitEmpty adds an int64 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key.
[ "AddInt64KeyOmitEmpty", "adds", "an", "int64", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L242-L244
train
francoispqt/gojay
encode_number_int.go
AddInt64KeyNullEmpty
func (enc *Encoder) AddInt64KeyNullEmpty(key string, v int64) { enc.Int64KeyNullEmpty(key, v) }
go
func (enc *Encoder) AddInt64KeyNullEmpty(key string, v int64) { enc.Int64KeyNullEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddInt64KeyNullEmpty", "(", "key", "string", ",", "v", "int64", ")", "{", "enc", ".", "Int64KeyNullEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddInt64KeyNullEmpty adds an int64 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key.
[ "AddInt64KeyNullEmpty", "adds", "an", "int64", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L248-L250
train
francoispqt/gojay
encode_number_int.go
AddInt32Key
func (enc *Encoder) AddInt32Key(key string, v int32) { enc.Int64Key(key, int64(v)) }
go
func (enc *Encoder) AddInt32Key(key string, v int32) { enc.Int64Key(key, int64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddInt32Key", "(", "key", "string", ",", "v", "int32", ")", "{", "enc", ".", "Int64Key", "(", "key", ",", "int64", "(", "v", ")", ")", "\n", "}" ]
// AddInt32Key adds an int32 to be encoded, must be used inside an object as it will encode a key
[ "AddInt32Key", "adds", "an", "int32", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L345-L347
train
francoispqt/gojay
encode_number_int.go
AddInt32KeyOmitEmpty
func (enc *Encoder) AddInt32KeyOmitEmpty(key string, v int32) { enc.Int64KeyOmitEmpty(key, int64(v)) }
go
func (enc *Encoder) AddInt32KeyOmitEmpty(key string, v int32) { enc.Int64KeyOmitEmpty(key, int64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddInt32KeyOmitEmpty", "(", "key", "string", ",", "v", "int32", ")", "{", "enc", ".", "Int64KeyOmitEmpty", "(", "key", ",", "int64", "(", "v", ")", ")", "\n", "}" ]
// AddInt32KeyOmitEmpty adds an int32 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key.
[ "AddInt32KeyOmitEmpty", "adds", "an", "int32", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L351-L353
train
francoispqt/gojay
encode_number_int.go
Int32KeyNullEmpty
func (enc *Encoder) Int32KeyNullEmpty(key string, v int32) { enc.Int64KeyNullEmpty(key, int64(v)) }
go
func (enc *Encoder) Int32KeyNullEmpty(key string, v int32) { enc.Int64KeyNullEmpty(key, int64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "Int32KeyNullEmpty", "(", "key", "string", ",", "v", "int32", ")", "{", "enc", ".", "Int64KeyNullEmpty", "(", "key", ",", "int64", "(", "v", ")", ")", "\n", "}" ]
// Int32KeyNullEmpty adds an int32 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key.
[ "Int32KeyNullEmpty", "adds", "an", "int32", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L368-L370
train
francoispqt/gojay
encode_number_int.go
AddInt16Key
func (enc *Encoder) AddInt16Key(key string, v int16) { enc.Int64Key(key, int64(v)) }
go
func (enc *Encoder) AddInt16Key(key string, v int16) { enc.Int64Key(key, int64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddInt16Key", "(", "key", "string", ",", "v", "int16", ")", "{", "enc", ".", "Int64Key", "(", "key", ",", "int64", "(", "v", ")", ")", "\n", "}" ]
// AddInt16Key adds an int16 to be encoded, must be used inside an object as it will encode a key
[ "AddInt16Key", "adds", "an", "int16", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L401-L403
train
francoispqt/gojay
encode_number_int.go
AddInt16KeyOmitEmpty
func (enc *Encoder) AddInt16KeyOmitEmpty(key string, v int16) { enc.Int64KeyOmitEmpty(key, int64(v)) }
go
func (enc *Encoder) AddInt16KeyOmitEmpty(key string, v int16) { enc.Int64KeyOmitEmpty(key, int64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddInt16KeyOmitEmpty", "(", "key", "string", ",", "v", "int16", ")", "{", "enc", ".", "Int64KeyOmitEmpty", "(", "key", ",", "int64", "(", "v", ")", ")", "\n", "}" ]
// AddInt16KeyOmitEmpty adds an int16 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key.
[ "AddInt16KeyOmitEmpty", "adds", "an", "int16", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L407-L409
train
francoispqt/gojay
encode_number_int.go
Int16KeyNullEmpty
func (enc *Encoder) Int16KeyNullEmpty(key string, v int16) { enc.Int64KeyNullEmpty(key, int64(v)) }
go
func (enc *Encoder) Int16KeyNullEmpty(key string, v int16) { enc.Int64KeyNullEmpty(key, int64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "Int16KeyNullEmpty", "(", "key", "string", ",", "v", "int16", ")", "{", "enc", ".", "Int64KeyNullEmpty", "(", "key", ",", "int64", "(", "v", ")", ")", "\n", "}" ]
// Int16KeyNullEmpty adds an int16 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key.
[ "Int16KeyNullEmpty", "adds", "an", "int16", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L430-L432
train
francoispqt/gojay
encode_number_int.go
AddInt8KeyOmitEmpty
func (enc *Encoder) AddInt8KeyOmitEmpty(key string, v int8) { enc.Int64KeyOmitEmpty(key, int64(v)) }
go
func (enc *Encoder) AddInt8KeyOmitEmpty(key string, v int8) { enc.Int64KeyOmitEmpty(key, int64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddInt8KeyOmitEmpty", "(", "key", "string", ",", "v", "int8", ")", "{", "enc", ".", "Int64KeyOmitEmpty", "(", "key", ",", "int64", "(", "v", ")", ")", "\n", "}" ]
// AddInt8KeyOmitEmpty adds an int8 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key.
[ "AddInt8KeyOmitEmpty", "adds", "an", "int8", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L475-L477
train
francoispqt/gojay
encode_number_int.go
AddInt8KeyNullEmpty
func (enc *Encoder) AddInt8KeyNullEmpty(key string, v int8) { enc.Int64KeyNullEmpty(key, int64(v)) }
go
func (enc *Encoder) AddInt8KeyNullEmpty(key string, v int8) { enc.Int64KeyNullEmpty(key, int64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddInt8KeyNullEmpty", "(", "key", "string", ",", "v", "int8", ")", "{", "enc", ".", "Int64KeyNullEmpty", "(", "key", ",", "int64", "(", "v", ")", ")", "\n", "}" ]
// AddInt8KeyNullEmpty adds an int8 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key.
[ "AddInt8KeyNullEmpty", "adds", "an", "int8", "to", "be", "encoded", "and", "skips", "it", "if", "its", "value", "is", "0", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L481-L483
train
francoispqt/gojay
encode_number_int.go
Int8Key
func (enc *Encoder) Int8Key(key string, v int8) { enc.Int64Key(key, int64(v)) }
go
func (enc *Encoder) Int8Key(key string, v int8) { enc.Int64Key(key, int64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "Int8Key", "(", "key", "string", ",", "v", "int8", ")", "{", "enc", ".", "Int64Key", "(", "key", ",", "int64", "(", "v", ")", ")", "\n", "}" ]
// Int8Key adds an int8 to be encoded, must be used inside an object as it will encode a key
[ "Int8Key", "adds", "an", "int8", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_int.go#L486-L488
train
francoispqt/gojay
encode_bool.go
EncodeBool
func (enc *Encoder) EncodeBool(v bool) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeBool(v) _, err := enc.Write() if err != nil { enc.err = err return err } return nil }
go
func (enc *Encoder) EncodeBool(v bool) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeBool(v) _, err := enc.Write() if err != nil { enc.err = err return err } return nil }
[ "func", "(", "enc", "*", "Encoder", ")", "EncodeBool", "(", "v", "bool", ")", "error", "{", "if", "enc", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledEncoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "_", ",", "_", "=", "enc", ".", "encodeBool", "(", "v", ")", "\n", "_", ",", "err", ":=", "enc", ".", "Write", "(", ")", "\n", "if", "err", "!=", "nil", "{", "enc", ".", "err", "=", "err", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// EncodeBool encodes a bool to JSON
[ "EncodeBool", "encodes", "a", "bool", "to", "JSON" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_bool.go#L6-L17
train
francoispqt/gojay
encode_bool.go
encodeBool
func (enc *Encoder) encodeBool(v bool) ([]byte, error) { enc.grow(5) if v { enc.writeString("true") } else { enc.writeString("false") } return enc.buf, enc.err }
go
func (enc *Encoder) encodeBool(v bool) ([]byte, error) { enc.grow(5) if v { enc.writeString("true") } else { enc.writeString("false") } return enc.buf, enc.err }
[ "func", "(", "enc", "*", "Encoder", ")", "encodeBool", "(", "v", "bool", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "enc", ".", "grow", "(", "5", ")", "\n", "if", "v", "{", "enc", ".", "writeString", "(", "\"", "\"", ")", "\n", "}", "else", "{", "enc", ".", "writeString", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "enc", ".", "buf", ",", "enc", ".", "err", "\n", "}" ]
// encodeBool encodes a bool to JSON
[ "encodeBool", "encodes", "a", "bool", "to", "JSON" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_bool.go#L20-L28
train
francoispqt/gojay
encode_bool.go
AddBoolKey
func (enc *Encoder) AddBoolKey(key string, v bool) { enc.BoolKey(key, v) }
go
func (enc *Encoder) AddBoolKey(key string, v bool) { enc.BoolKey(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddBoolKey", "(", "key", "string", ",", "v", "bool", ")", "{", "enc", ".", "BoolKey", "(", "key", ",", "v", ")", "\n", "}" ]
// AddBoolKey adds a bool to be encoded, must be used inside an object as it will encode a key.
[ "AddBoolKey", "adds", "a", "bool", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_bool.go#L46-L48
train
francoispqt/gojay
encode_bool.go
AddBoolKeyOmitEmpty
func (enc *Encoder) AddBoolKeyOmitEmpty(key string, v bool) { enc.BoolKeyOmitEmpty(key, v) }
go
func (enc *Encoder) AddBoolKeyOmitEmpty(key string, v bool) { enc.BoolKeyOmitEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddBoolKeyOmitEmpty", "(", "key", "string", ",", "v", "bool", ")", "{", "enc", ".", "BoolKeyOmitEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddBoolKeyOmitEmpty adds a bool to be encoded and skips if it is zero value. // Must be used inside an object as it will encode a key.
[ "AddBoolKeyOmitEmpty", "adds", "a", "bool", "to", "be", "encoded", "and", "skips", "if", "it", "is", "zero", "value", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_bool.go#L52-L54
train
francoispqt/gojay
encode_bool.go
AddBoolKeyNullEmpty
func (enc *Encoder) AddBoolKeyNullEmpty(key string, v bool) { enc.BoolKeyNullEmpty(key, v) }
go
func (enc *Encoder) AddBoolKeyNullEmpty(key string, v bool) { enc.BoolKeyNullEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddBoolKeyNullEmpty", "(", "key", "string", ",", "v", "bool", ")", "{", "enc", ".", "BoolKeyNullEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddBoolKeyNullEmpty adds a bool to be encoded and encodes `null` if it is zero value. // Must be used inside an object as it will encode a key.
[ "AddBoolKeyNullEmpty", "adds", "a", "bool", "to", "be", "encoded", "and", "encodes", "null", "if", "it", "is", "zero", "value", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_bool.go#L58-L60
train
francoispqt/gojay
encode_bool.go
BoolKey
func (enc *Encoder) BoolKey(key string, value bool) { if enc.hasKeys { if !enc.keyExists(key) { return } } enc.grow(5 + len(key)) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKey) enc.buf = strconv.AppendBool(enc.buf, value) }
go
func (enc *Encoder) BoolKey(key string, value bool) { if enc.hasKeys { if !enc.keyExists(key) { return } } enc.grow(5 + len(key)) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKey) enc.buf = strconv.AppendBool(enc.buf, value) }
[ "func", "(", "enc", "*", "Encoder", ")", "BoolKey", "(", "key", "string", ",", "value", "bool", ")", "{", "if", "enc", ".", "hasKeys", "{", "if", "!", "enc", ".", "keyExists", "(", "key", ")", "{", "return", "\n", "}", "\n", "}", "\n", "enc", ".", "grow", "(", "5", "+", "len", "(", "key", ")", ")", "\n", "r", ":=", "enc", ".", "getPreviousRune", "(", ")", "\n", "if", "r", "!=", "'{'", "{", "enc", ".", "writeByte", "(", "','", ")", "\n", "}", "\n", "enc", ".", "writeByte", "(", "'\"'", ")", "\n", "enc", ".", "writeStringEscape", "(", "key", ")", "\n", "enc", ".", "writeBytes", "(", "objKey", ")", "\n", "enc", ".", "buf", "=", "strconv", ".", "AppendBool", "(", "enc", ".", "buf", ",", "value", ")", "\n", "}" ]
// BoolKey adds a bool to be encoded, must be used inside an object as it will encode a key.
[ "BoolKey", "adds", "a", "bool", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_bool.go#L104-L119
train
francoispqt/gojay
encode_bool.go
BoolKeyOmitEmpty
func (enc *Encoder) BoolKeyOmitEmpty(key string, v bool) { if enc.hasKeys { if !enc.keyExists(key) { return } } if v == false { return } enc.grow(5 + len(key)) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKey) enc.buf = strconv.AppendBool(enc.buf, v) }
go
func (enc *Encoder) BoolKeyOmitEmpty(key string, v bool) { if enc.hasKeys { if !enc.keyExists(key) { return } } if v == false { return } enc.grow(5 + len(key)) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKey) enc.buf = strconv.AppendBool(enc.buf, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "BoolKeyOmitEmpty", "(", "key", "string", ",", "v", "bool", ")", "{", "if", "enc", ".", "hasKeys", "{", "if", "!", "enc", ".", "keyExists", "(", "key", ")", "{", "return", "\n", "}", "\n", "}", "\n", "if", "v", "==", "false", "{", "return", "\n", "}", "\n", "enc", ".", "grow", "(", "5", "+", "len", "(", "key", ")", ")", "\n", "r", ":=", "enc", ".", "getPreviousRune", "(", ")", "\n", "if", "r", "!=", "'{'", "{", "enc", ".", "writeByte", "(", "','", ")", "\n", "}", "\n", "enc", ".", "writeByte", "(", "'\"'", ")", "\n", "enc", ".", "writeStringEscape", "(", "key", ")", "\n", "enc", ".", "writeBytes", "(", "objKey", ")", "\n", "enc", ".", "buf", "=", "strconv", ".", "AppendBool", "(", "enc", ".", "buf", ",", "v", ")", "\n", "}" ]
// BoolKeyOmitEmpty adds a bool to be encoded and skips it if it is zero value. // Must be used inside an object as it will encode a key.
[ "BoolKeyOmitEmpty", "adds", "a", "bool", "to", "be", "encoded", "and", "skips", "it", "if", "it", "is", "zero", "value", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_bool.go#L123-L141
train
francoispqt/gojay
encode_stream.go
EncodeStream
func (s *StreamEncoder) EncodeStream(m MarshalerStream) { // if a single consumer, just use this encoder if s.nConsumer == 1 { go consume(s, s, m) return } // else use this Encoder only for first consumer // and use new encoders for other consumers // this is to avoid concurrent writing to same buffer // resulting in a weird JSON go consume(s, s, m) for i := 1; i < s.nConsumer; i++ { s.mux.RLock() select { case <-s.done: default: ss := Stream.borrowEncoder(s.w) ss.mux.Lock() ss.done = s.done ss.buf = make([]byte, 0, 512) ss.delimiter = s.delimiter go consume(s, ss, m) ss.mux.Unlock() } s.mux.RUnlock() } return }
go
func (s *StreamEncoder) EncodeStream(m MarshalerStream) { // if a single consumer, just use this encoder if s.nConsumer == 1 { go consume(s, s, m) return } // else use this Encoder only for first consumer // and use new encoders for other consumers // this is to avoid concurrent writing to same buffer // resulting in a weird JSON go consume(s, s, m) for i := 1; i < s.nConsumer; i++ { s.mux.RLock() select { case <-s.done: default: ss := Stream.borrowEncoder(s.w) ss.mux.Lock() ss.done = s.done ss.buf = make([]byte, 0, 512) ss.delimiter = s.delimiter go consume(s, ss, m) ss.mux.Unlock() } s.mux.RUnlock() } return }
[ "func", "(", "s", "*", "StreamEncoder", ")", "EncodeStream", "(", "m", "MarshalerStream", ")", "{", "// if a single consumer, just use this encoder", "if", "s", ".", "nConsumer", "==", "1", "{", "go", "consume", "(", "s", ",", "s", ",", "m", ")", "\n", "return", "\n", "}", "\n", "// else use this Encoder only for first consumer", "// and use new encoders for other consumers", "// this is to avoid concurrent writing to same buffer", "// resulting in a weird JSON", "go", "consume", "(", "s", ",", "s", ",", "m", ")", "\n", "for", "i", ":=", "1", ";", "i", "<", "s", ".", "nConsumer", ";", "i", "++", "{", "s", ".", "mux", ".", "RLock", "(", ")", "\n", "select", "{", "case", "<-", "s", ".", "done", ":", "default", ":", "ss", ":=", "Stream", ".", "borrowEncoder", "(", "s", ".", "w", ")", "\n", "ss", ".", "mux", ".", "Lock", "(", ")", "\n", "ss", ".", "done", "=", "s", ".", "done", "\n", "ss", ".", "buf", "=", "make", "(", "[", "]", "byte", ",", "0", ",", "512", ")", "\n", "ss", ".", "delimiter", "=", "s", ".", "delimiter", "\n", "go", "consume", "(", "s", ",", "ss", ",", "m", ")", "\n", "ss", ".", "mux", ".", "Unlock", "(", ")", "\n", "}", "\n", "s", ".", "mux", ".", "RUnlock", "(", ")", "\n", "}", "\n", "return", "\n", "}" ]
// EncodeStream spins up a defined number of non blocking consumers of the MarshalerStream m. // // m must implement MarshalerStream. Ideally m is a channel. See example for implementation. // // See the documentation for Marshal for details about the conversion of Go value to JSON.
[ "EncodeStream", "spins", "up", "a", "defined", "number", "of", "non", "blocking", "consumers", "of", "the", "MarshalerStream", "m", ".", "m", "must", "implement", "MarshalerStream", ".", "Ideally", "m", "is", "a", "channel", ".", "See", "example", "for", "implementation", ".", "See", "the", "documentation", "for", "Marshal", "for", "details", "about", "the", "conversion", "of", "Go", "value", "to", "JSON", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_stream.go#L32-L59
train
francoispqt/gojay
encode_stream.go
NConsumer
func (s *StreamEncoder) NConsumer(n int) *StreamEncoder { s.nConsumer = n return s }
go
func (s *StreamEncoder) NConsumer(n int) *StreamEncoder { s.nConsumer = n return s }
[ "func", "(", "s", "*", "StreamEncoder", ")", "NConsumer", "(", "n", "int", ")", "*", "StreamEncoder", "{", "s", ".", "nConsumer", "=", "n", "\n", "return", "s", "\n", "}" ]
// NConsumer sets the number of non blocking go routine to consume the stream.
[ "NConsumer", "sets", "the", "number", "of", "non", "blocking", "go", "routine", "to", "consume", "the", "stream", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_stream.go#L78-L81
train
francoispqt/gojay
encode_stream.go
AddObject
func (s *StreamEncoder) AddObject(v MarshalerJSONObject) { if v.IsNil() { return } s.Encoder.writeByte('{') v.MarshalJSONObject(s.Encoder) s.Encoder.writeByte('}') s.Encoder.writeByte(s.delimiter) }
go
func (s *StreamEncoder) AddObject(v MarshalerJSONObject) { if v.IsNil() { return } s.Encoder.writeByte('{') v.MarshalJSONObject(s.Encoder) s.Encoder.writeByte('}') s.Encoder.writeByte(s.delimiter) }
[ "func", "(", "s", "*", "StreamEncoder", ")", "AddObject", "(", "v", "MarshalerJSONObject", ")", "{", "if", "v", ".", "IsNil", "(", ")", "{", "return", "\n", "}", "\n", "s", ".", "Encoder", ".", "writeByte", "(", "'{'", ")", "\n", "v", ".", "MarshalJSONObject", "(", "s", ".", "Encoder", ")", "\n", "s", ".", "Encoder", ".", "writeByte", "(", "'}'", ")", "\n", "s", ".", "Encoder", ".", "writeByte", "(", "s", ".", "delimiter", ")", "\n", "}" ]
// AddObject adds an object to be encoded. // value must implement MarshalerJSONObject.
[ "AddObject", "adds", "an", "object", "to", "be", "encoded", ".", "value", "must", "implement", "MarshalerJSONObject", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_stream.go#L141-L149
train
francoispqt/gojay
encode_stream.go
AddString
func (s *StreamEncoder) AddString(v string) { s.Encoder.writeByte('"') s.Encoder.writeString(v) s.Encoder.writeByte('"') s.Encoder.writeByte(s.delimiter) }
go
func (s *StreamEncoder) AddString(v string) { s.Encoder.writeByte('"') s.Encoder.writeString(v) s.Encoder.writeByte('"') s.Encoder.writeByte(s.delimiter) }
[ "func", "(", "s", "*", "StreamEncoder", ")", "AddString", "(", "v", "string", ")", "{", "s", ".", "Encoder", ".", "writeByte", "(", "'\"'", ")", "\n", "s", ".", "Encoder", ".", "writeString", "(", "v", ")", "\n", "s", ".", "Encoder", ".", "writeByte", "(", "'\"'", ")", "\n", "s", ".", "Encoder", ".", "writeByte", "(", "s", ".", "delimiter", ")", "\n", "}" ]
// AddString adds a string to be encoded.
[ "AddString", "adds", "a", "string", "to", "be", "encoded", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_stream.go#L152-L157
train
francoispqt/gojay
encode_stream.go
AddArray
func (s *StreamEncoder) AddArray(v MarshalerJSONArray) { s.Encoder.writeByte('[') v.MarshalJSONArray(s.Encoder) s.Encoder.writeByte(']') s.Encoder.writeByte(s.delimiter) }
go
func (s *StreamEncoder) AddArray(v MarshalerJSONArray) { s.Encoder.writeByte('[') v.MarshalJSONArray(s.Encoder) s.Encoder.writeByte(']') s.Encoder.writeByte(s.delimiter) }
[ "func", "(", "s", "*", "StreamEncoder", ")", "AddArray", "(", "v", "MarshalerJSONArray", ")", "{", "s", ".", "Encoder", ".", "writeByte", "(", "'['", ")", "\n", "v", ".", "MarshalJSONArray", "(", "s", ".", "Encoder", ")", "\n", "s", ".", "Encoder", ".", "writeByte", "(", "']'", ")", "\n", "s", ".", "Encoder", ".", "writeByte", "(", "s", ".", "delimiter", ")", "\n", "}" ]
// AddArray adds an implementation of MarshalerJSONArray to be encoded.
[ "AddArray", "adds", "an", "implementation", "of", "MarshalerJSONArray", "to", "be", "encoded", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_stream.go#L160-L165
train
francoispqt/gojay
encode_stream.go
AddInt
func (s *StreamEncoder) AddInt(value int) { s.buf = strconv.AppendInt(s.buf, int64(value), 10) s.Encoder.writeByte(s.delimiter) }
go
func (s *StreamEncoder) AddInt(value int) { s.buf = strconv.AppendInt(s.buf, int64(value), 10) s.Encoder.writeByte(s.delimiter) }
[ "func", "(", "s", "*", "StreamEncoder", ")", "AddInt", "(", "value", "int", ")", "{", "s", ".", "buf", "=", "strconv", ".", "AppendInt", "(", "s", ".", "buf", ",", "int64", "(", "value", ")", ",", "10", ")", "\n", "s", ".", "Encoder", ".", "writeByte", "(", "s", ".", "delimiter", ")", "\n", "}" ]
// AddInt adds an int to be encoded.
[ "AddInt", "adds", "an", "int", "to", "be", "encoded", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_stream.go#L168-L171
train
francoispqt/gojay
encode_stream.go
AddFloat64
func (s *StreamEncoder) AddFloat64(value float64) { s.buf = strconv.AppendFloat(s.buf, value, 'f', -1, 64) s.Encoder.writeByte(s.delimiter) }
go
func (s *StreamEncoder) AddFloat64(value float64) { s.buf = strconv.AppendFloat(s.buf, value, 'f', -1, 64) s.Encoder.writeByte(s.delimiter) }
[ "func", "(", "s", "*", "StreamEncoder", ")", "AddFloat64", "(", "value", "float64", ")", "{", "s", ".", "buf", "=", "strconv", ".", "AppendFloat", "(", "s", ".", "buf", ",", "value", ",", "'f'", ",", "-", "1", ",", "64", ")", "\n", "s", ".", "Encoder", ".", "writeByte", "(", "s", ".", "delimiter", ")", "\n", "}" ]
// AddFloat64 adds a float64 to be encoded.
[ "AddFloat64", "adds", "a", "float64", "to", "be", "encoded", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_stream.go#L174-L177
train
francoispqt/gojay
examples/fuzz/main.go
UnmarshalJSONObject
func (u *user) UnmarshalJSONObject(dec *gojay.Decoder, key string) error { switch key { case "id": return dec.Int(&u.id) case "created": return dec.Uint64(&u.created) case "age": return dec.Float(&u.age) case "name": return dec.String(&u.name) case "email": return dec.String(&u.email) case "friend": uu := &user{} return dec.Object(uu) } return nil }
go
func (u *user) UnmarshalJSONObject(dec *gojay.Decoder, key string) error { switch key { case "id": return dec.Int(&u.id) case "created": return dec.Uint64(&u.created) case "age": return dec.Float(&u.age) case "name": return dec.String(&u.name) case "email": return dec.String(&u.email) case "friend": uu := &user{} return dec.Object(uu) } return nil }
[ "func", "(", "u", "*", "user", ")", "UnmarshalJSONObject", "(", "dec", "*", "gojay", ".", "Decoder", ",", "key", "string", ")", "error", "{", "switch", "key", "{", "case", "\"", "\"", ":", "return", "dec", ".", "Int", "(", "&", "u", ".", "id", ")", "\n", "case", "\"", "\"", ":", "return", "dec", ".", "Uint64", "(", "&", "u", ".", "created", ")", "\n", "case", "\"", "\"", ":", "return", "dec", ".", "Float", "(", "&", "u", ".", "age", ")", "\n", "case", "\"", "\"", ":", "return", "dec", ".", "String", "(", "&", "u", ".", "name", ")", "\n", "case", "\"", "\"", ":", "return", "dec", ".", "String", "(", "&", "u", ".", "email", ")", "\n", "case", "\"", "\"", ":", "uu", ":=", "&", "user", "{", "}", "\n", "return", "dec", ".", "Object", "(", "uu", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// implement gojay.UnmarshalerJSONObject
[ "implement", "gojay", ".", "UnmarshalerJSONObject" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/examples/fuzz/main.go#L17-L34
train
francoispqt/gojay
decode_pool.go
NewDecoder
func NewDecoder(r io.Reader) *Decoder { return &Decoder{ called: 0, cursor: 0, keysDone: 0, err: nil, r: r, data: make([]byte, 512), length: 0, isPooled: 0, } }
go
func NewDecoder(r io.Reader) *Decoder { return &Decoder{ called: 0, cursor: 0, keysDone: 0, err: nil, r: r, data: make([]byte, 512), length: 0, isPooled: 0, } }
[ "func", "NewDecoder", "(", "r", "io", ".", "Reader", ")", "*", "Decoder", "{", "return", "&", "Decoder", "{", "called", ":", "0", ",", "cursor", ":", "0", ",", "keysDone", ":", "0", ",", "err", ":", "nil", ",", "r", ":", "r", ",", "data", ":", "make", "(", "[", "]", "byte", ",", "512", ")", ",", "length", ":", "0", ",", "isPooled", ":", "0", ",", "}", "\n", "}" ]
// NewDecoder returns a new decoder. // It takes an io.Reader implementation as data input.
[ "NewDecoder", "returns", "a", "new", "decoder", ".", "It", "takes", "an", "io", ".", "Reader", "implementation", "as", "data", "input", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_pool.go#L20-L31
train
francoispqt/gojay
encode_embedded_json.go
AddEmbeddedJSON
func (enc *Encoder) AddEmbeddedJSON(v *EmbeddedJSON) { enc.grow(len(*v) + 4) r := enc.getPreviousRune() if r != '[' { enc.writeByte(',') } enc.writeBytes(*v) }
go
func (enc *Encoder) AddEmbeddedJSON(v *EmbeddedJSON) { enc.grow(len(*v) + 4) r := enc.getPreviousRune() if r != '[' { enc.writeByte(',') } enc.writeBytes(*v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddEmbeddedJSON", "(", "v", "*", "EmbeddedJSON", ")", "{", "enc", ".", "grow", "(", "len", "(", "*", "v", ")", "+", "4", ")", "\n", "r", ":=", "enc", ".", "getPreviousRune", "(", ")", "\n", "if", "r", "!=", "'['", "{", "enc", ".", "writeByte", "(", "','", ")", "\n", "}", "\n", "enc", ".", "writeBytes", "(", "*", "v", ")", "\n", "}" ]
// AddEmbeddedJSON adds an EmbeddedJSON to be encoded. // // It basically blindly writes the bytes to the final buffer. Therefore, // it expects the JSON to be of proper format.
[ "AddEmbeddedJSON", "adds", "an", "EmbeddedJSON", "to", "be", "encoded", ".", "It", "basically", "blindly", "writes", "the", "bytes", "to", "the", "final", "buffer", ".", "Therefore", "it", "expects", "the", "JSON", "to", "be", "of", "proper", "format", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_embedded_json.go#L26-L33
train
francoispqt/gojay
encode_embedded_json.go
AddEmbeddedJSONOmitEmpty
func (enc *Encoder) AddEmbeddedJSONOmitEmpty(v *EmbeddedJSON) { if v == nil || len(*v) == 0 { return } r := enc.getPreviousRune() if r != '[' { enc.writeByte(',') } enc.writeBytes(*v) }
go
func (enc *Encoder) AddEmbeddedJSONOmitEmpty(v *EmbeddedJSON) { if v == nil || len(*v) == 0 { return } r := enc.getPreviousRune() if r != '[' { enc.writeByte(',') } enc.writeBytes(*v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddEmbeddedJSONOmitEmpty", "(", "v", "*", "EmbeddedJSON", ")", "{", "if", "v", "==", "nil", "||", "len", "(", "*", "v", ")", "==", "0", "{", "return", "\n", "}", "\n", "r", ":=", "enc", ".", "getPreviousRune", "(", ")", "\n", "if", "r", "!=", "'['", "{", "enc", ".", "writeByte", "(", "','", ")", "\n", "}", "\n", "enc", ".", "writeBytes", "(", "*", "v", ")", "\n", "}" ]
// AddEmbeddedJSONOmitEmpty adds an EmbeddedJSON to be encoded or skips it if nil pointer or empty. // // It basically blindly writes the bytes to the final buffer. Therefore, // it expects the JSON to be of proper format.
[ "AddEmbeddedJSONOmitEmpty", "adds", "an", "EmbeddedJSON", "to", "be", "encoded", "or", "skips", "it", "if", "nil", "pointer", "or", "empty", ".", "It", "basically", "blindly", "writes", "the", "bytes", "to", "the", "final", "buffer", ".", "Therefore", "it", "expects", "the", "JSON", "to", "be", "of", "proper", "format", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_embedded_json.go#L39-L48
train
francoispqt/gojay
encode_embedded_json.go
AddEmbeddedJSONKey
func (enc *Encoder) AddEmbeddedJSONKey(key string, v *EmbeddedJSON) { if enc.hasKeys { if !enc.keyExists(key) { return } } enc.grow(len(key) + len(*v) + 5) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKey) enc.writeBytes(*v) }
go
func (enc *Encoder) AddEmbeddedJSONKey(key string, v *EmbeddedJSON) { if enc.hasKeys { if !enc.keyExists(key) { return } } enc.grow(len(key) + len(*v) + 5) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKey) enc.writeBytes(*v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddEmbeddedJSONKey", "(", "key", "string", ",", "v", "*", "EmbeddedJSON", ")", "{", "if", "enc", ".", "hasKeys", "{", "if", "!", "enc", ".", "keyExists", "(", "key", ")", "{", "return", "\n", "}", "\n", "}", "\n", "enc", ".", "grow", "(", "len", "(", "key", ")", "+", "len", "(", "*", "v", ")", "+", "5", ")", "\n", "r", ":=", "enc", ".", "getPreviousRune", "(", ")", "\n", "if", "r", "!=", "'{'", "{", "enc", ".", "writeByte", "(", "','", ")", "\n", "}", "\n", "enc", ".", "writeByte", "(", "'\"'", ")", "\n", "enc", ".", "writeStringEscape", "(", "key", ")", "\n", "enc", ".", "writeBytes", "(", "objKey", ")", "\n", "enc", ".", "writeBytes", "(", "*", "v", ")", "\n", "}" ]
// AddEmbeddedJSONKey adds an EmbeddedJSON and a key to be encoded. // // It basically blindly writes the bytes to the final buffer. Therefore, // it expects the JSON to be of proper format.
[ "AddEmbeddedJSONKey", "adds", "an", "EmbeddedJSON", "and", "a", "key", "to", "be", "encoded", ".", "It", "basically", "blindly", "writes", "the", "bytes", "to", "the", "final", "buffer", ".", "Therefore", "it", "expects", "the", "JSON", "to", "be", "of", "proper", "format", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_embedded_json.go#L54-L69
train
francoispqt/gojay
encode_array.go
EncodeArray
func (enc *Encoder) EncodeArray(v MarshalerJSONArray) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeArray(v) _, err := enc.Write() if err != nil { enc.err = err return err } return nil }
go
func (enc *Encoder) EncodeArray(v MarshalerJSONArray) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeArray(v) _, err := enc.Write() if err != nil { enc.err = err return err } return nil }
[ "func", "(", "enc", "*", "Encoder", ")", "EncodeArray", "(", "v", "MarshalerJSONArray", ")", "error", "{", "if", "enc", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledEncoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "_", ",", "_", "=", "enc", ".", "encodeArray", "(", "v", ")", "\n", "_", ",", "err", ":=", "enc", ".", "Write", "(", ")", "\n", "if", "err", "!=", "nil", "{", "enc", ".", "err", "=", "err", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// EncodeArray encodes an implementation of MarshalerJSONArray to JSON
[ "EncodeArray", "encodes", "an", "implementation", "of", "MarshalerJSONArray", "to", "JSON" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_array.go#L4-L15
train
francoispqt/gojay
encode_array.go
AddArrayKey
func (enc *Encoder) AddArrayKey(key string, v MarshalerJSONArray) { enc.ArrayKey(key, v) }
go
func (enc *Encoder) AddArrayKey(key string, v MarshalerJSONArray) { enc.ArrayKey(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddArrayKey", "(", "key", "string", ",", "v", "MarshalerJSONArray", ")", "{", "enc", ".", "ArrayKey", "(", "key", ",", "v", ")", "\n", "}" ]
// AddArrayKey adds an array or slice to be encoded, must be used inside an object as it will encode a key // value must implement Marshaler
[ "AddArrayKey", "adds", "an", "array", "or", "slice", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "value", "must", "implement", "Marshaler" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_array.go#L44-L46
train
francoispqt/gojay
encode_array.go
AddArrayKeyOmitEmpty
func (enc *Encoder) AddArrayKeyOmitEmpty(key string, v MarshalerJSONArray) { enc.ArrayKeyOmitEmpty(key, v) }
go
func (enc *Encoder) AddArrayKeyOmitEmpty(key string, v MarshalerJSONArray) { enc.ArrayKeyOmitEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddArrayKeyOmitEmpty", "(", "key", "string", ",", "v", "MarshalerJSONArray", ")", "{", "enc", ".", "ArrayKeyOmitEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddArrayKeyOmitEmpty adds an array or slice to be encoded and skips it if it is nil. // Must be called inside an object as it will encode a key.
[ "AddArrayKeyOmitEmpty", "adds", "an", "array", "or", "slice", "to", "be", "encoded", "and", "skips", "it", "if", "it", "is", "nil", ".", "Must", "be", "called", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_array.go#L50-L52
train
francoispqt/gojay
encode_array.go
AddArrayKeyNullEmpty
func (enc *Encoder) AddArrayKeyNullEmpty(key string, v MarshalerJSONArray) { enc.ArrayKeyNullEmpty(key, v) }
go
func (enc *Encoder) AddArrayKeyNullEmpty(key string, v MarshalerJSONArray) { enc.ArrayKeyNullEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddArrayKeyNullEmpty", "(", "key", "string", ",", "v", "MarshalerJSONArray", ")", "{", "enc", ".", "ArrayKeyNullEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddArrayKeyNullEmpty adds an array or slice to be encoded and skips it if it is nil. // Must be called inside an object as it will encode a key. `null` will be encoded`
[ "AddArrayKeyNullEmpty", "adds", "an", "array", "or", "slice", "to", "be", "encoded", "and", "skips", "it", "if", "it", "is", "nil", ".", "Must", "be", "called", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", ".", "null", "will", "be", "encoded" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_array.go#L56-L58
train
francoispqt/gojay
encode_array.go
ArrayKey
func (enc *Encoder) ArrayKey(key string, v MarshalerJSONArray) { if enc.hasKeys { if !enc.keyExists(key) { return } } if v.IsNil() { enc.grow(2 + len(key)) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKeyArr) enc.writeByte(']') return } enc.grow(5 + len(key)) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKeyArr) v.MarshalJSONArray(enc) enc.writeByte(']') }
go
func (enc *Encoder) ArrayKey(key string, v MarshalerJSONArray) { if enc.hasKeys { if !enc.keyExists(key) { return } } if v.IsNil() { enc.grow(2 + len(key)) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKeyArr) enc.writeByte(']') return } enc.grow(5 + len(key)) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKeyArr) v.MarshalJSONArray(enc) enc.writeByte(']') }
[ "func", "(", "enc", "*", "Encoder", ")", "ArrayKey", "(", "key", "string", ",", "v", "MarshalerJSONArray", ")", "{", "if", "enc", ".", "hasKeys", "{", "if", "!", "enc", ".", "keyExists", "(", "key", ")", "{", "return", "\n", "}", "\n", "}", "\n", "if", "v", ".", "IsNil", "(", ")", "{", "enc", ".", "grow", "(", "2", "+", "len", "(", "key", ")", ")", "\n", "r", ":=", "enc", ".", "getPreviousRune", "(", ")", "\n", "if", "r", "!=", "'{'", "{", "enc", ".", "writeByte", "(", "','", ")", "\n", "}", "\n", "enc", ".", "writeByte", "(", "'\"'", ")", "\n", "enc", ".", "writeStringEscape", "(", "key", ")", "\n", "enc", ".", "writeBytes", "(", "objKeyArr", ")", "\n", "enc", ".", "writeByte", "(", "']'", ")", "\n", "return", "\n", "}", "\n", "enc", ".", "grow", "(", "5", "+", "len", "(", "key", ")", ")", "\n", "r", ":=", "enc", ".", "getPreviousRune", "(", ")", "\n", "if", "r", "!=", "'{'", "{", "enc", ".", "writeByte", "(", "','", ")", "\n", "}", "\n", "enc", ".", "writeByte", "(", "'\"'", ")", "\n", "enc", ".", "writeStringEscape", "(", "key", ")", "\n", "enc", ".", "writeBytes", "(", "objKeyArr", ")", "\n", "v", ".", "MarshalJSONArray", "(", "enc", ")", "\n", "enc", ".", "writeByte", "(", "']'", ")", "\n", "}" ]
// ArrayKey adds an array or slice to be encoded, must be used inside an object as it will encode a key // value must implement Marshaler
[ "ArrayKey", "adds", "an", "array", "or", "slice", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "value", "must", "implement", "Marshaler" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_array.go#L118-L146
train
francoispqt/gojay
encode_array.go
ArrayKeyOmitEmpty
func (enc *Encoder) ArrayKeyOmitEmpty(key string, v MarshalerJSONArray) { if enc.hasKeys { if !enc.keyExists(key) { return } } if v.IsNil() { return } enc.grow(5 + len(key)) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKeyArr) v.MarshalJSONArray(enc) enc.writeByte(']') }
go
func (enc *Encoder) ArrayKeyOmitEmpty(key string, v MarshalerJSONArray) { if enc.hasKeys { if !enc.keyExists(key) { return } } if v.IsNil() { return } enc.grow(5 + len(key)) r := enc.getPreviousRune() if r != '{' { enc.writeByte(',') } enc.writeByte('"') enc.writeStringEscape(key) enc.writeBytes(objKeyArr) v.MarshalJSONArray(enc) enc.writeByte(']') }
[ "func", "(", "enc", "*", "Encoder", ")", "ArrayKeyOmitEmpty", "(", "key", "string", ",", "v", "MarshalerJSONArray", ")", "{", "if", "enc", ".", "hasKeys", "{", "if", "!", "enc", ".", "keyExists", "(", "key", ")", "{", "return", "\n", "}", "\n", "}", "\n", "if", "v", ".", "IsNil", "(", ")", "{", "return", "\n", "}", "\n", "enc", ".", "grow", "(", "5", "+", "len", "(", "key", ")", ")", "\n", "r", ":=", "enc", ".", "getPreviousRune", "(", ")", "\n", "if", "r", "!=", "'{'", "{", "enc", ".", "writeByte", "(", "','", ")", "\n", "}", "\n", "enc", ".", "writeByte", "(", "'\"'", ")", "\n", "enc", ".", "writeStringEscape", "(", "key", ")", "\n", "enc", ".", "writeBytes", "(", "objKeyArr", ")", "\n", "v", ".", "MarshalJSONArray", "(", "enc", ")", "\n", "enc", ".", "writeByte", "(", "']'", ")", "\n", "}" ]
// ArrayKeyOmitEmpty adds an array or slice to be encoded and skips if it is nil. // Must be called inside an object as it will encode a key.
[ "ArrayKeyOmitEmpty", "adds", "an", "array", "or", "slice", "to", "be", "encoded", "and", "skips", "if", "it", "is", "nil", ".", "Must", "be", "called", "inside", "an", "object", "as", "it", "will", "encode", "a", "key", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_array.go#L150-L169
train
francoispqt/gojay
decode_embedded_json.go
EmbeddedJSON
func (dec *Decoder) EmbeddedJSON(v *EmbeddedJSON) error { err := dec.decodeEmbeddedJSON(v) if err != nil { return err } dec.called |= 1 return nil }
go
func (dec *Decoder) EmbeddedJSON(v *EmbeddedJSON) error { err := dec.decodeEmbeddedJSON(v) if err != nil { return err } dec.called |= 1 return nil }
[ "func", "(", "dec", "*", "Decoder", ")", "EmbeddedJSON", "(", "v", "*", "EmbeddedJSON", ")", "error", "{", "err", ":=", "dec", ".", "decodeEmbeddedJSON", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "dec", ".", "called", "|=", "1", "\n", "return", "nil", "\n", "}" ]
// EmbeddedJSON adds an EmbeddedsJSON to the value pointed by v. // It can be used to delay JSON decoding or precompute a JSON encoding.
[ "EmbeddedJSON", "adds", "an", "EmbeddedsJSON", "to", "the", "value", "pointed", "by", "v", ".", "It", "can", "be", "used", "to", "delay", "JSON", "decoding", "or", "precompute", "a", "JSON", "encoding", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_embedded_json.go#L78-L85
train
francoispqt/gojay
encode_interface.go
Encode
func (enc *Encoder) Encode(v interface{}) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } switch vt := v.(type) { case string: return enc.EncodeString(vt) case bool: return enc.EncodeBool(vt) case MarshalerJSONArray: return enc.EncodeArray(vt) case MarshalerJSONObject: return enc.EncodeObject(vt) case int: return enc.EncodeInt(vt) case int64: return enc.EncodeInt64(vt) case int32: return enc.EncodeInt(int(vt)) case int8: return enc.EncodeInt(int(vt)) case uint64: return enc.EncodeUint64(vt) case uint32: return enc.EncodeInt(int(vt)) case uint16: return enc.EncodeInt(int(vt)) case uint8: return enc.EncodeInt(int(vt)) case float64: return enc.EncodeFloat(vt) case float32: return enc.EncodeFloat32(vt) case *EmbeddedJSON: return enc.EncodeEmbeddedJSON(vt) default: return InvalidMarshalError(fmt.Sprintf(invalidMarshalErrorMsg, vt)) } }
go
func (enc *Encoder) Encode(v interface{}) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } switch vt := v.(type) { case string: return enc.EncodeString(vt) case bool: return enc.EncodeBool(vt) case MarshalerJSONArray: return enc.EncodeArray(vt) case MarshalerJSONObject: return enc.EncodeObject(vt) case int: return enc.EncodeInt(vt) case int64: return enc.EncodeInt64(vt) case int32: return enc.EncodeInt(int(vt)) case int8: return enc.EncodeInt(int(vt)) case uint64: return enc.EncodeUint64(vt) case uint32: return enc.EncodeInt(int(vt)) case uint16: return enc.EncodeInt(int(vt)) case uint8: return enc.EncodeInt(int(vt)) case float64: return enc.EncodeFloat(vt) case float32: return enc.EncodeFloat32(vt) case *EmbeddedJSON: return enc.EncodeEmbeddedJSON(vt) default: return InvalidMarshalError(fmt.Sprintf(invalidMarshalErrorMsg, vt)) } }
[ "func", "(", "enc", "*", "Encoder", ")", "Encode", "(", "v", "interface", "{", "}", ")", "error", "{", "if", "enc", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledEncoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "switch", "vt", ":=", "v", ".", "(", "type", ")", "{", "case", "string", ":", "return", "enc", ".", "EncodeString", "(", "vt", ")", "\n", "case", "bool", ":", "return", "enc", ".", "EncodeBool", "(", "vt", ")", "\n", "case", "MarshalerJSONArray", ":", "return", "enc", ".", "EncodeArray", "(", "vt", ")", "\n", "case", "MarshalerJSONObject", ":", "return", "enc", ".", "EncodeObject", "(", "vt", ")", "\n", "case", "int", ":", "return", "enc", ".", "EncodeInt", "(", "vt", ")", "\n", "case", "int64", ":", "return", "enc", ".", "EncodeInt64", "(", "vt", ")", "\n", "case", "int32", ":", "return", "enc", ".", "EncodeInt", "(", "int", "(", "vt", ")", ")", "\n", "case", "int8", ":", "return", "enc", ".", "EncodeInt", "(", "int", "(", "vt", ")", ")", "\n", "case", "uint64", ":", "return", "enc", ".", "EncodeUint64", "(", "vt", ")", "\n", "case", "uint32", ":", "return", "enc", ".", "EncodeInt", "(", "int", "(", "vt", ")", ")", "\n", "case", "uint16", ":", "return", "enc", ".", "EncodeInt", "(", "int", "(", "vt", ")", ")", "\n", "case", "uint8", ":", "return", "enc", ".", "EncodeInt", "(", "int", "(", "vt", ")", ")", "\n", "case", "float64", ":", "return", "enc", ".", "EncodeFloat", "(", "vt", ")", "\n", "case", "float32", ":", "return", "enc", ".", "EncodeFloat32", "(", "vt", ")", "\n", "case", "*", "EmbeddedJSON", ":", "return", "enc", ".", "EncodeEmbeddedJSON", "(", "vt", ")", "\n", "default", ":", "return", "InvalidMarshalError", "(", "fmt", ".", "Sprintf", "(", "invalidMarshalErrorMsg", ",", "vt", ")", ")", "\n", "}", "\n", "}" ]
// Encode encodes a value to JSON. // // If Encode cannot find a way to encode the type to JSON // it will return an InvalidMarshalError.
[ "Encode", "encodes", "a", "value", "to", "JSON", ".", "If", "Encode", "cannot", "find", "a", "way", "to", "encode", "the", "type", "to", "JSON", "it", "will", "return", "an", "InvalidMarshalError", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_interface.go#L11-L49
train
francoispqt/gojay
encode_pool.go
BorrowEncoder
func BorrowEncoder(w io.Writer) *Encoder { enc := encPool.Get().(*Encoder) enc.w = w enc.buf = enc.buf[:0] enc.isPooled = 0 enc.err = nil enc.hasKeys = false enc.keys = nil return enc }
go
func BorrowEncoder(w io.Writer) *Encoder { enc := encPool.Get().(*Encoder) enc.w = w enc.buf = enc.buf[:0] enc.isPooled = 0 enc.err = nil enc.hasKeys = false enc.keys = nil return enc }
[ "func", "BorrowEncoder", "(", "w", "io", ".", "Writer", ")", "*", "Encoder", "{", "enc", ":=", "encPool", ".", "Get", "(", ")", ".", "(", "*", "Encoder", ")", "\n", "enc", ".", "w", "=", "w", "\n", "enc", ".", "buf", "=", "enc", ".", "buf", "[", ":", "0", "]", "\n", "enc", ".", "isPooled", "=", "0", "\n", "enc", ".", "err", "=", "nil", "\n", "enc", ".", "hasKeys", "=", "false", "\n", "enc", ".", "keys", "=", "nil", "\n", "return", "enc", "\n", "}" ]
// BorrowEncoder borrows an Encoder from the pool.
[ "BorrowEncoder", "borrows", "an", "Encoder", "from", "the", "pool", "." ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_pool.go#L35-L44
train
francoispqt/gojay
encode_sqlnull.go
EncodeSQLNullString
func (enc *Encoder) EncodeSQLNullString(v *sql.NullString) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeString(v.String) _, err := enc.Write() if err != nil { enc.err = err return err } return nil }
go
func (enc *Encoder) EncodeSQLNullString(v *sql.NullString) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeString(v.String) _, err := enc.Write() if err != nil { enc.err = err return err } return nil }
[ "func", "(", "enc", "*", "Encoder", ")", "EncodeSQLNullString", "(", "v", "*", "sql", ".", "NullString", ")", "error", "{", "if", "enc", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledEncoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "_", ",", "_", "=", "enc", ".", "encodeString", "(", "v", ".", "String", ")", "\n", "_", ",", "err", ":=", "enc", ".", "Write", "(", ")", "\n", "if", "err", "!=", "nil", "{", "enc", ".", "err", "=", "err", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// EncodeSQLNullString encodes a string to
[ "EncodeSQLNullString", "encodes", "a", "string", "to" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L6-L17
train
francoispqt/gojay
encode_sqlnull.go
SQLNullString
func (enc *Encoder) SQLNullString(v *sql.NullString) { enc.String(v.String) }
go
func (enc *Encoder) SQLNullString(v *sql.NullString) { enc.String(v.String) }
[ "func", "(", "enc", "*", "Encoder", ")", "SQLNullString", "(", "v", "*", "sql", ".", "NullString", ")", "{", "enc", ".", "String", "(", "v", ".", "String", ")", "\n", "}" ]
// SQLNullString adds a string to be encoded, must be used inside an object as it will encode a key
[ "SQLNullString", "adds", "a", "string", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L54-L56
train
francoispqt/gojay
encode_sqlnull.go
SQLNullStringOmitEmpty
func (enc *Encoder) SQLNullStringOmitEmpty(v *sql.NullString) { if v != nil && v.Valid && v.String != "" { enc.String(v.String) } }
go
func (enc *Encoder) SQLNullStringOmitEmpty(v *sql.NullString) { if v != nil && v.Valid && v.String != "" { enc.String(v.String) } }
[ "func", "(", "enc", "*", "Encoder", ")", "SQLNullStringOmitEmpty", "(", "v", "*", "sql", ".", "NullString", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "Valid", "&&", "v", ".", "String", "!=", "\"", "\"", "{", "enc", ".", "String", "(", "v", ".", "String", ")", "\n", "}", "\n", "}" ]
// SQLNullStringOmitEmpty adds a string to be encoded, must be used inside an object as it will encode a key
[ "SQLNullStringOmitEmpty", "adds", "a", "string", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L59-L63
train
francoispqt/gojay
encode_sqlnull.go
SQLNullStringNullEmpty
func (enc *Encoder) SQLNullStringNullEmpty(v *sql.NullString) { if v != nil && v.Valid { enc.StringNullEmpty(v.String) } }
go
func (enc *Encoder) SQLNullStringNullEmpty(v *sql.NullString) { if v != nil && v.Valid { enc.StringNullEmpty(v.String) } }
[ "func", "(", "enc", "*", "Encoder", ")", "SQLNullStringNullEmpty", "(", "v", "*", "sql", ".", "NullString", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "Valid", "{", "enc", ".", "StringNullEmpty", "(", "v", ".", "String", ")", "\n", "}", "\n", "}" ]
// SQLNullStringNullEmpty adds a string to be encoded, must be used inside an object as it will encode a key
[ "SQLNullStringNullEmpty", "adds", "a", "string", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L66-L70
train
francoispqt/gojay
encode_sqlnull.go
SQLNullStringKey
func (enc *Encoder) SQLNullStringKey(key string, v *sql.NullString) { enc.StringKey(key, v.String) }
go
func (enc *Encoder) SQLNullStringKey(key string, v *sql.NullString) { enc.StringKey(key, v.String) }
[ "func", "(", "enc", "*", "Encoder", ")", "SQLNullStringKey", "(", "key", "string", ",", "v", "*", "sql", ".", "NullString", ")", "{", "enc", ".", "StringKey", "(", "key", ",", "v", ".", "String", ")", "\n", "}" ]
// SQLNullStringKey adds a string to be encoded, must be used inside an object as it will encode a key
[ "SQLNullStringKey", "adds", "a", "string", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L73-L75
train
francoispqt/gojay
encode_sqlnull.go
SQLNullStringKeyOmitEmpty
func (enc *Encoder) SQLNullStringKeyOmitEmpty(key string, v *sql.NullString) { if v != nil && v.Valid && v.String != "" { enc.StringKeyOmitEmpty(key, v.String) } }
go
func (enc *Encoder) SQLNullStringKeyOmitEmpty(key string, v *sql.NullString) { if v != nil && v.Valid && v.String != "" { enc.StringKeyOmitEmpty(key, v.String) } }
[ "func", "(", "enc", "*", "Encoder", ")", "SQLNullStringKeyOmitEmpty", "(", "key", "string", ",", "v", "*", "sql", ".", "NullString", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "Valid", "&&", "v", ".", "String", "!=", "\"", "\"", "{", "enc", ".", "StringKeyOmitEmpty", "(", "key", ",", "v", ".", "String", ")", "\n", "}", "\n", "}" ]
// SQLNullStringKeyOmitEmpty adds a string to be encoded or skips it if it is zero value. // Must be used inside an object as it will encode a key
[ "SQLNullStringKeyOmitEmpty", "adds", "a", "string", "to", "be", "encoded", "or", "skips", "it", "if", "it", "is", "zero", "value", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L79-L83
train
francoispqt/gojay
encode_sqlnull.go
SQLNullStringKeyNullEmpty
func (enc *Encoder) SQLNullStringKeyNullEmpty(key string, v *sql.NullString) { if v != nil && v.Valid { enc.StringKeyNullEmpty(key, v.String) } }
go
func (enc *Encoder) SQLNullStringKeyNullEmpty(key string, v *sql.NullString) { if v != nil && v.Valid { enc.StringKeyNullEmpty(key, v.String) } }
[ "func", "(", "enc", "*", "Encoder", ")", "SQLNullStringKeyNullEmpty", "(", "key", "string", ",", "v", "*", "sql", ".", "NullString", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "Valid", "{", "enc", ".", "StringKeyNullEmpty", "(", "key", ",", "v", ".", "String", ")", "\n", "}", "\n", "}" ]
// SQLNullStringKeyNullEmpty adds a string to be encoded or skips it if it is zero value. // Must be used inside an object as it will encode a key
[ "SQLNullStringKeyNullEmpty", "adds", "a", "string", "to", "be", "encoded", "or", "skips", "it", "if", "it", "is", "zero", "value", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L87-L91
train
francoispqt/gojay
encode_sqlnull.go
EncodeSQLNullInt64
func (enc *Encoder) EncodeSQLNullInt64(v *sql.NullInt64) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeInt64(v.Int64) _, err := enc.Write() if err != nil { enc.err = err return err } return nil }
go
func (enc *Encoder) EncodeSQLNullInt64(v *sql.NullInt64) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeInt64(v.Int64) _, err := enc.Write() if err != nil { enc.err = err return err } return nil }
[ "func", "(", "enc", "*", "Encoder", ")", "EncodeSQLNullInt64", "(", "v", "*", "sql", ".", "NullInt64", ")", "error", "{", "if", "enc", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledEncoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "_", ",", "_", "=", "enc", ".", "encodeInt64", "(", "v", ".", "Int64", ")", "\n", "_", ",", "err", ":=", "enc", ".", "Write", "(", ")", "\n", "if", "err", "!=", "nil", "{", "enc", ".", "err", "=", "err", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// NullInt64 // EncodeSQLNullInt64 encodes a string to
[ "NullInt64", "EncodeSQLNullInt64", "encodes", "a", "string", "to" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L96-L107
train
francoispqt/gojay
encode_sqlnull.go
AddSQLNullInt64Key
func (enc *Encoder) AddSQLNullInt64Key(key string, v *sql.NullInt64) { enc.Int64Key(key, v.Int64) }
go
func (enc *Encoder) AddSQLNullInt64Key(key string, v *sql.NullInt64) { enc.Int64Key(key, v.Int64) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddSQLNullInt64Key", "(", "key", "string", ",", "v", "*", "sql", ".", "NullInt64", ")", "{", "enc", ".", "Int64Key", "(", "key", ",", "v", ".", "Int64", ")", "\n", "}" ]
// AddSQLNullInt64Key adds a string to be encoded, must be used inside an object as it will encode a key
[ "AddSQLNullInt64Key", "adds", "a", "string", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L131-L133
train
francoispqt/gojay
encode_sqlnull.go
AddSQLNullInt64KeyOmitEmpty
func (enc *Encoder) AddSQLNullInt64KeyOmitEmpty(key string, v *sql.NullInt64) { if v != nil && v.Valid && v.Int64 != 0 { enc.Int64KeyOmitEmpty(key, v.Int64) } }
go
func (enc *Encoder) AddSQLNullInt64KeyOmitEmpty(key string, v *sql.NullInt64) { if v != nil && v.Valid && v.Int64 != 0 { enc.Int64KeyOmitEmpty(key, v.Int64) } }
[ "func", "(", "enc", "*", "Encoder", ")", "AddSQLNullInt64KeyOmitEmpty", "(", "key", "string", ",", "v", "*", "sql", ".", "NullInt64", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "Valid", "&&", "v", ".", "Int64", "!=", "0", "{", "enc", ".", "Int64KeyOmitEmpty", "(", "key", ",", "v", ".", "Int64", ")", "\n", "}", "\n", "}" ]
// AddSQLNullInt64KeyOmitEmpty adds a string to be encoded or skips it if it is zero value. // Must be used inside an object as it will encode a key
[ "AddSQLNullInt64KeyOmitEmpty", "adds", "a", "string", "to", "be", "encoded", "or", "skips", "it", "if", "it", "is", "zero", "value", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L137-L141
train
francoispqt/gojay
encode_sqlnull.go
SQLNullInt64
func (enc *Encoder) SQLNullInt64(v *sql.NullInt64) { enc.Int64(v.Int64) }
go
func (enc *Encoder) SQLNullInt64(v *sql.NullInt64) { enc.Int64(v.Int64) }
[ "func", "(", "enc", "*", "Encoder", ")", "SQLNullInt64", "(", "v", "*", "sql", ".", "NullInt64", ")", "{", "enc", ".", "Int64", "(", "v", ".", "Int64", ")", "\n", "}" ]
// SQLNullInt64 adds a string to be encoded, must be used inside an object as it will encode a key
[ "SQLNullInt64", "adds", "a", "string", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L152-L154
train
francoispqt/gojay
encode_sqlnull.go
SQLNullInt64OmitEmpty
func (enc *Encoder) SQLNullInt64OmitEmpty(v *sql.NullInt64) { if v != nil && v.Valid && v.Int64 != 0 { enc.Int64(v.Int64) } }
go
func (enc *Encoder) SQLNullInt64OmitEmpty(v *sql.NullInt64) { if v != nil && v.Valid && v.Int64 != 0 { enc.Int64(v.Int64) } }
[ "func", "(", "enc", "*", "Encoder", ")", "SQLNullInt64OmitEmpty", "(", "v", "*", "sql", ".", "NullInt64", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "Valid", "&&", "v", ".", "Int64", "!=", "0", "{", "enc", ".", "Int64", "(", "v", ".", "Int64", ")", "\n", "}", "\n", "}" ]
// SQLNullInt64OmitEmpty adds a string to be encoded, must be used inside an object as it will encode a key
[ "SQLNullInt64OmitEmpty", "adds", "a", "string", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L157-L161
train
francoispqt/gojay
encode_sqlnull.go
SQLNullInt64NullEmpty
func (enc *Encoder) SQLNullInt64NullEmpty(v *sql.NullInt64) { if v != nil && v.Valid { enc.Int64NullEmpty(v.Int64) } }
go
func (enc *Encoder) SQLNullInt64NullEmpty(v *sql.NullInt64) { if v != nil && v.Valid { enc.Int64NullEmpty(v.Int64) } }
[ "func", "(", "enc", "*", "Encoder", ")", "SQLNullInt64NullEmpty", "(", "v", "*", "sql", ".", "NullInt64", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "Valid", "{", "enc", ".", "Int64NullEmpty", "(", "v", ".", "Int64", ")", "\n", "}", "\n", "}" ]
// SQLNullInt64NullEmpty adds a string to be encoded, must be used inside an object as it will encode a key
[ "SQLNullInt64NullEmpty", "adds", "a", "string", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L164-L168
train
francoispqt/gojay
encode_sqlnull.go
SQLNullInt64KeyNullEmpty
func (enc *Encoder) SQLNullInt64KeyNullEmpty(key string, v *sql.NullInt64) { if v != nil && v.Valid { enc.Int64KeyNullEmpty(key, v.Int64) } }
go
func (enc *Encoder) SQLNullInt64KeyNullEmpty(key string, v *sql.NullInt64) { if v != nil && v.Valid { enc.Int64KeyNullEmpty(key, v.Int64) } }
[ "func", "(", "enc", "*", "Encoder", ")", "SQLNullInt64KeyNullEmpty", "(", "key", "string", ",", "v", "*", "sql", ".", "NullInt64", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "Valid", "{", "enc", ".", "Int64KeyNullEmpty", "(", "key", ",", "v", ".", "Int64", ")", "\n", "}", "\n", "}" ]
// SQLNullInt64KeyNullEmpty adds a string to be encoded or skips it if it is zero value. // Must be used inside an object as it will encode a key
[ "SQLNullInt64KeyNullEmpty", "adds", "a", "string", "to", "be", "encoded", "or", "skips", "it", "if", "it", "is", "zero", "value", ".", "Must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L185-L189
train
francoispqt/gojay
encode_sqlnull.go
EncodeSQLNullFloat64
func (enc *Encoder) EncodeSQLNullFloat64(v *sql.NullFloat64) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeFloat(v.Float64) _, err := enc.Write() if err != nil { enc.err = err return err } return nil }
go
func (enc *Encoder) EncodeSQLNullFloat64(v *sql.NullFloat64) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeFloat(v.Float64) _, err := enc.Write() if err != nil { enc.err = err return err } return nil }
[ "func", "(", "enc", "*", "Encoder", ")", "EncodeSQLNullFloat64", "(", "v", "*", "sql", ".", "NullFloat64", ")", "error", "{", "if", "enc", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledEncoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "_", ",", "_", "=", "enc", ".", "encodeFloat", "(", "v", ".", "Float64", ")", "\n", "_", ",", "err", ":=", "enc", ".", "Write", "(", ")", "\n", "if", "err", "!=", "nil", "{", "enc", ".", "err", "=", "err", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// NullFloat64 // EncodeSQLNullFloat64 encodes a string to
[ "NullFloat64", "EncodeSQLNullFloat64", "encodes", "a", "string", "to" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L194-L205
train
francoispqt/gojay
encode_sqlnull.go
SQLNullFloat64
func (enc *Encoder) SQLNullFloat64(v *sql.NullFloat64) { enc.Float64(v.Float64) }
go
func (enc *Encoder) SQLNullFloat64(v *sql.NullFloat64) { enc.Float64(v.Float64) }
[ "func", "(", "enc", "*", "Encoder", ")", "SQLNullFloat64", "(", "v", "*", "sql", ".", "NullFloat64", ")", "{", "enc", ".", "Float64", "(", "v", ".", "Float64", ")", "\n", "}" ]
// SQLNullFloat64 adds a string to be encoded, must be used inside an object as it will encode a key
[ "SQLNullFloat64", "adds", "a", "string", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L250-L252
train
francoispqt/gojay
encode_sqlnull.go
SQLNullFloat64OmitEmpty
func (enc *Encoder) SQLNullFloat64OmitEmpty(v *sql.NullFloat64) { if v != nil && v.Valid && v.Float64 != 0 { enc.Float64(v.Float64) } }
go
func (enc *Encoder) SQLNullFloat64OmitEmpty(v *sql.NullFloat64) { if v != nil && v.Valid && v.Float64 != 0 { enc.Float64(v.Float64) } }
[ "func", "(", "enc", "*", "Encoder", ")", "SQLNullFloat64OmitEmpty", "(", "v", "*", "sql", ".", "NullFloat64", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "Valid", "&&", "v", ".", "Float64", "!=", "0", "{", "enc", ".", "Float64", "(", "v", ".", "Float64", ")", "\n", "}", "\n", "}" ]
// SQLNullFloat64OmitEmpty adds a string to be encoded, must be used inside an object as it will encode a key
[ "SQLNullFloat64OmitEmpty", "adds", "a", "string", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L255-L259
train
francoispqt/gojay
encode_sqlnull.go
SQLNullFloat64NullEmpty
func (enc *Encoder) SQLNullFloat64NullEmpty(v *sql.NullFloat64) { if v != nil && v.Valid { enc.Float64NullEmpty(v.Float64) } }
go
func (enc *Encoder) SQLNullFloat64NullEmpty(v *sql.NullFloat64) { if v != nil && v.Valid { enc.Float64NullEmpty(v.Float64) } }
[ "func", "(", "enc", "*", "Encoder", ")", "SQLNullFloat64NullEmpty", "(", "v", "*", "sql", ".", "NullFloat64", ")", "{", "if", "v", "!=", "nil", "&&", "v", ".", "Valid", "{", "enc", ".", "Float64NullEmpty", "(", "v", ".", "Float64", ")", "\n", "}", "\n", "}" ]
// SQLNullFloat64NullEmpty adds a string to be encoded, must be used inside an object as it will encode a key
[ "SQLNullFloat64NullEmpty", "adds", "a", "string", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L262-L266
train
francoispqt/gojay
encode_sqlnull.go
SQLNullFloat64Key
func (enc *Encoder) SQLNullFloat64Key(key string, v *sql.NullFloat64) { enc.Float64Key(key, v.Float64) }
go
func (enc *Encoder) SQLNullFloat64Key(key string, v *sql.NullFloat64) { enc.Float64Key(key, v.Float64) }
[ "func", "(", "enc", "*", "Encoder", ")", "SQLNullFloat64Key", "(", "key", "string", ",", "v", "*", "sql", ".", "NullFloat64", ")", "{", "enc", ".", "Float64Key", "(", "key", ",", "v", ".", "Float64", ")", "\n", "}" ]
// SQLNullFloat64Key adds a string to be encoded, must be used inside an object as it will encode a key
[ "SQLNullFloat64Key", "adds", "a", "string", "to", "be", "encoded", "must", "be", "used", "inside", "an", "object", "as", "it", "will", "encode", "a", "key" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_sqlnull.go#L269-L271
train