id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
19,000
bxcodec/faker
datetime.go
DayOfMonth
func (d DateTime) DayOfMonth(v reflect.Value) (interface{}, error) { return d.dayOfMonth(), nil }
go
func (d DateTime) DayOfMonth(v reflect.Value) (interface{}, error) { return d.dayOfMonth(), nil }
[ "func", "(", "d", "DateTime", ")", "DayOfMonth", "(", "v", "reflect", ".", "Value", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "d", ".", "dayOfMonth", "(", ")", ",", "nil", "\n", "}" ]
// DayOfMonth formats DateTime using example DayOfMonth const
[ "DayOfMonth", "formats", "DateTime", "using", "example", "DayOfMonth", "const" ]
342a24f52a104690266c76399570254ec476d42c
https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/datetime.go#L748-L750
19,001
bxcodec/faker
datetime.go
Timestamp
func (d DateTime) Timestamp(v reflect.Value) (interface{}, error) { return d.timestamp(), nil }
go
func (d DateTime) Timestamp(v reflect.Value) (interface{}, error) { return d.timestamp(), nil }
[ "func", "(", "d", "DateTime", ")", "Timestamp", "(", "v", "reflect", ".", "Value", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "d", ".", "timestamp", "(", ")", ",", "nil", "\n", "}" ]
// Timestamp formats DateTime using example Timestamp const
[ "Timestamp", "formats", "DateTime", "using", "example", "Timestamp", "const" ]
342a24f52a104690266c76399570254ec476d42c
https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/datetime.go#L763-L765
19,002
bxcodec/faker
datetime.go
Century
func (d DateTime) Century(v reflect.Value) (interface{}, error) { return d.century(), nil }
go
func (d DateTime) Century(v reflect.Value) (interface{}, error) { return d.century(), nil }
[ "func", "(", "d", "DateTime", ")", "Century", "(", "v", "reflect", ".", "Value", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "d", ".", "century", "(", ")", ",", "nil", "\n", "}" ]
// Century returns a random century
[ "Century", "returns", "a", "random", "century" ]
342a24f52a104690266c76399570254ec476d42c
https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/datetime.go#L778-L780
19,003
bxcodec/faker
datetime.go
TimeZone
func (d DateTime) TimeZone(v reflect.Value) (interface{}, error) { return d.timezone(), nil }
go
func (d DateTime) TimeZone(v reflect.Value) (interface{}, error) { return d.timezone(), nil }
[ "func", "(", "d", "DateTime", ")", "TimeZone", "(", "v", "reflect", ".", "Value", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "d", ".", "timezone", "(", ")", ",", "nil", "\n", "}" ]
// TimeZone returns a random timezone
[ "TimeZone", "returns", "a", "random", "timezone" ]
342a24f52a104690266c76399570254ec476d42c
https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/datetime.go#L793-L795
19,004
bxcodec/faker
datetime.go
TimePeriod
func (d DateTime) TimePeriod(v reflect.Value) (interface{}, error) { return d.period(), nil }
go
func (d DateTime) TimePeriod(v reflect.Value) (interface{}, error) { return d.period(), nil }
[ "func", "(", "d", "DateTime", ")", "TimePeriod", "(", "v", "reflect", ".", "Value", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "d", ".", "period", "(", ")", ",", "nil", "\n", "}" ]
// TimePeriod formats DateTime using example TimePeriod const
[ "TimePeriod", "formats", "DateTime", "using", "example", "TimePeriod", "const" ]
342a24f52a104690266c76399570254ec476d42c
https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/datetime.go#L808-L810
19,005
bugsnag/bugsnag-go
bugsnag.go
Configure
func Configure(config Configuration) { Config.update(&config) updateSessionConfig() // Only do once in case the user overrides the default panichandler, and // configures multiple times. panicHandlerOnce.Do(Config.PanicHandler) }
go
func Configure(config Configuration) { Config.update(&config) updateSessionConfig() // Only do once in case the user overrides the default panichandler, and // configures multiple times. panicHandlerOnce.Do(Config.PanicHandler) }
[ "func", "Configure", "(", "config", "Configuration", ")", "{", "Config", ".", "update", "(", "&", "config", ")", "\n", "updateSessionConfig", "(", ")", "\n", "// Only do once in case the user overrides the default panichandler, and", "// configures multiple times.", "panicH...
// Configure Bugsnag. The only required setting is the APIKey, which can be // obtained by clicking on "Settings" in your Bugsnag dashboard. This function // is also responsible for installing the global panic handler, so it should be // called as early as possible in your initialization process.
[ "Configure", "Bugsnag", ".", "The", "only", "required", "setting", "is", "the", "APIKey", "which", "can", "be", "obtained", "by", "clicking", "on", "Settings", "in", "your", "Bugsnag", "dashboard", ".", "This", "function", "is", "also", "responsible", "for", ...
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/bugsnag.go#L45-L51
19,006
bugsnag/bugsnag-go
bugsnag.go
StartSession
func StartSession(ctx context.Context) context.Context { sessionTrackerOnce.Do(startSessionTracking) return sessionTracker.StartSession(ctx) }
go
func StartSession(ctx context.Context) context.Context { sessionTrackerOnce.Do(startSessionTracking) return sessionTracker.StartSession(ctx) }
[ "func", "StartSession", "(", "ctx", "context", ".", "Context", ")", "context", ".", "Context", "{", "sessionTrackerOnce", ".", "Do", "(", "startSessionTracking", ")", "\n", "return", "sessionTracker", ".", "StartSession", "(", "ctx", ")", "\n", "}" ]
// StartSession creates new context from the context.Context instance with // Bugsnag session data attached. Will start the session tracker if not already // started
[ "StartSession", "creates", "new", "context", "from", "the", "context", ".", "Context", "instance", "with", "Bugsnag", "session", "data", "attached", ".", "Will", "start", "the", "session", "tracker", "if", "not", "already", "started" ]
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/bugsnag.go#L56-L59
19,007
bugsnag/bugsnag-go
bugsnag.go
Handler
func Handler(h http.Handler, rawData ...interface{}) http.Handler { notifier := New(rawData...) if h == nil { h = http.DefaultServeMux } return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { request := r // Record a session if auto notify session is enabled ctx := r.Context() if Config.IsAutoCaptureSessions() { ctx = StartSession(ctx) } ctx = AttachRequestData(ctx, request) request = r.WithContext(ctx) defer notifier.AutoNotify(ctx, request) h.ServeHTTP(w, request) }) }
go
func Handler(h http.Handler, rawData ...interface{}) http.Handler { notifier := New(rawData...) if h == nil { h = http.DefaultServeMux } return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { request := r // Record a session if auto notify session is enabled ctx := r.Context() if Config.IsAutoCaptureSessions() { ctx = StartSession(ctx) } ctx = AttachRequestData(ctx, request) request = r.WithContext(ctx) defer notifier.AutoNotify(ctx, request) h.ServeHTTP(w, request) }) }
[ "func", "Handler", "(", "h", "http", ".", "Handler", ",", "rawData", "...", "interface", "{", "}", ")", "http", ".", "Handler", "{", "notifier", ":=", "New", "(", "rawData", "...", ")", "\n", "if", "h", "==", "nil", "{", "h", "=", "http", ".", "D...
// Handler creates an http Handler that notifies Bugsnag any panics that // happen. It then repanics so that the default http Server panic handler can // handle the panic too. The rawData is used to send extra information along // with any panics that are handled this way.
[ "Handler", "creates", "an", "http", "Handler", "that", "notifies", "Bugsnag", "any", "panics", "that", "happen", ".", "It", "then", "repanics", "so", "that", "the", "default", "http", "Server", "panic", "handler", "can", "handle", "the", "panic", "too", ".",...
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/bugsnag.go#L162-L181
19,008
bugsnag/bugsnag-go
sessions/tracker.go
NewSessionTracker
func NewSessionTracker(config *SessionTrackingConfiguration) SessionTracker { publisher := publisher{ config: config, client: &http.Client{Transport: config.Transport}, } st := sessionTracker{ sessionChannel: make(chan *Session, 1), sessions: []*Session{}, config: config, publisher: &publisher, } go st.processSessions() return &st }
go
func NewSessionTracker(config *SessionTrackingConfiguration) SessionTracker { publisher := publisher{ config: config, client: &http.Client{Transport: config.Transport}, } st := sessionTracker{ sessionChannel: make(chan *Session, 1), sessions: []*Session{}, config: config, publisher: &publisher, } go st.processSessions() return &st }
[ "func", "NewSessionTracker", "(", "config", "*", "SessionTrackingConfiguration", ")", "SessionTracker", "{", "publisher", ":=", "publisher", "{", "config", ":", "config", ",", "client", ":", "&", "http", ".", "Client", "{", "Transport", ":", "config", ".", "Tr...
// NewSessionTracker creates a new SessionTracker based on the provided config,
[ "NewSessionTracker", "creates", "a", "new", "SessionTracker", "based", "on", "the", "provided", "config" ]
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/sessions/tracker.go#L38-L51
19,009
bugsnag/bugsnag-go
sessions/tracker.go
IncrementEventCountAndGetSession
func IncrementEventCountAndGetSession(ctx context.Context, unhandled bool) *Session { if s := ctx.Value(contextSessionKey); s != nil { if session, ok := s.(*Session); ok && !session.StartedAt.IsZero() { // It is not just getting back a default value ec := session.EventCounts if unhandled { ec.Unhandled++ } else { ec.Handled++ } return session } } return nil }
go
func IncrementEventCountAndGetSession(ctx context.Context, unhandled bool) *Session { if s := ctx.Value(contextSessionKey); s != nil { if session, ok := s.(*Session); ok && !session.StartedAt.IsZero() { // It is not just getting back a default value ec := session.EventCounts if unhandled { ec.Unhandled++ } else { ec.Handled++ } return session } } return nil }
[ "func", "IncrementEventCountAndGetSession", "(", "ctx", "context", ".", "Context", ",", "unhandled", "bool", ")", "*", "Session", "{", "if", "s", ":=", "ctx", ".", "Value", "(", "contextSessionKey", ")", ";", "s", "!=", "nil", "{", "if", "session", ",", ...
// IncrementEventCountAndGetSession extracts a Bugsnag session from the given // context and increments the event count of unhandled or handled events and // returns the session
[ "IncrementEventCountAndGetSession", "extracts", "a", "Bugsnag", "session", "from", "the", "given", "context", "and", "increments", "the", "event", "count", "of", "unhandled", "or", "handled", "events", "and", "returns", "the", "session" ]
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/sessions/tracker.go#L56-L70
19,010
bugsnag/bugsnag-go
sessions/payload.go
makeSessionPayload
func makeSessionPayload(sessions []*Session, config *SessionTrackingConfiguration) *sessionPayload { releaseStage := config.ReleaseStage if releaseStage == "" { releaseStage = "production" } hostname := config.Hostname if hostname == "" { hostname = device.GetHostname() } return &sessionPayload{ Notifier: &notifierPayload{ Name: "Bugsnag Go", URL: "https://github.com/bugsnag/bugsnag-go", Version: config.Version, }, App: &appPayload{ Type: config.AppType, Version: config.AppVersion, ReleaseStage: releaseStage, }, Device: &devicePayload{ OsName: runtime.GOOS, Hostname: hostname, }, SessionCounts: []sessionCountsPayload{ { //This timestamp assumes that we're sending these off once a minute StartedAt: sessions[0].StartedAt.UTC().Format(time.RFC3339), SessionsStarted: len(sessions), }, }, } }
go
func makeSessionPayload(sessions []*Session, config *SessionTrackingConfiguration) *sessionPayload { releaseStage := config.ReleaseStage if releaseStage == "" { releaseStage = "production" } hostname := config.Hostname if hostname == "" { hostname = device.GetHostname() } return &sessionPayload{ Notifier: &notifierPayload{ Name: "Bugsnag Go", URL: "https://github.com/bugsnag/bugsnag-go", Version: config.Version, }, App: &appPayload{ Type: config.AppType, Version: config.AppVersion, ReleaseStage: releaseStage, }, Device: &devicePayload{ OsName: runtime.GOOS, Hostname: hostname, }, SessionCounts: []sessionCountsPayload{ { //This timestamp assumes that we're sending these off once a minute StartedAt: sessions[0].StartedAt.UTC().Format(time.RFC3339), SessionsStarted: len(sessions), }, }, } }
[ "func", "makeSessionPayload", "(", "sessions", "[", "]", "*", "Session", ",", "config", "*", "SessionTrackingConfiguration", ")", "*", "sessionPayload", "{", "releaseStage", ":=", "config", ".", "ReleaseStage", "\n", "if", "releaseStage", "==", "\"", "\"", "{", ...
// makeSessionPayload creates a sessionPayload based off of the given sessions and config
[ "makeSessionPayload", "creates", "a", "sessionPayload", "based", "off", "of", "the", "given", "sessions", "and", "config" ]
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/sessions/payload.go#L45-L78
19,011
bugsnag/bugsnag-go
headers/prefixed.go
PrefixedHeaders
func PrefixedHeaders(apiKey, payloadVersion string) map[string]string { return map[string]string{ "Content-Type": "application/json", "Bugsnag-Api-Key": apiKey, "Bugsnag-Payload-Version": payloadVersion, "Bugsnag-Sent-At": time.Now().UTC().Format(time.RFC3339), } }
go
func PrefixedHeaders(apiKey, payloadVersion string) map[string]string { return map[string]string{ "Content-Type": "application/json", "Bugsnag-Api-Key": apiKey, "Bugsnag-Payload-Version": payloadVersion, "Bugsnag-Sent-At": time.Now().UTC().Format(time.RFC3339), } }
[ "func", "PrefixedHeaders", "(", "apiKey", ",", "payloadVersion", "string", ")", "map", "[", "string", "]", "string", "{", "return", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "apiKey", ",", "\"", "\""...
//PrefixedHeaders returns a map of Content-Type and the 'Bugsnag-' headers for //API key, payload version, and the time at which the request is being sent.
[ "PrefixedHeaders", "returns", "a", "map", "of", "Content", "-", "Type", "and", "the", "Bugsnag", "-", "headers", "for", "API", "key", "payload", "version", "and", "the", "time", "at", "which", "the", "request", "is", "being", "sent", "." ]
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/headers/prefixed.go#L7-L14
19,012
bugsnag/bugsnag-go
middleware.go
OnBeforeNotify
func (stack *middlewareStack) OnBeforeNotify(middleware beforeFunc) { stack.before = append(stack.before, middleware) }
go
func (stack *middlewareStack) OnBeforeNotify(middleware beforeFunc) { stack.before = append(stack.before, middleware) }
[ "func", "(", "stack", "*", "middlewareStack", ")", "OnBeforeNotify", "(", "middleware", "beforeFunc", ")", "{", "stack", ".", "before", "=", "append", "(", "stack", ".", "before", ",", "middleware", ")", "\n", "}" ]
// AddMiddleware adds a new middleware to the outside of the existing ones, // when the middlewareStack is Run it will be run before all middleware that // have been added before.
[ "AddMiddleware", "adds", "a", "new", "middleware", "to", "the", "outside", "of", "the", "existing", "ones", "when", "the", "middlewareStack", "is", "Run", "it", "will", "be", "run", "before", "all", "middleware", "that", "have", "been", "added", "before", "....
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/middleware.go#L21-L23
19,013
bugsnag/bugsnag-go
middleware.go
Run
func (stack *middlewareStack) Run(event *Event, config *Configuration, next func() error) error { // run all the before filters in reverse order for i := range stack.before { before := stack.before[len(stack.before)-i-1] severity := event.Severity err := stack.runBeforeFilter(before, event, config) if err != nil { return err } if event.Severity != severity { event.handledState.SeverityReason = SeverityReasonCallbackSpecified } } return next() }
go
func (stack *middlewareStack) Run(event *Event, config *Configuration, next func() error) error { // run all the before filters in reverse order for i := range stack.before { before := stack.before[len(stack.before)-i-1] severity := event.Severity err := stack.runBeforeFilter(before, event, config) if err != nil { return err } if event.Severity != severity { event.handledState.SeverityReason = SeverityReasonCallbackSpecified } } return next() }
[ "func", "(", "stack", "*", "middlewareStack", ")", "Run", "(", "event", "*", "Event", ",", "config", "*", "Configuration", ",", "next", "func", "(", ")", "error", ")", "error", "{", "// run all the before filters in reverse order", "for", "i", ":=", "range", ...
// Run causes all the middleware to be run. If they all permit it the next callback // will be called with all the middleware on the stack.
[ "Run", "causes", "all", "the", "middleware", "to", "be", "run", ".", "If", "they", "all", "permit", "it", "the", "next", "callback", "will", "be", "called", "with", "all", "the", "middleware", "on", "the", "stack", "." ]
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/middleware.go#L27-L43
19,014
bugsnag/bugsnag-go
middleware.go
httpRequestMiddleware
func httpRequestMiddleware(event *Event, config *Configuration) error { for _, datum := range event.RawData { if request, ok := datum.(*http.Request); ok { event.MetaData.Update(MetaData{ "request": { "params": request.URL.Query(), }, }) } } return nil }
go
func httpRequestMiddleware(event *Event, config *Configuration) error { for _, datum := range event.RawData { if request, ok := datum.(*http.Request); ok { event.MetaData.Update(MetaData{ "request": { "params": request.URL.Query(), }, }) } } return nil }
[ "func", "httpRequestMiddleware", "(", "event", "*", "Event", ",", "config", "*", "Configuration", ")", "error", "{", "for", "_", ",", "datum", ":=", "range", "event", ".", "RawData", "{", "if", "request", ",", "ok", ":=", "datum", ".", "(", "*", "http"...
// httpRequestMiddleware is added OnBeforeNotify by default. It takes information // from an http.Request passed in as rawData, and adds it to the Event. You can // use this as a template for writing your own Middleware.
[ "httpRequestMiddleware", "is", "added", "OnBeforeNotify", "by", "default", ".", "It", "takes", "information", "from", "an", "http", ".", "Request", "passed", "in", "as", "rawData", "and", "adds", "it", "to", "the", "Event", ".", "You", "can", "use", "this", ...
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/middleware.go#L63-L74
19,015
bugsnag/bugsnag-go
negroni/bugsnagnegroni.go
AutoNotify
func AutoNotify(rawData ...interface{}) negroni.Handler { updateGlobalConfig(rawData...) state := bugsnag.HandledState{ SeverityReason: bugsnag.SeverityReasonUnhandledMiddlewareError, OriginalSeverity: bugsnag.SeverityError, Unhandled: true, Framework: FrameworkName, } rawData = append(rawData, state) return &handler{rawData: rawData} }
go
func AutoNotify(rawData ...interface{}) negroni.Handler { updateGlobalConfig(rawData...) state := bugsnag.HandledState{ SeverityReason: bugsnag.SeverityReasonUnhandledMiddlewareError, OriginalSeverity: bugsnag.SeverityError, Unhandled: true, Framework: FrameworkName, } rawData = append(rawData, state) return &handler{rawData: rawData} }
[ "func", "AutoNotify", "(", "rawData", "...", "interface", "{", "}", ")", "negroni", ".", "Handler", "{", "updateGlobalConfig", "(", "rawData", "...", ")", "\n", "state", ":=", "bugsnag", ".", "HandledState", "{", "SeverityReason", ":", "bugsnag", ".", "Sever...
// AutoNotify sends any panics to bugsnag, and then re-raises them.
[ "AutoNotify", "sends", "any", "panics", "to", "bugsnag", "and", "then", "re", "-", "raises", "them", "." ]
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/negroni/bugsnagnegroni.go#L18-L28
19,016
bugsnag/bugsnag-go
sessions/publisher.go
publish
func (p *publisher) publish(sessions []*Session) error { if p.config.Endpoint == "" { // Session tracking is disabled, likely because the notify endpoint was // changed without changing the sessions endpoint // We've already logged a warning in this case, so no need to spam the // log every minute return nil } if apiKey := p.config.APIKey; len(apiKey) != 32 { return fmt.Errorf("bugsnag/sessions/publisher.publish invalid API key: '%s'", apiKey) } nrs, rs := p.config.NotifyReleaseStages, p.config.ReleaseStage if rs != "" && (nrs != nil && !contains(nrs, rs)) { // Always send sessions if the release stage is not set, but don't send any // sessions when notify release stages don't match the current release stage return nil } if len(sessions) == 0 { return fmt.Errorf("bugsnag/sessions/publisher.publish requested publication of 0") } p.config.mutex.Lock() defer p.config.mutex.Unlock() payload := makeSessionPayload(sessions, p.config) buf, err := json.Marshal(payload) if err != nil { return fmt.Errorf("bugsnag/sessions/publisher.publish unable to marshal json: %v", err) } req, err := http.NewRequest("POST", p.config.Endpoint, bytes.NewBuffer(buf)) if err != nil { return fmt.Errorf("bugsnag/sessions/publisher.publish unable to create request: %v", err) } for k, v := range headers.PrefixedHeaders(p.config.APIKey, sessionPayloadVersion) { req.Header.Add(k, v) } res, err := p.client.Do(req) if err != nil { return fmt.Errorf("bugsnag/sessions/publisher.publish unable to deliver session: %v", err) } defer func(res *http.Response) { if err := res.Body.Close(); err != nil { p.config.logf("%v", err) } }(res) if res.StatusCode != 202 { return fmt.Errorf("bugsnag/session.publish expected 202 response status, got HTTP %s", res.Status) } return nil }
go
func (p *publisher) publish(sessions []*Session) error { if p.config.Endpoint == "" { // Session tracking is disabled, likely because the notify endpoint was // changed without changing the sessions endpoint // We've already logged a warning in this case, so no need to spam the // log every minute return nil } if apiKey := p.config.APIKey; len(apiKey) != 32 { return fmt.Errorf("bugsnag/sessions/publisher.publish invalid API key: '%s'", apiKey) } nrs, rs := p.config.NotifyReleaseStages, p.config.ReleaseStage if rs != "" && (nrs != nil && !contains(nrs, rs)) { // Always send sessions if the release stage is not set, but don't send any // sessions when notify release stages don't match the current release stage return nil } if len(sessions) == 0 { return fmt.Errorf("bugsnag/sessions/publisher.publish requested publication of 0") } p.config.mutex.Lock() defer p.config.mutex.Unlock() payload := makeSessionPayload(sessions, p.config) buf, err := json.Marshal(payload) if err != nil { return fmt.Errorf("bugsnag/sessions/publisher.publish unable to marshal json: %v", err) } req, err := http.NewRequest("POST", p.config.Endpoint, bytes.NewBuffer(buf)) if err != nil { return fmt.Errorf("bugsnag/sessions/publisher.publish unable to create request: %v", err) } for k, v := range headers.PrefixedHeaders(p.config.APIKey, sessionPayloadVersion) { req.Header.Add(k, v) } res, err := p.client.Do(req) if err != nil { return fmt.Errorf("bugsnag/sessions/publisher.publish unable to deliver session: %v", err) } defer func(res *http.Response) { if err := res.Body.Close(); err != nil { p.config.logf("%v", err) } }(res) if res.StatusCode != 202 { return fmt.Errorf("bugsnag/session.publish expected 202 response status, got HTTP %s", res.Status) } return nil }
[ "func", "(", "p", "*", "publisher", ")", "publish", "(", "sessions", "[", "]", "*", "Session", ")", "error", "{", "if", "p", ".", "config", ".", "Endpoint", "==", "\"", "\"", "{", "// Session tracking is disabled, likely because the notify endpoint was", "// cha...
// publish builds a payload from the given sessions and publishes them to the // session server. Returns any errors that happened as part of publishing.
[ "publish", "builds", "a", "payload", "from", "the", "given", "sessions", "and", "publishes", "them", "to", "the", "session", "server", ".", "Returns", "any", "errors", "that", "happened", "as", "part", "of", "publishing", "." ]
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/sessions/publisher.go#L31-L78
19,017
bugsnag/bugsnag-go
sessions/startup.go
SendStartupSession
func SendStartupSession(config *SessionTrackingConfiguration) context.Context { ctx := context.Background() session := newSession() if !config.IsAutoCaptureSessions() || isApplicationProcess() { return ctx } publisher := &publisher{ config: config, client: &http.Client{Transport: config.Transport}, } go publisher.publish([]*Session{session}) return context.WithValue(ctx, contextSessionKey, session) }
go
func SendStartupSession(config *SessionTrackingConfiguration) context.Context { ctx := context.Background() session := newSession() if !config.IsAutoCaptureSessions() || isApplicationProcess() { return ctx } publisher := &publisher{ config: config, client: &http.Client{Transport: config.Transport}, } go publisher.publish([]*Session{session}) return context.WithValue(ctx, contextSessionKey, session) }
[ "func", "SendStartupSession", "(", "config", "*", "SessionTrackingConfiguration", ")", "context", ".", "Context", "{", "ctx", ":=", "context", ".", "Background", "(", ")", "\n", "session", ":=", "newSession", "(", ")", "\n", "if", "!", "config", ".", "IsAuto...
// SendStartupSession is called by Bugsnag on startup, which will send a // session to Bugsnag and return a context to represent the session of the main // goroutine. This is the session associated with any fatal panics that are // caught by panicwrap.
[ "SendStartupSession", "is", "called", "by", "Bugsnag", "on", "startup", "which", "will", "send", "a", "session", "to", "Bugsnag", "and", "return", "a", "context", "to", "represent", "the", "session", "of", "the", "main", "goroutine", ".", "This", "is", "the"...
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/sessions/startup.go#L15-L27
19,018
bugsnag/bugsnag-go
metadata.go
Update
func (meta MetaData) Update(other MetaData) { for name, tab := range other { if meta[name] == nil { meta[name] = make(map[string]interface{}) } for key, value := range tab { meta[name][key] = value } } }
go
func (meta MetaData) Update(other MetaData) { for name, tab := range other { if meta[name] == nil { meta[name] = make(map[string]interface{}) } for key, value := range tab { meta[name][key] = value } } }
[ "func", "(", "meta", "MetaData", ")", "Update", "(", "other", "MetaData", ")", "{", "for", "name", ",", "tab", ":=", "range", "other", "{", "if", "meta", "[", "name", "]", "==", "nil", "{", "meta", "[", "name", "]", "=", "make", "(", "map", "[", ...
// Update the meta-data with more information. Tabs are merged together such // that unique keys from both sides are preserved, and duplicate keys end up // with the provided values.
[ "Update", "the", "meta", "-", "data", "with", "more", "information", ".", "Tabs", "are", "merged", "together", "such", "that", "unique", "keys", "from", "both", "sides", "are", "preserved", "and", "duplicate", "keys", "end", "up", "with", "the", "provided", ...
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/metadata.go#L17-L28
19,019
bugsnag/bugsnag-go
metadata.go
Add
func (meta MetaData) Add(tab string, key string, value interface{}) { if meta[tab] == nil { meta[tab] = make(map[string]interface{}) } meta[tab][key] = value }
go
func (meta MetaData) Add(tab string, key string, value interface{}) { if meta[tab] == nil { meta[tab] = make(map[string]interface{}) } meta[tab][key] = value }
[ "func", "(", "meta", "MetaData", ")", "Add", "(", "tab", "string", ",", "key", "string", ",", "value", "interface", "{", "}", ")", "{", "if", "meta", "[", "tab", "]", "==", "nil", "{", "meta", "[", "tab", "]", "=", "make", "(", "map", "[", "str...
// Add creates a tab of Bugsnag meta-data. // If the tab doesn't yet exist it will be created. // If the key already exists, it will be overwritten.
[ "Add", "creates", "a", "tab", "of", "Bugsnag", "meta", "-", "data", ".", "If", "the", "tab", "doesn", "t", "yet", "exist", "it", "will", "be", "created", ".", "If", "the", "key", "already", "exists", "it", "will", "be", "overwritten", "." ]
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/metadata.go#L33-L39
19,020
bugsnag/bugsnag-go
metadata.go
AddStruct
func (meta MetaData) AddStruct(tab string, obj interface{}) { val := sanitizer{}.Sanitize(obj) content, ok := val.(map[string]interface{}) if ok { meta[tab] = content } else { // Wasn't a struct meta.Add("Extra data", tab, obj) } }
go
func (meta MetaData) AddStruct(tab string, obj interface{}) { val := sanitizer{}.Sanitize(obj) content, ok := val.(map[string]interface{}) if ok { meta[tab] = content } else { // Wasn't a struct meta.Add("Extra data", tab, obj) } }
[ "func", "(", "meta", "MetaData", ")", "AddStruct", "(", "tab", "string", ",", "obj", "interface", "{", "}", ")", "{", "val", ":=", "sanitizer", "{", "}", ".", "Sanitize", "(", "obj", ")", "\n", "content", ",", "ok", ":=", "val", ".", "(", "map", ...
// AddStruct creates a tab of Bugsnag meta-data. // The struct will be converted to an Object using the // reflect library so any private fields will not be exported. // As a safety measure, if you pass a non-struct the value will be // sent to Bugsnag under the "Extra data" tab.
[ "AddStruct", "creates", "a", "tab", "of", "Bugsnag", "meta", "-", "data", ".", "The", "struct", "will", "be", "converted", "to", "an", "Object", "using", "the", "reflect", "library", "so", "any", "private", "fields", "will", "not", "be", "exported", ".", ...
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/metadata.go#L46-L56
19,021
bugsnag/bugsnag-go
metadata.go
sanitize
func (meta MetaData) sanitize(filters []string) interface{} { return sanitizer{ Filters: filters, Seen: make([]interface{}, 0), }.Sanitize(meta) }
go
func (meta MetaData) sanitize(filters []string) interface{} { return sanitizer{ Filters: filters, Seen: make([]interface{}, 0), }.Sanitize(meta) }
[ "func", "(", "meta", "MetaData", ")", "sanitize", "(", "filters", "[", "]", "string", ")", "interface", "{", "}", "{", "return", "sanitizer", "{", "Filters", ":", "filters", ",", "Seen", ":", "make", "(", "[", "]", "interface", "{", "}", ",", "0", ...
// Remove any values from meta-data that have keys matching the filters, // and any that are recursive data-structures
[ "Remove", "any", "values", "from", "meta", "-", "data", "that", "have", "keys", "matching", "the", "filters", "and", "any", "that", "are", "recursive", "data", "-", "structures" ]
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/metadata.go#L60-L66
19,022
bugsnag/bugsnag-go
features/fixtures/net_http/main.go
recoverWrap
func recoverWrap(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { defer func() { r := recover() if r != nil { http.Error(w, "", http.StatusInternalServerError) } }() h.ServeHTTP(w, r) }) }
go
func recoverWrap(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { defer func() { r := recover() if r != nil { http.Error(w, "", http.StatusInternalServerError) } }() h.ServeHTTP(w, r) }) }
[ "func", "recoverWrap", "(", "h", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "defer", "func", "...
// Simple wrapper to send internal server error on panics
[ "Simple", "wrapper", "to", "send", "internal", "server", "error", "on", "panics" ]
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/features/fixtures/net_http/main.go#L31-L41
19,023
bugsnag/bugsnag-go
request_extractor.go
AttachRequestData
func AttachRequestData(ctx context.Context, r *http.Request) context.Context { return context.WithValue(ctx, requestContextKey, r) }
go
func AttachRequestData(ctx context.Context, r *http.Request) context.Context { return context.WithValue(ctx, requestContextKey, r) }
[ "func", "AttachRequestData", "(", "ctx", "context", ".", "Context", ",", "r", "*", "http", ".", "Request", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "requestContextKey", ",", "r", ")", "\n", "}" ]
// AttachRequestData returns a child of the given context with the request // object attached for later extraction by the notifier in order to // automatically record request data
[ "AttachRequestData", "returns", "a", "child", "of", "the", "given", "context", "with", "the", "request", "object", "attached", "for", "later", "extraction", "by", "the", "notifier", "in", "order", "to", "automatically", "record", "request", "data" ]
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/request_extractor.go#L16-L18
19,024
bugsnag/bugsnag-go
request_extractor.go
extractRequestInfo
func extractRequestInfo(ctx context.Context) (*RequestJSON, *http.Request) { if req := getRequestIfPresent(ctx); req != nil { return extractRequestInfoFromReq(req), req } return nil, nil }
go
func extractRequestInfo(ctx context.Context) (*RequestJSON, *http.Request) { if req := getRequestIfPresent(ctx); req != nil { return extractRequestInfoFromReq(req), req } return nil, nil }
[ "func", "extractRequestInfo", "(", "ctx", "context", ".", "Context", ")", "(", "*", "RequestJSON", ",", "*", "http", ".", "Request", ")", "{", "if", "req", ":=", "getRequestIfPresent", "(", "ctx", ")", ";", "req", "!=", "nil", "{", "return", "extractRequ...
// extractRequestInfo looks for the request object that the notifier // automatically attaches to the context when using any of the supported // frameworks or bugsnag.HandlerFunc or bugsnag.Handler, and returns sub-object // supported by the notify API.
[ "extractRequestInfo", "looks", "for", "the", "request", "object", "that", "the", "notifier", "automatically", "attaches", "to", "the", "context", "when", "using", "any", "of", "the", "supported", "frameworks", "or", "bugsnag", ".", "HandlerFunc", "or", "bugsnag", ...
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/request_extractor.go#L24-L29
19,025
bugsnag/bugsnag-go
request_extractor.go
extractRequestInfoFromReq
func extractRequestInfoFromReq(req *http.Request) *RequestJSON { proto := "http://" if req.TLS != nil { proto = "https://" } return &RequestJSON{ ClientIP: req.RemoteAddr, HTTPMethod: req.Method, URL: proto + req.Host + req.RequestURI, Referer: req.Referer(), Headers: parseRequestHeaders(req.Header), } }
go
func extractRequestInfoFromReq(req *http.Request) *RequestJSON { proto := "http://" if req.TLS != nil { proto = "https://" } return &RequestJSON{ ClientIP: req.RemoteAddr, HTTPMethod: req.Method, URL: proto + req.Host + req.RequestURI, Referer: req.Referer(), Headers: parseRequestHeaders(req.Header), } }
[ "func", "extractRequestInfoFromReq", "(", "req", "*", "http", ".", "Request", ")", "*", "RequestJSON", "{", "proto", ":=", "\"", "\"", "\n", "if", "req", ".", "TLS", "!=", "nil", "{", "proto", "=", "\"", "\"", "\n", "}", "\n", "return", "&", "Request...
// extractRequestInfoFromReq extracts the request information the notify API // understands from the given HTTP request. Returns the sub-object supported by // the notify API.
[ "extractRequestInfoFromReq", "extracts", "the", "request", "information", "the", "notify", "API", "understands", "from", "the", "given", "HTTP", "request", ".", "Returns", "the", "sub", "-", "object", "supported", "by", "the", "notify", "API", "." ]
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/request_extractor.go#L34-L46
19,026
bugsnag/bugsnag-go
notifier.go
New
func New(rawData ...interface{}) *Notifier { config := Config.clone() for i, datum := range rawData { if c, ok := datum.(Configuration); ok { config.update(&c) rawData[i] = nil } } return &Notifier{ Config: config, RawData: rawData, } }
go
func New(rawData ...interface{}) *Notifier { config := Config.clone() for i, datum := range rawData { if c, ok := datum.(Configuration); ok { config.update(&c) rawData[i] = nil } } return &Notifier{ Config: config, RawData: rawData, } }
[ "func", "New", "(", "rawData", "...", "interface", "{", "}", ")", "*", "Notifier", "{", "config", ":=", "Config", ".", "clone", "(", ")", "\n", "for", "i", ",", "datum", ":=", "range", "rawData", "{", "if", "c", ",", "ok", ":=", "datum", ".", "("...
// New creates a new notifier. // You can pass an instance of bugsnag.Configuration in rawData to change the configuration. // Other values of rawData will be passed to Notify.
[ "New", "creates", "a", "new", "notifier", ".", "You", "can", "pass", "an", "instance", "of", "bugsnag", ".", "Configuration", "in", "rawData", "to", "change", "the", "configuration", ".", "Other", "values", "of", "rawData", "will", "be", "passed", "to", "N...
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/notifier.go#L18-L31
19,027
bugsnag/bugsnag-go
notifier.go
getDefaultSeverity
func (notifier *Notifier) getDefaultSeverity(rawData []interface{}, s severity) severity { allData := append(notifier.RawData, rawData...) for _, datum := range allData { if _, ok := datum.(severity); ok { return datum.(severity) } } for _, datum := range allData { if _, ok := datum.(HandledState); ok { return datum.(HandledState).OriginalSeverity } } return s }
go
func (notifier *Notifier) getDefaultSeverity(rawData []interface{}, s severity) severity { allData := append(notifier.RawData, rawData...) for _, datum := range allData { if _, ok := datum.(severity); ok { return datum.(severity) } } for _, datum := range allData { if _, ok := datum.(HandledState); ok { return datum.(HandledState).OriginalSeverity } } return s }
[ "func", "(", "notifier", "*", "Notifier", ")", "getDefaultSeverity", "(", "rawData", "[", "]", "interface", "{", "}", ",", "s", "severity", ")", "severity", "{", "allData", ":=", "append", "(", "notifier", ".", "RawData", ",", "rawData", "...", ")", "\n"...
// Get defined severity from raw data or a fallback value
[ "Get", "defined", "severity", "from", "raw", "data", "or", "a", "fallback", "value" ]
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/notifier.go#L125-L140
19,028
bugsnag/bugsnag-go
sessions/config.go
Update
func (c *SessionTrackingConfiguration) Update(config *SessionTrackingConfiguration) { c.mutex.Lock() defer c.mutex.Unlock() if config.PublishInterval != 0 { c.PublishInterval = config.PublishInterval } if config.APIKey != "" { c.APIKey = config.APIKey } if config.Endpoint != "" { c.Endpoint = config.Endpoint } if config.Version != "" { c.Version = config.Version } if config.ReleaseStage != "" { c.ReleaseStage = config.ReleaseStage } if config.Hostname != "" { c.Hostname = config.Hostname } if config.AppType != "" { c.AppType = config.AppType } if config.AppVersion != "" { c.AppVersion = config.AppVersion } if config.Transport != nil { c.Transport = config.Transport } if config.Logger != nil { c.Logger = config.Logger } if config.NotifyReleaseStages != nil { c.NotifyReleaseStages = config.NotifyReleaseStages } if config.AutoCaptureSessions != nil { c.AutoCaptureSessions = config.AutoCaptureSessions } }
go
func (c *SessionTrackingConfiguration) Update(config *SessionTrackingConfiguration) { c.mutex.Lock() defer c.mutex.Unlock() if config.PublishInterval != 0 { c.PublishInterval = config.PublishInterval } if config.APIKey != "" { c.APIKey = config.APIKey } if config.Endpoint != "" { c.Endpoint = config.Endpoint } if config.Version != "" { c.Version = config.Version } if config.ReleaseStage != "" { c.ReleaseStage = config.ReleaseStage } if config.Hostname != "" { c.Hostname = config.Hostname } if config.AppType != "" { c.AppType = config.AppType } if config.AppVersion != "" { c.AppVersion = config.AppVersion } if config.Transport != nil { c.Transport = config.Transport } if config.Logger != nil { c.Logger = config.Logger } if config.NotifyReleaseStages != nil { c.NotifyReleaseStages = config.NotifyReleaseStages } if config.AutoCaptureSessions != nil { c.AutoCaptureSessions = config.AutoCaptureSessions } }
[ "func", "(", "c", "*", "SessionTrackingConfiguration", ")", "Update", "(", "config", "*", "SessionTrackingConfiguration", ")", "{", "c", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mutex", ".", "Unlock", "(", ")", "\n", "if", "config",...
// Update modifies the values inside the receiver to match the non-default properties of the given config. // Existing properties will not be cleared when given empty fields.
[ "Update", "modifies", "the", "values", "inside", "the", "receiver", "to", "match", "the", "non", "-", "default", "properties", "of", "the", "given", "config", ".", "Existing", "properties", "will", "not", "be", "cleared", "when", "given", "empty", "fields", ...
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/sessions/config.go#L65-L104
19,029
bugsnag/bugsnag-go
errors/stackframe.go
NewStackFrame
func NewStackFrame(pc uintptr) (frame StackFrame) { frame = StackFrame{ProgramCounter: pc} if frame.Func() == nil { return } frame.Package, frame.Name = packageAndName(frame.Func()) // pc -1 because the program counters we use are usually return addresses, // and we want to show the line that corresponds to the function call frame.File, frame.LineNumber = frame.Func().FileLine(pc - 1) return }
go
func NewStackFrame(pc uintptr) (frame StackFrame) { frame = StackFrame{ProgramCounter: pc} if frame.Func() == nil { return } frame.Package, frame.Name = packageAndName(frame.Func()) // pc -1 because the program counters we use are usually return addresses, // and we want to show the line that corresponds to the function call frame.File, frame.LineNumber = frame.Func().FileLine(pc - 1) return }
[ "func", "NewStackFrame", "(", "pc", "uintptr", ")", "(", "frame", "StackFrame", ")", "{", "frame", "=", "StackFrame", "{", "ProgramCounter", ":", "pc", "}", "\n", "if", "frame", ".", "Func", "(", ")", "==", "nil", "{", "return", "\n", "}", "\n", "fra...
// NewStackFrame popoulates a stack frame object from the program counter.
[ "NewStackFrame", "popoulates", "a", "stack", "frame", "object", "from", "the", "program", "counter", "." ]
f13f7c670be1c2f2799481ca164a3e81d36e138f
https://github.com/bugsnag/bugsnag-go/blob/f13f7c670be1c2f2799481ca164a3e81d36e138f/errors/stackframe.go#L22-L35
19,030
francoispqt/gojay
encode_number_uint.go
EncodeUint64
func (enc *Encoder) EncodeUint64(n uint64) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeUint64(n) _, err := enc.Write() if err != nil { return err } return nil }
go
func (enc *Encoder) EncodeUint64(n uint64) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeUint64(n) _, err := enc.Write() if err != nil { return err } return nil }
[ "func", "(", "enc", "*", "Encoder", ")", "EncodeUint64", "(", "n", "uint64", ")", "error", "{", "if", "enc", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledEncoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "_", ",", "_", ...
// EncodeUint64 encodes an int64 to JSON
[ "EncodeUint64", "encodes", "an", "int64", "to", "JSON" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_uint.go#L6-L16
19,031
francoispqt/gojay
encode_number_uint.go
encodeUint64
func (enc *Encoder) encodeUint64(n uint64) ([]byte, error) { enc.buf = strconv.AppendUint(enc.buf, n, 10) return enc.buf, nil }
go
func (enc *Encoder) encodeUint64(n uint64) ([]byte, error) { enc.buf = strconv.AppendUint(enc.buf, n, 10) return enc.buf, nil }
[ "func", "(", "enc", "*", "Encoder", ")", "encodeUint64", "(", "n", "uint64", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "enc", ".", "buf", "=", "strconv", ".", "AppendUint", "(", "enc", ".", "buf", ",", "n", ",", "10", ")", "\n", "retu...
// encodeUint64 encodes an int to JSON
[ "encodeUint64", "encodes", "an", "int", "to", "JSON" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_number_uint.go#L19-L22
19,032
francoispqt/gojay
encode_number_uint.go
AddUint64Key
func (enc *Encoder) AddUint64Key(key string, v uint64) { enc.Uint64Key(key, v) }
go
func (enc *Encoder) AddUint64Key(key string, v uint64) { enc.Uint64Key(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddUint64Key", "(", "key", "string", ",", "v", "uint64", ")", "{", "enc", ".", "Uint64Key", "(", "key", ",", "v", ")", "\n", "}" ]
// AddUint64Key adds an int to be encoded, must be used inside an object as it will encode a key
[ "AddUint64Key", "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_uint.go#L81-L83
19,033
francoispqt/gojay
encode_number_uint.go
AddUint64KeyOmitEmpty
func (enc *Encoder) AddUint64KeyOmitEmpty(key string, v uint64) { enc.Uint64KeyOmitEmpty(key, v) }
go
func (enc *Encoder) AddUint64KeyOmitEmpty(key string, v uint64) { enc.Uint64KeyOmitEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddUint64KeyOmitEmpty", "(", "key", "string", ",", "v", "uint64", ")", "{", "enc", ".", "Uint64KeyOmitEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddUint64KeyOmitEmpty 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.
[ "AddUint64KeyOmitEmpty", "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_uint.go#L87-L89
19,034
francoispqt/gojay
encode_number_uint.go
AddUint64KeyNullEmpty
func (enc *Encoder) AddUint64KeyNullEmpty(key string, v uint64) { enc.Uint64KeyNullEmpty(key, v) }
go
func (enc *Encoder) AddUint64KeyNullEmpty(key string, v uint64) { enc.Uint64KeyNullEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddUint64KeyNullEmpty", "(", "key", "string", ",", "v", "uint64", ")", "{", "enc", ".", "Uint64KeyNullEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddUint64KeyNullEmpty 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.
[ "AddUint64KeyNullEmpty", "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_uint.go#L93-L95
19,035
francoispqt/gojay
encode_number_uint.go
Uint64Key
func (enc *Encoder) Uint64Key(key string, v uint64) { 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.AppendUint(enc.buf, v, 10) }
go
func (enc *Encoder) Uint64Key(key string, v uint64) { 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.AppendUint(enc.buf, v, 10) }
[ "func", "(", "enc", "*", "Encoder", ")", "Uint64Key", "(", "key", "string", ",", "v", "uint64", ")", "{", "if", "enc", ".", "hasKeys", "{", "if", "!", "enc", ".", "keyExists", "(", "key", ")", "{", "return", "\n", "}", "\n", "}", "\n", "enc", "...
// Uint64Key adds an int to be encoded, must be used inside an object as it will encode a key
[ "Uint64Key", "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_uint.go#L98-L113
19,036
francoispqt/gojay
encode_number_uint.go
AddUint32Key
func (enc *Encoder) AddUint32Key(key string, v uint32) { enc.Uint64Key(key, uint64(v)) }
go
func (enc *Encoder) AddUint32Key(key string, v uint32) { enc.Uint64Key(key, uint64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddUint32Key", "(", "key", "string", ",", "v", "uint32", ")", "{", "enc", ".", "Uint64Key", "(", "key", ",", "uint64", "(", "v", ")", ")", "\n", "}" ]
// AddUint32Key adds an int to be encoded, must be used inside an object as it will encode a key
[ "AddUint32Key", "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_uint.go#L195-L197
19,037
francoispqt/gojay
encode_number_uint.go
AddUint32KeyOmitEmpty
func (enc *Encoder) AddUint32KeyOmitEmpty(key string, v uint32) { enc.Uint64KeyOmitEmpty(key, uint64(v)) }
go
func (enc *Encoder) AddUint32KeyOmitEmpty(key string, v uint32) { enc.Uint64KeyOmitEmpty(key, uint64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddUint32KeyOmitEmpty", "(", "key", "string", ",", "v", "uint32", ")", "{", "enc", ".", "Uint64KeyOmitEmpty", "(", "key", ",", "uint64", "(", "v", ")", ")", "\n", "}" ]
// AddUint32KeyOmitEmpty 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.
[ "AddUint32KeyOmitEmpty", "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_uint.go#L201-L203
19,038
francoispqt/gojay
encode_number_uint.go
AddUint32KeyNullEmpty
func (enc *Encoder) AddUint32KeyNullEmpty(key string, v uint32) { enc.Uint64KeyNullEmpty(key, uint64(v)) }
go
func (enc *Encoder) AddUint32KeyNullEmpty(key string, v uint32) { enc.Uint64KeyNullEmpty(key, uint64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddUint32KeyNullEmpty", "(", "key", "string", ",", "v", "uint32", ")", "{", "enc", ".", "Uint64KeyNullEmpty", "(", "key", ",", "uint64", "(", "v", ")", ")", "\n", "}" ]
// AddUint32KeyNullEmpty 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.
[ "AddUint32KeyNullEmpty", "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_uint.go#L207-L209
19,039
francoispqt/gojay
encode_number_uint.go
Uint16Key
func (enc *Encoder) Uint16Key(key string, v uint16) { enc.Uint64Key(key, uint64(v)) }
go
func (enc *Encoder) Uint16Key(key string, v uint16) { enc.Uint64Key(key, uint64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "Uint16Key", "(", "key", "string", ",", "v", "uint16", ")", "{", "enc", ".", "Uint64Key", "(", "key", ",", "uint64", "(", "v", ")", ")", "\n", "}" ]
// Uint16Key adds an int to be encoded, must be used inside an object as it will encode a key
[ "Uint16Key", "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_uint.go#L280-L282
19,040
francoispqt/gojay
encode_number_uint.go
Uint16KeyOmitEmpty
func (enc *Encoder) Uint16KeyOmitEmpty(key string, v uint16) { enc.Uint64KeyOmitEmpty(key, uint64(v)) }
go
func (enc *Encoder) Uint16KeyOmitEmpty(key string, v uint16) { enc.Uint64KeyOmitEmpty(key, uint64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "Uint16KeyOmitEmpty", "(", "key", "string", ",", "v", "uint16", ")", "{", "enc", ".", "Uint64KeyOmitEmpty", "(", "key", ",", "uint64", "(", "v", ")", ")", "\n", "}" ]
// Uint16KeyOmitEmpty 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.
[ "Uint16KeyOmitEmpty", "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_uint.go#L286-L288
19,041
francoispqt/gojay
encode_number_uint.go
Uint16KeyNullEmpty
func (enc *Encoder) Uint16KeyNullEmpty(key string, v uint16) { enc.Uint64KeyNullEmpty(key, uint64(v)) }
go
func (enc *Encoder) Uint16KeyNullEmpty(key string, v uint16) { enc.Uint64KeyNullEmpty(key, uint64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "Uint16KeyNullEmpty", "(", "key", "string", ",", "v", "uint16", ")", "{", "enc", ".", "Uint64KeyNullEmpty", "(", "key", ",", "uint64", "(", "v", ")", ")", "\n", "}" ]
// Uint16KeyNullEmpty 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.
[ "Uint16KeyNullEmpty", "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_uint.go#L292-L294
19,042
francoispqt/gojay
encode_number_uint.go
AddUint8Key
func (enc *Encoder) AddUint8Key(key string, v uint8) { enc.Uint64Key(key, uint64(v)) }
go
func (enc *Encoder) AddUint8Key(key string, v uint8) { enc.Uint64Key(key, uint64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddUint8Key", "(", "key", "string", ",", "v", "uint8", ")", "{", "enc", ".", "Uint64Key", "(", "key", ",", "uint64", "(", "v", ")", ")", "\n", "}" ]
// AddUint8Key adds an int to be encoded, must be used inside an object as it will encode a key
[ "AddUint8Key", "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_uint.go#L331-L333
19,043
francoispqt/gojay
encode_number_uint.go
AddUint8KeyOmitEmpty
func (enc *Encoder) AddUint8KeyOmitEmpty(key string, v uint8) { enc.Uint64KeyOmitEmpty(key, uint64(v)) }
go
func (enc *Encoder) AddUint8KeyOmitEmpty(key string, v uint8) { enc.Uint64KeyOmitEmpty(key, uint64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddUint8KeyOmitEmpty", "(", "key", "string", ",", "v", "uint8", ")", "{", "enc", ".", "Uint64KeyOmitEmpty", "(", "key", ",", "uint64", "(", "v", ")", ")", "\n", "}" ]
// AddUint8KeyOmitEmpty 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.
[ "AddUint8KeyOmitEmpty", "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_uint.go#L337-L339
19,044
francoispqt/gojay
encode_number_uint.go
AddUint8KeyNullEmpty
func (enc *Encoder) AddUint8KeyNullEmpty(key string, v uint8) { enc.Uint64KeyNullEmpty(key, uint64(v)) }
go
func (enc *Encoder) AddUint8KeyNullEmpty(key string, v uint8) { enc.Uint64KeyNullEmpty(key, uint64(v)) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddUint8KeyNullEmpty", "(", "key", "string", ",", "v", "uint8", ")", "{", "enc", ".", "Uint64KeyNullEmpty", "(", "key", ",", "uint64", "(", "v", ")", ")", "\n", "}" ]
// AddUint8KeyNullEmpty 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.
[ "AddUint8KeyNullEmpty", "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_uint.go#L343-L345
19,045
francoispqt/gojay
gojay/codegen/generator.go
Type
func (g *Generator) Type(typeName string) *toolbox.TypeInfo { return g.fileInfo.Type(typeName) }
go
func (g *Generator) Type(typeName string) *toolbox.TypeInfo { return g.fileInfo.Type(typeName) }
[ "func", "(", "g", "*", "Generator", ")", "Type", "(", "typeName", "string", ")", "*", "toolbox", ".", "TypeInfo", "{", "return", "g", ".", "fileInfo", ".", "Type", "(", "typeName", ")", "\n", "}" ]
// Returns the type from the the fileInfo
[ "Returns", "the", "type", "from", "the", "the", "fileInfo" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/gojay/codegen/generator.go#L34-L36
19,046
francoispqt/gojay
gojay/codegen/generator.go
init
func (g *Generator) init() { g.filedInit = []string{} g.imports = map[string]bool{} g.pooledObjects = map[string]string{} g.structTypes = map[string]string{} g.sliceTypes = map[string]string{} g.poolInit = map[string]string{} g.addImport(gojayPackage) // if we want pools, add the sync package right away if g.options.PoolObjects { g.addImport("sync") } }
go
func (g *Generator) init() { g.filedInit = []string{} g.imports = map[string]bool{} g.pooledObjects = map[string]string{} g.structTypes = map[string]string{} g.sliceTypes = map[string]string{} g.poolInit = map[string]string{} g.addImport(gojayPackage) // if we want pools, add the sync package right away if g.options.PoolObjects { g.addImport("sync") } }
[ "func", "(", "g", "*", "Generator", ")", "init", "(", ")", "{", "g", ".", "filedInit", "=", "[", "]", "string", "{", "}", "\n", "g", ".", "imports", "=", "map", "[", "string", "]", "bool", "{", "}", "\n", "g", ".", "pooledObjects", "=", "map", ...
// we initiate the variables containing the code to be generated
[ "we", "initiate", "the", "variables", "containing", "the", "code", "to", "be", "generated" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/gojay/codegen/generator.go#L44-L56
19,047
francoispqt/gojay
gojay/codegen/generator.go
NewGenerator
func NewGenerator(options *Options) *Generator { var g = &Generator{} // first we validate the flags if err := options.Validate(); err != nil { panic(err) } g.options = options // we initiate the values on the generator g.init() return g }
go
func NewGenerator(options *Options) *Generator { var g = &Generator{} // first we validate the flags if err := options.Validate(); err != nil { panic(err) } g.options = options // we initiate the values on the generator g.init() return g }
[ "func", "NewGenerator", "(", "options", "*", "Options", ")", "*", "Generator", "{", "var", "g", "=", "&", "Generator", "{", "}", "\n", "// first we validate the flags", "if", "err", ":=", "options", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{"...
// NewGenerator creates a new generator with the given options
[ "NewGenerator", "creates", "a", "new", "generator", "with", "the", "given", "options" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/gojay/codegen/generator.go#L59-L69
19,048
francoispqt/gojay
gojay/codegen/generator.go
Generate
func (g *Generator) Generate() error { // first we read the code from which we should find the types if err := g.readPackageCode(g.options.Source); err != nil { return err } // then we generate code for the types given for _, rootType := range g.options.Types { if err := g.generateStructCode(rootType); err != nil { return err } } // g.Imports = strings.Join(toolbox.MapKeysToStringSlice(g.imports), "\n") return g.writeCode() }
go
func (g *Generator) Generate() error { // first we read the code from which we should find the types if err := g.readPackageCode(g.options.Source); err != nil { return err } // then we generate code for the types given for _, rootType := range g.options.Types { if err := g.generateStructCode(rootType); err != nil { return err } } // g.Imports = strings.Join(toolbox.MapKeysToStringSlice(g.imports), "\n") return g.writeCode() }
[ "func", "(", "g", "*", "Generator", ")", "Generate", "(", ")", "error", "{", "// first we read the code from which we should find the types", "if", "err", ":=", "g", ".", "readPackageCode", "(", "g", ".", "options", ".", "Source", ")", ";", "err", "!=", "nil",...
// Generate generates the gojay implementation code
[ "Generate", "generates", "the", "gojay", "implementation", "code" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/gojay/codegen/generator.go#L72-L88
19,049
francoispqt/gojay
encode_string.go
EncodeString
func (enc *Encoder) EncodeString(s string) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeString(s) _, err := enc.Write() if err != nil { enc.err = err return err } return nil }
go
func (enc *Encoder) EncodeString(s string) error { if enc.isPooled == 1 { panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) } _, _ = enc.encodeString(s) _, err := enc.Write() if err != nil { enc.err = err return err } return nil }
[ "func", "(", "enc", "*", "Encoder", ")", "EncodeString", "(", "s", "string", ")", "error", "{", "if", "enc", ".", "isPooled", "==", "1", "{", "panic", "(", "InvalidUsagePooledEncoderError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "_", ",", "_", ...
// EncodeString encodes a string to
[ "EncodeString", "encodes", "a", "string", "to" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_string.go#L4-L15
19,050
francoispqt/gojay
encode_string.go
encodeString
func (enc *Encoder) encodeString(v string) ([]byte, error) { enc.writeByte('"') enc.writeStringEscape(v) enc.writeByte('"') return enc.buf, nil }
go
func (enc *Encoder) encodeString(v string) ([]byte, error) { enc.writeByte('"') enc.writeStringEscape(v) enc.writeByte('"') return enc.buf, nil }
[ "func", "(", "enc", "*", "Encoder", ")", "encodeString", "(", "v", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "enc", ".", "writeByte", "(", "'\"'", ")", "\n", "enc", ".", "writeStringEscape", "(", "v", ")", "\n", "enc", ".", "w...
// encodeString encodes a string to
[ "encodeString", "encodes", "a", "string", "to" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_string.go#L18-L23
19,051
francoispqt/gojay
encode_string.go
AppendString
func (enc *Encoder) AppendString(v string) { enc.grow(len(v) + 2) enc.writeByte('"') enc.writeStringEscape(v) enc.writeByte('"') }
go
func (enc *Encoder) AppendString(v string) { enc.grow(len(v) + 2) enc.writeByte('"') enc.writeStringEscape(v) enc.writeByte('"') }
[ "func", "(", "enc", "*", "Encoder", ")", "AppendString", "(", "v", "string", ")", "{", "enc", ".", "grow", "(", "len", "(", "v", ")", "+", "2", ")", "\n", "enc", ".", "writeByte", "(", "'\"'", ")", "\n", "enc", ".", "writeStringEscape", "(", "v",...
// AppendString appends a string to the buffer
[ "AppendString", "appends", "a", "string", "to", "the", "buffer" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/encode_string.go#L26-L31
19,052
francoispqt/gojay
encode_string.go
AddStringKey
func (enc *Encoder) AddStringKey(key, v string) { enc.StringKey(key, v) }
go
func (enc *Encoder) AddStringKey(key, v string) { enc.StringKey(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddStringKey", "(", "key", ",", "v", "string", ")", "{", "enc", ".", "StringKey", "(", "key", ",", "v", ")", "\n", "}" ]
// AddStringKey adds a string to be encoded, must be used inside an object as it will encode a key
[ "AddStringKey", "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_string.go#L51-L53
19,053
francoispqt/gojay
encode_string.go
AddStringKeyOmitEmpty
func (enc *Encoder) AddStringKeyOmitEmpty(key, v string) { enc.StringKeyOmitEmpty(key, v) }
go
func (enc *Encoder) AddStringKeyOmitEmpty(key, v string) { enc.StringKeyOmitEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddStringKeyOmitEmpty", "(", "key", ",", "v", "string", ")", "{", "enc", ".", "StringKeyOmitEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddStringKeyOmitEmpty 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
[ "AddStringKeyOmitEmpty", "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_string.go#L57-L59
19,054
francoispqt/gojay
encode_string.go
AddStringKeyNullEmpty
func (enc *Encoder) AddStringKeyNullEmpty(key, v string) { enc.StringKeyNullEmpty(key, v) }
go
func (enc *Encoder) AddStringKeyNullEmpty(key, v string) { enc.StringKeyNullEmpty(key, v) }
[ "func", "(", "enc", "*", "Encoder", ")", "AddStringKeyNullEmpty", "(", "key", ",", "v", "string", ")", "{", "enc", ".", "StringKeyNullEmpty", "(", "key", ",", "v", ")", "\n", "}" ]
// AddStringKeyNullEmpty 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
[ "AddStringKeyNullEmpty", "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_string.go#L63-L65
19,055
francoispqt/gojay
encode_string.go
StringKey
func (enc *Encoder) StringKey(key, v string) { if enc.hasKeys { if !enc.keyExists(key) { return } } enc.grow(len(key) + len(v) + 5) r := enc.getPreviousRune() if r != '{' { enc.writeTwoBytes(',', '"') } else { enc.writeByte('"') } enc.writeStringEscape(key) enc.writeBytes(objKeyStr) enc.writeStringEscape(v) enc.writeByte('"') }
go
func (enc *Encoder) StringKey(key, v string) { if enc.hasKeys { if !enc.keyExists(key) { return } } enc.grow(len(key) + len(v) + 5) r := enc.getPreviousRune() if r != '{' { enc.writeTwoBytes(',', '"') } else { enc.writeByte('"') } enc.writeStringEscape(key) enc.writeBytes(objKeyStr) enc.writeStringEscape(v) enc.writeByte('"') }
[ "func", "(", "enc", "*", "Encoder", ")", "StringKey", "(", "key", ",", "v", "string", ")", "{", "if", "enc", ".", "hasKeys", "{", "if", "!", "enc", ".", "keyExists", "(", "key", ")", "{", "return", "\n", "}", "\n", "}", "\n", "enc", ".", "grow"...
// StringKey adds a string to be encoded, must be used inside an object as it will encode a key
[ "StringKey", "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_string.go#L119-L136
19,056
francoispqt/gojay
encode_string.go
StringKeyNullEmpty
func (enc *Encoder) StringKeyNullEmpty(key, v string) { if enc.hasKeys { if !enc.keyExists(key) { return } } enc.grow(len(key) + len(v) + 5) r := enc.getPreviousRune() if r != '{' { enc.writeTwoBytes(',', '"') } else { enc.writeByte('"') } enc.writeStringEscape(key) enc.writeBytes(objKey) if v == "" { enc.writeBytes(nullBytes) return } enc.writeByte('"') enc.writeStringEscape(v) enc.writeByte('"') }
go
func (enc *Encoder) StringKeyNullEmpty(key, v string) { if enc.hasKeys { if !enc.keyExists(key) { return } } enc.grow(len(key) + len(v) + 5) r := enc.getPreviousRune() if r != '{' { enc.writeTwoBytes(',', '"') } else { enc.writeByte('"') } enc.writeStringEscape(key) enc.writeBytes(objKey) if v == "" { enc.writeBytes(nullBytes) return } enc.writeByte('"') enc.writeStringEscape(v) enc.writeByte('"') }
[ "func", "(", "enc", "*", "Encoder", ")", "StringKeyNullEmpty", "(", "key", ",", "v", "string", ")", "{", "if", "enc", ".", "hasKeys", "{", "if", "!", "enc", ".", "keyExists", "(", "key", ")", "{", "return", "\n", "}", "\n", "}", "\n", "enc", ".",...
// StringKeyNullEmpty 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
[ "StringKeyNullEmpty", "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_string.go#L164-L186
19,057
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", "re...
// 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
19,058
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...
//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
19,059
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", "=", ...
// 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", ...
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode.go#L14-L28
19,060
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", "=", ...
// 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", ...
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode.go#L36-L50
19,061
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", ...
// Our main function
[ "Our", "main", "function" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/examples/websocket/main.go#L65-L75
19,062
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
19,063
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", "...
// 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
19,064
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", ...
// 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",...
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_object.go#L392-L407
19,065
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", "...
// DecodeSQLNullString decodes a sql.NullString
[ "DecodeSQLNullString", "decodes", "a", "sql", ".", "NullString" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_sqlnull.go#L6-L11
19,066
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", "}"...
// DecodeSQLNullInt64 decodes a sql.NullInt64
[ "DecodeSQLNullInt64", "decodes", "a", "sql", ".", "NullInt64" ]
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_sqlnull.go#L24-L29
19,067
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", ...
// 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
19,068
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", "}", ...
// 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
19,069
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
19,070
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
19,071
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", "[", ":", ...
// 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
19,072
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", "...
// 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
19,073
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", "}", ...
// 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", ...
e46791d21b5e950e35a725e34cbee72354cc7d10
https://github.com/francoispqt/gojay/blob/e46791d21b5e950e35a725e34cbee72354cc7d10/decode_array.go#L234-L242
19,074
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", "(", "\"", "\"", ")", ...
// 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
19,075
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", "_", ",", "_", ...
// 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
19,076
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",...
// 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
19,077
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", "_", ",", "_",...
// 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
19,078
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
19,079
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
19,080
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
19,081
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
19,082
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
19,083
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
19,084
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
19,085
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
19,086
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",...
// 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
19,087
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", ...
// 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
19,088
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
19,089
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
19,090
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
19,091
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", "_", ",", "_", "=", ...
// 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
19,092
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", "_", ",", "_", "...
// 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
19,093
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"...
// 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
19,094
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
19,095
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
19,096
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
19,097
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", ".", ...
// 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
19,098
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
19,099
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