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
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
132,900
jaegertracing/jaeger-lib
metrics/multi/multi.go
Counter
func (f *Factory) Counter(options metrics.Options) metrics.Counter { counter := &counter{ counters: make([]metrics.Counter, len(f.factories)), } for i, factory := range f.factories { counter.counters[i] = factory.Counter(options) } return counter }
go
func (f *Factory) Counter(options metrics.Options) metrics.Counter { counter := &counter{ counters: make([]metrics.Counter, len(f.factories)), } for i, factory := range f.factories { counter.counters[i] = factory.Counter(options) } return counter }
[ "func", "(", "f", "*", "Factory", ")", "Counter", "(", "options", "metrics", ".", "Options", ")", "metrics", ".", "Counter", "{", "counter", ":=", "&", "counter", "{", "counters", ":", "make", "(", "[", "]", "metrics", ".", "Counter", ",", "len", "("...
// Counter implements metrics.Factory interface
[ "Counter", "implements", "metrics", ".", "Factory", "interface" ]
d036253de8f5b698150d81b922486f1e8e7628ec
https://github.com/jaegertracing/jaeger-lib/blob/d036253de8f5b698150d81b922486f1e8e7628ec/metrics/multi/multi.go#L46-L54
132,901
jaegertracing/jaeger-lib
metrics/multi/multi.go
Timer
func (f *Factory) Timer(options metrics.TimerOptions) metrics.Timer { timer := &timer{ timers: make([]metrics.Timer, len(f.factories)), } for i, factory := range f.factories { timer.timers[i] = factory.Timer(options) } return timer }
go
func (f *Factory) Timer(options metrics.TimerOptions) metrics.Timer { timer := &timer{ timers: make([]metrics.Timer, len(f.factories)), } for i, factory := range f.factories { timer.timers[i] = factory.Timer(options) } return timer }
[ "func", "(", "f", "*", "Factory", ")", "Timer", "(", "options", "metrics", ".", "TimerOptions", ")", "metrics", ".", "Timer", "{", "timer", ":=", "&", "timer", "{", "timers", ":", "make", "(", "[", "]", "metrics", ".", "Timer", ",", "len", "(", "f"...
// Timer implements metrics.Factory interface
[ "Timer", "implements", "metrics", ".", "Factory", "interface" ]
d036253de8f5b698150d81b922486f1e8e7628ec
https://github.com/jaegertracing/jaeger-lib/blob/d036253de8f5b698150d81b922486f1e8e7628ec/metrics/multi/multi.go#L67-L75
132,902
jaegertracing/jaeger-lib
metrics/multi/multi.go
Histogram
func (f *Factory) Histogram(options metrics.HistogramOptions) metrics.Histogram { histogram := &histogram{ histograms: make([]metrics.Histogram, len(f.factories)), } for i, factory := range f.factories { histogram.histograms[i] = factory.Histogram(options) } return histogram }
go
func (f *Factory) Histogram(options metrics.HistogramOptions) metrics.Histogram { histogram := &histogram{ histograms: make([]metrics.Histogram, len(f.factories)), } for i, factory := range f.factories { histogram.histograms[i] = factory.Histogram(options) } return histogram }
[ "func", "(", "f", "*", "Factory", ")", "Histogram", "(", "options", "metrics", ".", "HistogramOptions", ")", "metrics", ".", "Histogram", "{", "histogram", ":=", "&", "histogram", "{", "histograms", ":", "make", "(", "[", "]", "metrics", ".", "Histogram", ...
// Histogram implements metrics.Factory interface
[ "Histogram", "implements", "metrics", ".", "Factory", "interface" ]
d036253de8f5b698150d81b922486f1e8e7628ec
https://github.com/jaegertracing/jaeger-lib/blob/d036253de8f5b698150d81b922486f1e8e7628ec/metrics/multi/multi.go#L88-L96
132,903
jaegertracing/jaeger-lib
metrics/multi/multi.go
Gauge
func (f *Factory) Gauge(options metrics.Options) metrics.Gauge { gauge := &gauge{ gauges: make([]metrics.Gauge, len(f.factories)), } for i, factory := range f.factories { gauge.gauges[i] = factory.Gauge(options) } return gauge }
go
func (f *Factory) Gauge(options metrics.Options) metrics.Gauge { gauge := &gauge{ gauges: make([]metrics.Gauge, len(f.factories)), } for i, factory := range f.factories { gauge.gauges[i] = factory.Gauge(options) } return gauge }
[ "func", "(", "f", "*", "Factory", ")", "Gauge", "(", "options", "metrics", ".", "Options", ")", "metrics", ".", "Gauge", "{", "gauge", ":=", "&", "gauge", "{", "gauges", ":", "make", "(", "[", "]", "metrics", ".", "Gauge", ",", "len", "(", "f", "...
// Gauge implements metrics.Factory interface
[ "Gauge", "implements", "metrics", ".", "Factory", "interface" ]
d036253de8f5b698150d81b922486f1e8e7628ec
https://github.com/jaegertracing/jaeger-lib/blob/d036253de8f5b698150d81b922486f1e8e7628ec/metrics/multi/multi.go#L109-L117
132,904
jaegertracing/jaeger-lib
metrics/multi/multi.go
Namespace
func (f *Factory) Namespace(scope metrics.NSOptions) metrics.Factory { newFactory := &Factory{ factories: make([]metrics.Factory, len(f.factories)), } for i, factory := range f.factories { newFactory.factories[i] = factory.Namespace(scope) } return newFactory }
go
func (f *Factory) Namespace(scope metrics.NSOptions) metrics.Factory { newFactory := &Factory{ factories: make([]metrics.Factory, len(f.factories)), } for i, factory := range f.factories { newFactory.factories[i] = factory.Namespace(scope) } return newFactory }
[ "func", "(", "f", "*", "Factory", ")", "Namespace", "(", "scope", "metrics", ".", "NSOptions", ")", "metrics", ".", "Factory", "{", "newFactory", ":=", "&", "Factory", "{", "factories", ":", "make", "(", "[", "]", "metrics", ".", "Factory", ",", "len",...
// Namespace implements metrics.Factory interface
[ "Namespace", "implements", "metrics", ".", "Factory", "interface" ]
d036253de8f5b698150d81b922486f1e8e7628ec
https://github.com/jaegertracing/jaeger-lib/blob/d036253de8f5b698150d81b922486f1e8e7628ec/metrics/multi/multi.go#L120-L128
132,905
jaegertracing/jaeger-lib
metrics/adapters/factory.go
WrapFactoryWithTags
func WrapFactoryWithTags(f FactoryWithTags, options Options) metrics.Factory { return &factory{ Options: defaultOptions(options), factory: f, cache: newCache(), } }
go
func WrapFactoryWithTags(f FactoryWithTags, options Options) metrics.Factory { return &factory{ Options: defaultOptions(options), factory: f, cache: newCache(), } }
[ "func", "WrapFactoryWithTags", "(", "f", "FactoryWithTags", ",", "options", "Options", ")", "metrics", ".", "Factory", "{", "return", "&", "factory", "{", "Options", ":", "defaultOptions", "(", "options", ")", ",", "factory", ":", "f", ",", "cache", ":", "...
// WrapFactoryWithTags creates a real metrics.Factory that supports subscopes.
[ "WrapFactoryWithTags", "creates", "a", "real", "metrics", ".", "Factory", "that", "supports", "subscopes", "." ]
d036253de8f5b698150d81b922486f1e8e7628ec
https://github.com/jaegertracing/jaeger-lib/blob/d036253de8f5b698150d81b922486f1e8e7628ec/metrics/adapters/factory.go#L51-L57
132,906
jaegertracing/jaeger-lib
client/log/go-kit/logger.go
NewLogger
func NewLogger(kitlogger log.Logger, options ...LoggerOption) *Logger { logger := &Logger{ infoLogger: level.Info(kitlogger), errorLogger: level.Error(kitlogger), messageKey: "msg", } for _, option := range options { option(logger) } return logger }
go
func NewLogger(kitlogger log.Logger, options ...LoggerOption) *Logger { logger := &Logger{ infoLogger: level.Info(kitlogger), errorLogger: level.Error(kitlogger), messageKey: "msg", } for _, option := range options { option(logger) } return logger }
[ "func", "NewLogger", "(", "kitlogger", "log", ".", "Logger", ",", "options", "...", "LoggerOption", ")", "*", "Logger", "{", "logger", ":=", "&", "Logger", "{", "infoLogger", ":", "level", ".", "Info", "(", "kitlogger", ")", ",", "errorLogger", ":", "lev...
// NewLogger creates a new Jaeger client logger from a go-kit one.
[ "NewLogger", "creates", "a", "new", "Jaeger", "client", "logger", "from", "a", "go", "-", "kit", "one", "." ]
d036253de8f5b698150d81b922486f1e8e7628ec
https://github.com/jaegertracing/jaeger-lib/blob/d036253de8f5b698150d81b922486f1e8e7628ec/client/log/go-kit/logger.go#L41-L54
132,907
jaegertracing/jaeger-lib
metrics/expvar/factory.go
NewFactory
func NewFactory(buckets int) metrics.Factory { return adapters.WrapFactoryWithoutTags( &factory{ factory: expvar.NewFactory(buckets), }, adapters.Options{}, ) }
go
func NewFactory(buckets int) metrics.Factory { return adapters.WrapFactoryWithoutTags( &factory{ factory: expvar.NewFactory(buckets), }, adapters.Options{}, ) }
[ "func", "NewFactory", "(", "buckets", "int", ")", "metrics", ".", "Factory", "{", "return", "adapters", ".", "WrapFactoryWithoutTags", "(", "&", "factory", "{", "factory", ":", "expvar", ".", "NewFactory", "(", "buckets", ")", ",", "}", ",", "adapters", "....
// NewFactory creates a new metrics factory using go-kit expvar package. // buckets is the number of buckets to be used in histograms.
[ "NewFactory", "creates", "a", "new", "metrics", "factory", "using", "go", "-", "kit", "expvar", "package", ".", "buckets", "is", "the", "number", "of", "buckets", "to", "be", "used", "in", "histograms", "." ]
d036253de8f5b698150d81b922486f1e8e7628ec
https://github.com/jaegertracing/jaeger-lib/blob/d036253de8f5b698150d81b922486f1e8e7628ec/metrics/expvar/factory.go#L26-L33
132,908
jaegertracing/jaeger-lib
metrics/stopwatch.go
StartStopwatch
func StartStopwatch(timer Timer) Stopwatch { return Stopwatch{t: timer, start: time.Now()} }
go
func StartStopwatch(timer Timer) Stopwatch { return Stopwatch{t: timer, start: time.Now()} }
[ "func", "StartStopwatch", "(", "timer", "Timer", ")", "Stopwatch", "{", "return", "Stopwatch", "{", "t", ":", "timer", ",", "start", ":", "time", ".", "Now", "(", ")", "}", "\n", "}" ]
// StartStopwatch begins recording the executing time of an event, returning // a Stopwatch that should be used to stop the recording the time for // that event. Multiple events can be occurring simultaneously each // represented by different active Stopwatches
[ "StartStopwatch", "begins", "recording", "the", "executing", "time", "of", "an", "event", "returning", "a", "Stopwatch", "that", "should", "be", "used", "to", "stop", "the", "recording", "the", "time", "for", "that", "event", ".", "Multiple", "events", "can", ...
d036253de8f5b698150d81b922486f1e8e7628ec
https://github.com/jaegertracing/jaeger-lib/blob/d036253de8f5b698150d81b922486f1e8e7628ec/metrics/stopwatch.go#L25-L27
132,909
jaegertracing/jaeger-lib
metrics/prometheus/factory.go
WithRegisterer
func WithRegisterer(registerer prometheus.Registerer) Option { return func(opts *options) { opts.registerer = registerer } }
go
func WithRegisterer(registerer prometheus.Registerer) Option { return func(opts *options) { opts.registerer = registerer } }
[ "func", "WithRegisterer", "(", "registerer", "prometheus", ".", "Registerer", ")", "Option", "{", "return", "func", "(", "opts", "*", "options", ")", "{", "opts", ".", "registerer", "=", "registerer", "\n", "}", "\n", "}" ]
// WithRegisterer returns an option that sets the registerer. // If not used we fallback to prometheus.DefaultRegisterer.
[ "WithRegisterer", "returns", "an", "option", "that", "sets", "the", "registerer", ".", "If", "not", "used", "we", "fallback", "to", "prometheus", ".", "DefaultRegisterer", "." ]
d036253de8f5b698150d81b922486f1e8e7628ec
https://github.com/jaegertracing/jaeger-lib/blob/d036253de8f5b698150d81b922486f1e8e7628ec/metrics/prometheus/factory.go#L59-L63
132,910
jaegertracing/jaeger-lib
metrics/prometheus/factory.go
New
func New(opts ...Option) *Factory { options := applyOptions(opts) return newFactory( &Factory{ // dummy struct to be discarded cache: newVectorCache(options.registerer), buckets: options.buckets, normalizer: strings.NewReplacer(".", "_", "-", "_"), separator: options.separator, }, "", // s...
go
func New(opts ...Option) *Factory { options := applyOptions(opts) return newFactory( &Factory{ // dummy struct to be discarded cache: newVectorCache(options.registerer), buckets: options.buckets, normalizer: strings.NewReplacer(".", "_", "-", "_"), separator: options.separator, }, "", // s...
[ "func", "New", "(", "opts", "...", "Option", ")", "*", "Factory", "{", "options", ":=", "applyOptions", "(", "opts", ")", "\n", "return", "newFactory", "(", "&", "Factory", "{", "// dummy struct to be discarded", "cache", ":", "newVectorCache", "(", "options",...
// New creates a Factory backed by Prometheus registry. // Typically the first argument should be prometheus.DefaultRegisterer. // // Parameter buckets defines the buckets into which Timer observations are counted. // Each element in the slice is the upper inclusive bound of a bucket. The // values must be sorted in st...
[ "New", "creates", "a", "Factory", "backed", "by", "Prometheus", "registry", ".", "Typically", "the", "first", "argument", "should", "be", "prometheus", ".", "DefaultRegisterer", ".", "Parameter", "buckets", "defines", "the", "buckets", "into", "which", "Timer", ...
d036253de8f5b698150d81b922486f1e8e7628ec
https://github.com/jaegertracing/jaeger-lib/blob/d036253de8f5b698150d81b922486f1e8e7628ec/metrics/prometheus/factory.go#L103-L114
132,911
jaegertracing/jaeger-lib
metrics/prometheus/factory.go
Counter
func (f *Factory) Counter(options metrics.Options) metrics.Counter { help := strings.TrimSpace(options.Help) if len(help) == 0 { help = options.Name } name := counterNamingConvention(f.subScope(options.Name)) tags := f.mergeTags(options.Tags) labelNames := f.tagNames(tags) opts := prometheus.CounterOpts{ Nam...
go
func (f *Factory) Counter(options metrics.Options) metrics.Counter { help := strings.TrimSpace(options.Help) if len(help) == 0 { help = options.Name } name := counterNamingConvention(f.subScope(options.Name)) tags := f.mergeTags(options.Tags) labelNames := f.tagNames(tags) opts := prometheus.CounterOpts{ Nam...
[ "func", "(", "f", "*", "Factory", ")", "Counter", "(", "options", "metrics", ".", "Options", ")", "metrics", ".", "Counter", "{", "help", ":=", "strings", ".", "TrimSpace", "(", "options", ".", "Help", ")", "\n", "if", "len", "(", "help", ")", "==", ...
// Counter implements Counter of metrics.Factory.
[ "Counter", "implements", "Counter", "of", "metrics", ".", "Factory", "." ]
d036253de8f5b698150d81b922486f1e8e7628ec
https://github.com/jaegertracing/jaeger-lib/blob/d036253de8f5b698150d81b922486f1e8e7628ec/metrics/prometheus/factory.go#L128-L144
132,912
jaegertracing/jaeger-lib
metrics/prometheus/factory.go
Gauge
func (f *Factory) Gauge(options metrics.Options) metrics.Gauge { help := strings.TrimSpace(options.Help) if len(help) == 0 { help = options.Name } name := f.subScope(options.Name) tags := f.mergeTags(options.Tags) labelNames := f.tagNames(tags) opts := prometheus.GaugeOpts{ Name: name, Help: help, } gv :...
go
func (f *Factory) Gauge(options metrics.Options) metrics.Gauge { help := strings.TrimSpace(options.Help) if len(help) == 0 { help = options.Name } name := f.subScope(options.Name) tags := f.mergeTags(options.Tags) labelNames := f.tagNames(tags) opts := prometheus.GaugeOpts{ Name: name, Help: help, } gv :...
[ "func", "(", "f", "*", "Factory", ")", "Gauge", "(", "options", "metrics", ".", "Options", ")", "metrics", ".", "Gauge", "{", "help", ":=", "strings", ".", "TrimSpace", "(", "options", ".", "Help", ")", "\n", "if", "len", "(", "help", ")", "==", "0...
// Gauge implements Gauge of metrics.Factory.
[ "Gauge", "implements", "Gauge", "of", "metrics", ".", "Factory", "." ]
d036253de8f5b698150d81b922486f1e8e7628ec
https://github.com/jaegertracing/jaeger-lib/blob/d036253de8f5b698150d81b922486f1e8e7628ec/metrics/prometheus/factory.go#L147-L163
132,913
jaegertracing/jaeger-lib
metrics/prometheus/factory.go
Timer
func (f *Factory) Timer(options metrics.TimerOptions) metrics.Timer { help := strings.TrimSpace(options.Help) if len(help) == 0 { help = options.Name } name := f.subScope(options.Name) tags := f.mergeTags(options.Tags) labelNames := f.tagNames(tags) opts := prometheus.HistogramOpts{ Name: name, Help: ...
go
func (f *Factory) Timer(options metrics.TimerOptions) metrics.Timer { help := strings.TrimSpace(options.Help) if len(help) == 0 { help = options.Name } name := f.subScope(options.Name) tags := f.mergeTags(options.Tags) labelNames := f.tagNames(tags) opts := prometheus.HistogramOpts{ Name: name, Help: ...
[ "func", "(", "f", "*", "Factory", ")", "Timer", "(", "options", "metrics", ".", "TimerOptions", ")", "metrics", ".", "Timer", "{", "help", ":=", "strings", ".", "TrimSpace", "(", "options", ".", "Help", ")", "\n", "if", "len", "(", "help", ")", "==",...
// Timer implements Timer of metrics.Factory.
[ "Timer", "implements", "Timer", "of", "metrics", ".", "Factory", "." ]
d036253de8f5b698150d81b922486f1e8e7628ec
https://github.com/jaegertracing/jaeger-lib/blob/d036253de8f5b698150d81b922486f1e8e7628ec/metrics/prometheus/factory.go#L166-L183
132,914
jaegertracing/jaeger-lib
metrics/prometheus/factory.go
Namespace
func (f *Factory) Namespace(scope metrics.NSOptions) metrics.Factory { return newFactory(f, f.subScope(scope.Name), f.mergeTags(scope.Tags)) }
go
func (f *Factory) Namespace(scope metrics.NSOptions) metrics.Factory { return newFactory(f, f.subScope(scope.Name), f.mergeTags(scope.Tags)) }
[ "func", "(", "f", "*", "Factory", ")", "Namespace", "(", "scope", "metrics", ".", "NSOptions", ")", "metrics", ".", "Factory", "{", "return", "newFactory", "(", "f", ",", "f", ".", "subScope", "(", "scope", ".", "Name", ")", ",", "f", ".", "mergeTags...
// Namespace implements Namespace of metrics.Factory.
[ "Namespace", "implements", "Namespace", "of", "metrics", ".", "Factory", "." ]
d036253de8f5b698150d81b922486f1e8e7628ec
https://github.com/jaegertracing/jaeger-lib/blob/d036253de8f5b698150d81b922486f1e8e7628ec/metrics/prometheus/factory.go#L214-L216
132,915
terraform-providers/terraform-provider-random
random/seed.go
NewRand
func NewRand(seed string) *rand.Rand { var seedInt int64 if seed != "" { crcTable := crc64.MakeTable(crc64.ISO) seedInt = int64(crc64.Checksum([]byte(seed), crcTable)) } else { seedInt = time.Now().UnixNano() } randSource := rand.NewSource(seedInt) return rand.New(randSource) }
go
func NewRand(seed string) *rand.Rand { var seedInt int64 if seed != "" { crcTable := crc64.MakeTable(crc64.ISO) seedInt = int64(crc64.Checksum([]byte(seed), crcTable)) } else { seedInt = time.Now().UnixNano() } randSource := rand.NewSource(seedInt) return rand.New(randSource) }
[ "func", "NewRand", "(", "seed", "string", ")", "*", "rand", ".", "Rand", "{", "var", "seedInt", "int64", "\n", "if", "seed", "!=", "\"", "\"", "{", "crcTable", ":=", "crc64", ".", "MakeTable", "(", "crc64", ".", "ISO", ")", "\n", "seedInt", "=", "i...
// NewRand returns a seeded random number generator, using a seed derived // from the provided string. // // If the seed string is empty, the current time is used as a seed.
[ "NewRand", "returns", "a", "seeded", "random", "number", "generator", "using", "a", "seed", "derived", "from", "the", "provided", "string", ".", "If", "the", "seed", "string", "is", "empty", "the", "current", "time", "is", "used", "as", "a", "seed", "." ]
b26d937826325f1eca0434bb0e9c97cbf4e369d4
https://github.com/terraform-providers/terraform-provider-random/blob/b26d937826325f1eca0434bb0e9c97cbf4e369d4/random/seed.go#L13-L24
132,916
dutchcoders/goftp
ftp.go
Walk
func (ftp *FTP) Walk(path string, walkFn WalkFunc) (err error) { /* if err = walkFn(path, os.ModeDir, nil); err != nil { if err == filepath.SkipDir { return nil } } */ if ftp.debug { log.Printf("Walking: '%s'\n", path) } var lines []string if lines, err = ftp.List(path); err != nil { return }...
go
func (ftp *FTP) Walk(path string, walkFn WalkFunc) (err error) { /* if err = walkFn(path, os.ModeDir, nil); err != nil { if err == filepath.SkipDir { return nil } } */ if ftp.debug { log.Printf("Walking: '%s'\n", path) } var lines []string if lines, err = ftp.List(path); err != nil { return }...
[ "func", "(", "ftp", "*", "FTP", ")", "Walk", "(", "path", "string", ",", "walkFn", "WalkFunc", ")", "(", "err", "error", ")", "{", "/*\n\t\tif err = walkFn(path, os.ModeDir, nil); err != nil {\n\t\t\tif err == filepath.SkipDir {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t*/", "if...
// Walk walks recursively through path and call walkfunc for each file
[ "Walk", "walks", "recursively", "through", "path", "and", "call", "walkfunc", "for", "each", "file" ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L64-L102
132,917
dutchcoders/goftp
ftp.go
Quit
func (ftp *FTP) Quit() (err error) { if _, err := ftp.cmd(StatusConnectionClosing, "QUIT"); err != nil { return err } ftp.conn.Close() ftp.conn = nil return nil }
go
func (ftp *FTP) Quit() (err error) { if _, err := ftp.cmd(StatusConnectionClosing, "QUIT"); err != nil { return err } ftp.conn.Close() ftp.conn = nil return nil }
[ "func", "(", "ftp", "*", "FTP", ")", "Quit", "(", ")", "(", "err", "error", ")", "{", "if", "_", ",", "err", ":=", "ftp", ".", "cmd", "(", "StatusConnectionClosing", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}"...
// Quit sends quit to the server and close the connection. No need to Close after this.
[ "Quit", "sends", "quit", "to", "the", "server", "and", "close", "the", "connection", ".", "No", "need", "to", "Close", "after", "this", "." ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L105-L114
132,918
dutchcoders/goftp
ftp.go
RawCmd
func (ftp *FTP) RawCmd(command string, args ...interface{}) (code int, line string) { if ftp.debug { log.Printf("Raw-> %s\n", fmt.Sprintf(command, args...)) } code = -1 var err error if err = ftp.send(command, args...); err != nil { return code, "" } if line, err = ftp.receive(); err != nil { return code,...
go
func (ftp *FTP) RawCmd(command string, args ...interface{}) (code int, line string) { if ftp.debug { log.Printf("Raw-> %s\n", fmt.Sprintf(command, args...)) } code = -1 var err error if err = ftp.send(command, args...); err != nil { return code, "" } if line, err = ftp.receive(); err != nil { return code,...
[ "func", "(", "ftp", "*", "FTP", ")", "RawCmd", "(", "command", "string", ",", "args", "...", "interface", "{", "}", ")", "(", "code", "int", ",", "line", "string", ")", "{", "if", "ftp", ".", "debug", "{", "log", ".", "Printf", "(", "\"", "\\n", ...
// RawCmd sends raw commands to the remote server. Returns response code as int and response as string.
[ "RawCmd", "sends", "raw", "commands", "to", "the", "remote", "server", ".", "Returns", "response", "code", "as", "int", "and", "response", "as", "string", "." ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L123-L141
132,919
dutchcoders/goftp
ftp.go
cmd
func (ftp *FTP) cmd(expects string, command string, args ...interface{}) (line string, err error) { if err = ftp.send(command, args...); err != nil { return } if line, err = ftp.receive(); err != nil { return } if !strings.HasPrefix(line, expects) { err = errors.New(line) return } return }
go
func (ftp *FTP) cmd(expects string, command string, args ...interface{}) (line string, err error) { if err = ftp.send(command, args...); err != nil { return } if line, err = ftp.receive(); err != nil { return } if !strings.HasPrefix(line, expects) { err = errors.New(line) return } return }
[ "func", "(", "ftp", "*", "FTP", ")", "cmd", "(", "expects", "string", ",", "command", "string", ",", "args", "...", "interface", "{", "}", ")", "(", "line", "string", ",", "err", "error", ")", "{", "if", "err", "=", "ftp", ".", "send", "(", "comm...
// private function to send command and compare return code with expects
[ "private", "function", "to", "send", "command", "and", "compare", "return", "code", "with", "expects" ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L144-L159
132,920
dutchcoders/goftp
ftp.go
Rename
func (ftp *FTP) Rename(from string, to string) (err error) { if _, err = ftp.cmd(StatusActionPending, "RNFR %s", from); err != nil { return } if _, err = ftp.cmd(StatusActionOK, "RNTO %s", to); err != nil { return } return }
go
func (ftp *FTP) Rename(from string, to string) (err error) { if _, err = ftp.cmd(StatusActionPending, "RNFR %s", from); err != nil { return } if _, err = ftp.cmd(StatusActionOK, "RNTO %s", to); err != nil { return } return }
[ "func", "(", "ftp", "*", "FTP", ")", "Rename", "(", "from", "string", ",", "to", "string", ")", "(", "err", "error", ")", "{", "if", "_", ",", "err", "=", "ftp", ".", "cmd", "(", "StatusActionPending", ",", "\"", "\"", ",", "from", ")", ";", "e...
// Rename file on the remote host
[ "Rename", "file", "on", "the", "remote", "host" ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L162-L172
132,921
dutchcoders/goftp
ftp.go
Mkd
func (ftp *FTP) Mkd(path string) error { _, err := ftp.cmd(StatusPathCreated, "MKD %s", path) return err }
go
func (ftp *FTP) Mkd(path string) error { _, err := ftp.cmd(StatusPathCreated, "MKD %s", path) return err }
[ "func", "(", "ftp", "*", "FTP", ")", "Mkd", "(", "path", "string", ")", "error", "{", "_", ",", "err", ":=", "ftp", ".", "cmd", "(", "StatusPathCreated", ",", "\"", "\"", ",", "path", ")", "\n", "return", "err", "\n", "}" ]
// Mkd makes a directory on the remote host
[ "Mkd", "makes", "a", "directory", "on", "the", "remote", "host" ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L175-L178
132,922
dutchcoders/goftp
ftp.go
Pwd
func (ftp *FTP) Pwd() (path string, err error) { var line string if line, err = ftp.cmd(StatusPathCreated, "PWD"); err != nil { return } res := RePwdPath.FindAllStringSubmatch(line[4:], -1) path = res[0][1] return }
go
func (ftp *FTP) Pwd() (path string, err error) { var line string if line, err = ftp.cmd(StatusPathCreated, "PWD"); err != nil { return } res := RePwdPath.FindAllStringSubmatch(line[4:], -1) path = res[0][1] return }
[ "func", "(", "ftp", "*", "FTP", ")", "Pwd", "(", ")", "(", "path", "string", ",", "err", "error", ")", "{", "var", "line", "string", "\n", "if", "line", ",", "err", "=", "ftp", ".", "cmd", "(", "StatusPathCreated", ",", "\"", "\"", ")", ";", "e...
// Pwd gets current path on the remote host
[ "Pwd", "gets", "current", "path", "on", "the", "remote", "host" ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L187-L197
132,923
dutchcoders/goftp
ftp.go
Cwd
func (ftp *FTP) Cwd(path string) (err error) { _, err = ftp.cmd(StatusActionOK, "CWD %s", path) return }
go
func (ftp *FTP) Cwd(path string) (err error) { _, err = ftp.cmd(StatusActionOK, "CWD %s", path) return }
[ "func", "(", "ftp", "*", "FTP", ")", "Cwd", "(", "path", "string", ")", "(", "err", "error", ")", "{", "_", ",", "err", "=", "ftp", ".", "cmd", "(", "StatusActionOK", ",", "\"", "\"", ",", "path", ")", "\n", "return", "\n", "}" ]
// Cwd changes current working directory on remote host to path
[ "Cwd", "changes", "current", "working", "directory", "on", "remote", "host", "to", "path" ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L200-L203
132,924
dutchcoders/goftp
ftp.go
Dele
func (ftp *FTP) Dele(path string) (err error) { if err = ftp.send("DELE %s", path); err != nil { return } var line string if line, err = ftp.receive(); err != nil { return } if !strings.HasPrefix(line, StatusActionOK) { return errors.New(line) } return }
go
func (ftp *FTP) Dele(path string) (err error) { if err = ftp.send("DELE %s", path); err != nil { return } var line string if line, err = ftp.receive(); err != nil { return } if !strings.HasPrefix(line, StatusActionOK) { return errors.New(line) } return }
[ "func", "(", "ftp", "*", "FTP", ")", "Dele", "(", "path", "string", ")", "(", "err", "error", ")", "{", "if", "err", "=", "ftp", ".", "send", "(", "\"", "\"", ",", "path", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "var",...
// Dele deletes path on remote host
[ "Dele", "deletes", "path", "on", "remote", "host" ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L206-L221
132,925
dutchcoders/goftp
ftp.go
AuthTLS
func (ftp *FTP) AuthTLS(config *tls.Config) error { if _, err := ftp.cmd("234", "AUTH TLS"); err != nil { return err } // wrap tls on existing connection ftp.tlsconfig = config ftp.conn = tls.Client(ftp.conn, config) ftp.writer = bufio.NewWriter(ftp.conn) ftp.reader = bufio.NewReader(ftp.conn) if _, err :=...
go
func (ftp *FTP) AuthTLS(config *tls.Config) error { if _, err := ftp.cmd("234", "AUTH TLS"); err != nil { return err } // wrap tls on existing connection ftp.tlsconfig = config ftp.conn = tls.Client(ftp.conn, config) ftp.writer = bufio.NewWriter(ftp.conn) ftp.reader = bufio.NewReader(ftp.conn) if _, err :=...
[ "func", "(", "ftp", "*", "FTP", ")", "AuthTLS", "(", "config", "*", "tls", ".", "Config", ")", "error", "{", "if", "_", ",", "err", ":=", "ftp", ".", "cmd", "(", "\"", "\"", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "err",...
// AuthTLS secures the ftp connection by using TLS
[ "AuthTLS", "secures", "the", "ftp", "connection", "by", "using", "TLS" ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L224-L245
132,926
dutchcoders/goftp
ftp.go
ReadAndDiscard
func (ftp *FTP) ReadAndDiscard() (int, error) { var i int bufferSize := ftp.reader.Buffered() for i = 0; i < bufferSize; i++ { if _, err := ftp.reader.ReadByte(); err != nil { return i, err } } return i, nil }
go
func (ftp *FTP) ReadAndDiscard() (int, error) { var i int bufferSize := ftp.reader.Buffered() for i = 0; i < bufferSize; i++ { if _, err := ftp.reader.ReadByte(); err != nil { return i, err } } return i, nil }
[ "func", "(", "ftp", "*", "FTP", ")", "ReadAndDiscard", "(", ")", "(", "int", ",", "error", ")", "{", "var", "i", "int", "\n", "bufferSize", ":=", "ftp", ".", "reader", ".", "Buffered", "(", ")", "\n", "for", "i", "=", "0", ";", "i", "<", "buffe...
// ReadAndDiscard reads all the buffered bytes and returns the number of bytes // that cleared from the buffer
[ "ReadAndDiscard", "reads", "all", "the", "buffered", "bytes", "and", "returns", "the", "number", "of", "bytes", "that", "cleared", "from", "the", "buffer" ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L249-L258
132,927
dutchcoders/goftp
ftp.go
Type
func (ftp *FTP) Type(t TypeCode) error { _, err := ftp.cmd(StatusOK, "TYPE %s", t) return err }
go
func (ftp *FTP) Type(t TypeCode) error { _, err := ftp.cmd(StatusOK, "TYPE %s", t) return err }
[ "func", "(", "ftp", "*", "FTP", ")", "Type", "(", "t", "TypeCode", ")", "error", "{", "_", ",", "err", ":=", "ftp", ".", "cmd", "(", "StatusOK", ",", "\"", "\"", ",", "t", ")", "\n", "return", "err", "\n", "}" ]
// Type changes transfer type.
[ "Type", "changes", "transfer", "type", "." ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L261-L264
132,928
dutchcoders/goftp
ftp.go
Pasv
func (ftp *FTP) Pasv() (port int, err error) { doneChan := make(chan int, 1) go func() { defer func() { doneChan <- 1 }() var line string if line, err = ftp.cmd("227", "PASV"); err != nil { return } re := regexp.MustCompile(`\((.*)\)`) res := re.FindAllStringSubmatch(line, -1) if len(res) == 0 |...
go
func (ftp *FTP) Pasv() (port int, err error) { doneChan := make(chan int, 1) go func() { defer func() { doneChan <- 1 }() var line string if line, err = ftp.cmd("227", "PASV"); err != nil { return } re := regexp.MustCompile(`\((.*)\)`) res := re.FindAllStringSubmatch(line, -1) if len(res) == 0 |...
[ "func", "(", "ftp", "*", "FTP", ")", "Pasv", "(", ")", "(", "port", "int", ",", "err", "error", ")", "{", "doneChan", ":=", "make", "(", "chan", "int", ",", "1", ")", "\n", "go", "func", "(", ")", "{", "defer", "func", "(", ")", "{", "doneCha...
// Pasv enables passive data connection and returns port number
[ "Pasv", "enables", "passive", "data", "connection", "and", "returns", "port", "number" ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L377-L415
132,929
dutchcoders/goftp
ftp.go
newConnection
func (ftp *FTP) newConnection(port int) (conn net.Conn, err error) { addr := fmt.Sprintf("%s:%d", strings.Split(ftp.addr, ":")[0], port) if ftp.debug { log.Printf("Connecting to %s\n", addr) } if conn, err = net.Dial("tcp", addr); err != nil { return } if ftp.tlsconfig != nil { conn = tls.Client(conn, ft...
go
func (ftp *FTP) newConnection(port int) (conn net.Conn, err error) { addr := fmt.Sprintf("%s:%d", strings.Split(ftp.addr, ":")[0], port) if ftp.debug { log.Printf("Connecting to %s\n", addr) } if conn, err = net.Dial("tcp", addr); err != nil { return } if ftp.tlsconfig != nil { conn = tls.Client(conn, ft...
[ "func", "(", "ftp", "*", "FTP", ")", "newConnection", "(", "port", "int", ")", "(", "conn", "net", ".", "Conn", ",", "err", "error", ")", "{", "addr", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "Split", "(", "ftp", ".", ...
// open new data connection
[ "open", "new", "data", "connection" ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L418-L434
132,930
dutchcoders/goftp
ftp.go
Stor
func (ftp *FTP) Stor(path string, r io.Reader) (err error) { if err = ftp.Type(TypeImage); err != nil { return } var port int if port, err = ftp.Pasv(); err != nil { return } if err = ftp.send("STOR %s", path); err != nil { return } var pconn net.Conn if pconn, err = ftp.newConnection(port); err != ni...
go
func (ftp *FTP) Stor(path string, r io.Reader) (err error) { if err = ftp.Type(TypeImage); err != nil { return } var port int if port, err = ftp.Pasv(); err != nil { return } if err = ftp.send("STOR %s", path); err != nil { return } var pconn net.Conn if pconn, err = ftp.newConnection(port); err != ni...
[ "func", "(", "ftp", "*", "FTP", ")", "Stor", "(", "path", "string", ",", "r", "io", ".", "Reader", ")", "(", "err", "error", ")", "{", "if", "err", "=", "ftp", ".", "Type", "(", "TypeImage", ")", ";", "err", "!=", "nil", "{", "return", "\n", ...
// Stor uploads file to remote host path, from r
[ "Stor", "uploads", "file", "to", "remote", "host", "path", "from", "r" ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L437-L483
132,931
dutchcoders/goftp
ftp.go
Syst
func (ftp *FTP) Syst() (line string, err error) { if err := ftp.send("SYST"); err != nil { return "", err } if line, err = ftp.receive(); err != nil { return } if !strings.HasPrefix(line, StatusSystemType) { err = errors.New(line) return } return strings.SplitN(strings.TrimSpace(line), " ", 2)[1], nil }
go
func (ftp *FTP) Syst() (line string, err error) { if err := ftp.send("SYST"); err != nil { return "", err } if line, err = ftp.receive(); err != nil { return } if !strings.HasPrefix(line, StatusSystemType) { err = errors.New(line) return } return strings.SplitN(strings.TrimSpace(line), " ", 2)[1], nil }
[ "func", "(", "ftp", "*", "FTP", ")", "Syst", "(", ")", "(", "line", "string", ",", "err", "error", ")", "{", "if", "err", ":=", "ftp", ".", "send", "(", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", ...
// Syst returns the system type of the remote host
[ "Syst", "returns", "the", "system", "type", "of", "the", "remote", "host" ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L486-L499
132,932
dutchcoders/goftp
ftp.go
Stat
func (ftp *FTP) Stat(path string) ([]string, error) { if err := ftp.send("STAT %s", path); err != nil { return nil, err } stat, err := ftp.receive() if err != nil { return nil, err } if !strings.HasPrefix(stat, StatusFileStatus) && !strings.HasPrefix(stat, StatusDirectoryStatus) && !strings.HasPrefix(stat,...
go
func (ftp *FTP) Stat(path string) ([]string, error) { if err := ftp.send("STAT %s", path); err != nil { return nil, err } stat, err := ftp.receive() if err != nil { return nil, err } if !strings.HasPrefix(stat, StatusFileStatus) && !strings.HasPrefix(stat, StatusDirectoryStatus) && !strings.HasPrefix(stat,...
[ "func", "(", "ftp", "*", "FTP", ")", "Stat", "(", "path", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "if", "err", ":=", "ftp", ".", "send", "(", "\"", "\"", ",", "path", ")", ";", "err", "!=", "nil", "{", "return", "nil",...
// Stat gets the status of path from the remote host
[ "Stat", "gets", "the", "status", "of", "path", "from", "the", "remote", "host" ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L513-L546
132,933
dutchcoders/goftp
ftp.go
Retr
func (ftp *FTP) Retr(path string, retrFn RetrFunc) (s string, err error) { if err = ftp.Type(TypeImage); err != nil { return } var port int if port, err = ftp.Pasv(); err != nil { return } if err = ftp.send("RETR %s", path); err != nil { return } var pconn net.Conn if pconn, err = ftp.newConnection(po...
go
func (ftp *FTP) Retr(path string, retrFn RetrFunc) (s string, err error) { if err = ftp.Type(TypeImage); err != nil { return } var port int if port, err = ftp.Pasv(); err != nil { return } if err = ftp.send("RETR %s", path); err != nil { return } var pconn net.Conn if pconn, err = ftp.newConnection(po...
[ "func", "(", "ftp", "*", "FTP", ")", "Retr", "(", "path", "string", ",", "retrFn", "RetrFunc", ")", "(", "s", "string", ",", "err", "error", ")", "{", "if", "err", "=", "ftp", ".", "Type", "(", "TypeImage", ")", ";", "err", "!=", "nil", "{", "r...
// Retr retrieves file from remote host at path, using retrFn to read from the remote file.
[ "Retr", "retrieves", "file", "from", "remote", "host", "at", "path", "using", "retrFn", "to", "read", "from", "the", "remote", "file", "." ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L549-L595
132,934
dutchcoders/goftp
ftp.go
Size
func (ftp *FTP) Size(path string) (size int, err error) { line, err := ftp.cmd("213", "SIZE %s", path) if err != nil { return 0, err } return strconv.Atoi(line[4 : len(line)-2]) }
go
func (ftp *FTP) Size(path string) (size int, err error) { line, err := ftp.cmd("213", "SIZE %s", path) if err != nil { return 0, err } return strconv.Atoi(line[4 : len(line)-2]) }
[ "func", "(", "ftp", "*", "FTP", ")", "Size", "(", "path", "string", ")", "(", "size", "int", ",", "err", "error", ")", "{", "line", ",", "err", ":=", "ftp", ".", "cmd", "(", "\"", "\"", ",", "\"", "\"", ",", "path", ")", "\n\n", "if", "err", ...
// Size returns the size of a file.
[ "Size", "returns", "the", "size", "of", "a", "file", "." ]
ed59a591ce14ff6c19c49be14294528d11a88c37
https://github.com/dutchcoders/goftp/blob/ed59a591ce14ff6c19c49be14294528d11a88c37/ftp.go#L767-L775
132,935
zabawaba99/firego
transaction.go
Transaction
func (fb *Firebase) Transaction(fn TransactionFn) error { // fetch etag and current value headers, body, err := fb.doRequest("GET", nil, withHeader("X-Firebase-ETag", "true")) if err != nil { return err } etag, snapshot, err := getTransactionParams(headers, body) if err != nil { return err } // set the er...
go
func (fb *Firebase) Transaction(fn TransactionFn) error { // fetch etag and current value headers, body, err := fb.doRequest("GET", nil, withHeader("X-Firebase-ETag", "true")) if err != nil { return err } etag, snapshot, err := getTransactionParams(headers, body) if err != nil { return err } // set the er...
[ "func", "(", "fb", "*", "Firebase", ")", "Transaction", "(", "fn", "TransactionFn", ")", "error", "{", "// fetch etag and current value", "headers", ",", "body", ",", "err", ":=", "fb", ".", "doRequest", "(", "\"", "\"", ",", "nil", ",", "withHeader", "(",...
// Transaction runs a transaction on the data at this location. The TransactionFn parameter // will be called, possibly multiple times, with the current data at this location. // It is responsible for inspecting that data and specifying either the desired new data // at the location or that the transaction should be ab...
[ "Transaction", "runs", "a", "transaction", "on", "the", "data", "at", "this", "location", ".", "The", "TransactionFn", "parameter", "will", "be", "called", "possibly", "multiple", "times", "with", "the", "current", "data", "at", "this", "location", ".", "It", ...
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/transaction.go#L36-L82
132,936
zabawaba99/firego
firebase.go
New
func New(url string, client *http.Client) *Firebase { fb := &Firebase{ url: sanitizeURL(url), params: _url.Values{}, clientTimeout: TimeoutDuration, stopWatching: make(chan struct{}), watchHeartbeat: defaultHeartbeat, eventFuncs: map[string]chan struct{}{}, } if client == nil { ...
go
func New(url string, client *http.Client) *Firebase { fb := &Firebase{ url: sanitizeURL(url), params: _url.Values{}, clientTimeout: TimeoutDuration, stopWatching: make(chan struct{}), watchHeartbeat: defaultHeartbeat, eventFuncs: map[string]chan struct{}{}, } if client == nil { ...
[ "func", "New", "(", "url", "string", ",", "client", "*", "http", ".", "Client", ")", "*", "Firebase", "{", "fb", ":=", "&", "Firebase", "{", "url", ":", "sanitizeURL", "(", "url", ")", ",", "params", ":", "_url", ".", "Values", "{", "}", ",", "cl...
// New creates a new Firebase reference, // if client is nil, http.DefaultClient is used.
[ "New", "creates", "a", "new", "Firebase", "reference", "if", "client", "is", "nil", "http", ".", "DefaultClient", "is", "used", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/firebase.go#L69-L97
132,937
zabawaba99/firego
firebase.go
Auth
func (fb *Firebase) Auth(token string) { fb.paramsMtx.Lock() fb.params.Set(authParam, token) fb.paramsMtx.Unlock() }
go
func (fb *Firebase) Auth(token string) { fb.paramsMtx.Lock() fb.params.Set(authParam, token) fb.paramsMtx.Unlock() }
[ "func", "(", "fb", "*", "Firebase", ")", "Auth", "(", "token", "string", ")", "{", "fb", ".", "paramsMtx", ".", "Lock", "(", ")", "\n", "fb", ".", "params", ".", "Set", "(", "authParam", ",", "token", ")", "\n", "fb", ".", "paramsMtx", ".", "Unlo...
// Auth sets the custom Firebase token used to authenticate to Firebase.
[ "Auth", "sets", "the", "custom", "Firebase", "token", "used", "to", "authenticate", "to", "Firebase", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/firebase.go#L100-L104
132,938
zabawaba99/firego
firebase.go
Unauth
func (fb *Firebase) Unauth() { fb.paramsMtx.Lock() fb.params.Del(authParam) fb.paramsMtx.Unlock() }
go
func (fb *Firebase) Unauth() { fb.paramsMtx.Lock() fb.params.Del(authParam) fb.paramsMtx.Unlock() }
[ "func", "(", "fb", "*", "Firebase", ")", "Unauth", "(", ")", "{", "fb", ".", "paramsMtx", ".", "Lock", "(", ")", "\n", "fb", ".", "params", ".", "Del", "(", "authParam", ")", "\n", "fb", ".", "paramsMtx", ".", "Unlock", "(", ")", "\n", "}" ]
// Unauth removes the current token being used to authenticate to Firebase.
[ "Unauth", "removes", "the", "current", "token", "being", "used", "to", "authenticate", "to", "Firebase", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/firebase.go#L107-L111
132,939
zabawaba99/firego
firebase.go
Ref
func (fb *Firebase) Ref(path string) (*Firebase, error) { newFB := fb.copy() parsedURL, err := _url.Parse(fb.url) if err != nil { return newFB, err } newFB.url = parsedURL.Scheme + "://" + parsedURL.Host + "/" + strings.Trim(path, "/") return newFB, nil }
go
func (fb *Firebase) Ref(path string) (*Firebase, error) { newFB := fb.copy() parsedURL, err := _url.Parse(fb.url) if err != nil { return newFB, err } newFB.url = parsedURL.Scheme + "://" + parsedURL.Host + "/" + strings.Trim(path, "/") return newFB, nil }
[ "func", "(", "fb", "*", "Firebase", ")", "Ref", "(", "path", "string", ")", "(", "*", "Firebase", ",", "error", ")", "{", "newFB", ":=", "fb", ".", "copy", "(", ")", "\n", "parsedURL", ",", "err", ":=", "_url", ".", "Parse", "(", "fb", ".", "ur...
// Ref returns a copy of an existing Firebase reference with a new path.
[ "Ref", "returns", "a", "copy", "of", "an", "existing", "Firebase", "reference", "with", "a", "new", "path", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/firebase.go#L114-L122
132,940
zabawaba99/firego
firebase.go
Push
func (fb *Firebase) Push(v interface{}) (*Firebase, error) { bytes, err := json.Marshal(v) if err != nil { return nil, err } _, bytes, err = fb.doRequest("POST", bytes) if err != nil { return nil, err } var m map[string]string if err := json.Unmarshal(bytes, &m); err != nil { return nil, err } newRef :=...
go
func (fb *Firebase) Push(v interface{}) (*Firebase, error) { bytes, err := json.Marshal(v) if err != nil { return nil, err } _, bytes, err = fb.doRequest("POST", bytes) if err != nil { return nil, err } var m map[string]string if err := json.Unmarshal(bytes, &m); err != nil { return nil, err } newRef :=...
[ "func", "(", "fb", "*", "Firebase", ")", "Push", "(", "v", "interface", "{", "}", ")", "(", "*", "Firebase", ",", "error", ")", "{", "bytes", ",", "err", ":=", "json", ".", "Marshal", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return"...
// Push creates a reference to an auto-generated child location.
[ "Push", "creates", "a", "reference", "to", "an", "auto", "-", "generated", "child", "location", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/firebase.go#L135-L151
132,941
zabawaba99/firego
firebase.go
Remove
func (fb *Firebase) Remove() error { _, _, err := fb.doRequest("DELETE", nil) if err != nil { return err } return nil }
go
func (fb *Firebase) Remove() error { _, _, err := fb.doRequest("DELETE", nil) if err != nil { return err } return nil }
[ "func", "(", "fb", "*", "Firebase", ")", "Remove", "(", ")", "error", "{", "_", ",", "_", ",", "err", ":=", "fb", ".", "doRequest", "(", "\"", "\"", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "retu...
// Remove the Firebase reference from the cloud.
[ "Remove", "the", "Firebase", "reference", "from", "the", "cloud", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/firebase.go#L154-L160
132,942
zabawaba99/firego
firebase.go
Set
func (fb *Firebase) Set(v interface{}) error { bytes, err := json.Marshal(v) if err != nil { return err } _, _, err = fb.doRequest("PUT", bytes) return err }
go
func (fb *Firebase) Set(v interface{}) error { bytes, err := json.Marshal(v) if err != nil { return err } _, _, err = fb.doRequest("PUT", bytes) return err }
[ "func", "(", "fb", "*", "Firebase", ")", "Set", "(", "v", "interface", "{", "}", ")", "error", "{", "bytes", ",", "err", ":=", "json", ".", "Marshal", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "_", ...
// Set the value of the Firebase reference.
[ "Set", "the", "value", "of", "the", "Firebase", "reference", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/firebase.go#L163-L170
132,943
zabawaba99/firego
firebase.go
Value
func (fb *Firebase) Value(v interface{}) error { _, bytes, err := fb.doRequest("GET", nil) if err != nil { return err } return json.Unmarshal(bytes, v) }
go
func (fb *Firebase) Value(v interface{}) error { _, bytes, err := fb.doRequest("GET", nil) if err != nil { return err } return json.Unmarshal(bytes, v) }
[ "func", "(", "fb", "*", "Firebase", ")", "Value", "(", "v", "interface", "{", "}", ")", "error", "{", "_", ",", "bytes", ",", "err", ":=", "fb", ".", "doRequest", "(", "\"", "\"", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// Value gets the value of the Firebase reference.
[ "Value", "gets", "the", "value", "of", "the", "Firebase", "reference", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/firebase.go#L183-L189
132,944
zabawaba99/firego
firebase.go
String
func (fb *Firebase) String() string { path := fb.url + "/.json" fb.paramsMtx.RLock() if len(fb.params) > 0 { path += "?" + fb.params.Encode() } fb.paramsMtx.RUnlock() return path }
go
func (fb *Firebase) String() string { path := fb.url + "/.json" fb.paramsMtx.RLock() if len(fb.params) > 0 { path += "?" + fb.params.Encode() } fb.paramsMtx.RUnlock() return path }
[ "func", "(", "fb", "*", "Firebase", ")", "String", "(", ")", "string", "{", "path", ":=", "fb", ".", "url", "+", "\"", "\"", "\n\n", "fb", ".", "paramsMtx", ".", "RLock", "(", ")", "\n", "if", "len", "(", "fb", ".", "params", ")", ">", "0", "...
// String returns the string representation of the // Firebase reference.
[ "String", "returns", "the", "string", "representation", "of", "the", "Firebase", "reference", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/firebase.go#L193-L202
132,945
zabawaba99/firego
firebase.go
Child
func (fb *Firebase) Child(child string) *Firebase { c := fb.copy() c.url = c.url + "/" + child return c }
go
func (fb *Firebase) Child(child string) *Firebase { c := fb.copy() c.url = c.url + "/" + child return c }
[ "func", "(", "fb", "*", "Firebase", ")", "Child", "(", "child", "string", ")", "*", "Firebase", "{", "c", ":=", "fb", ".", "copy", "(", ")", "\n", "c", ".", "url", "=", "c", ".", "url", "+", "\"", "\"", "+", "child", "\n", "return", "c", "\n"...
// Child creates a new Firebase reference for the requested // child with the same configuration as the parent.
[ "Child", "creates", "a", "new", "Firebase", "reference", "for", "the", "requested", "child", "with", "the", "same", "configuration", "as", "the", "parent", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/firebase.go#L206-L210
132,946
zabawaba99/firego
watch.go
Value
func (e Event) Value(v interface{}) error { var tmp struct { Data interface{} `json:"data"` } tmp.Data = &v return json.Unmarshal(e.rawData, &tmp) }
go
func (e Event) Value(v interface{}) error { var tmp struct { Data interface{} `json:"data"` } tmp.Data = &v return json.Unmarshal(e.rawData, &tmp) }
[ "func", "(", "e", "Event", ")", "Value", "(", "v", "interface", "{", "}", ")", "error", "{", "var", "tmp", "struct", "{", "Data", "interface", "{", "}", "`json:\"data\"`", "\n", "}", "\n", "tmp", ".", "Data", "=", "&", "v", "\n", "return", "json", ...
// Value converts the raw payload of the event into the given interface.
[ "Value", "converts", "the", "raw", "payload", "of", "the", "event", "into", "the", "given", "interface", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/watch.go#L45-L51
132,947
zabawaba99/firego
watch.go
StopWatching
func (fb *Firebase) StopWatching() { fb.watchMtx.Lock() defer fb.watchMtx.Unlock() if fb.watching { // flip the bit back to not watching fb.watching = false // signal connection to terminal fb.stopWatching <- struct{}{} } }
go
func (fb *Firebase) StopWatching() { fb.watchMtx.Lock() defer fb.watchMtx.Unlock() if fb.watching { // flip the bit back to not watching fb.watching = false // signal connection to terminal fb.stopWatching <- struct{}{} } }
[ "func", "(", "fb", "*", "Firebase", ")", "StopWatching", "(", ")", "{", "fb", ".", "watchMtx", ".", "Lock", "(", ")", "\n", "defer", "fb", ".", "watchMtx", ".", "Unlock", "(", ")", "\n\n", "if", "fb", ".", "watching", "{", "// flip the bit back to not ...
// StopWatching stops tears down all connections that are watching.
[ "StopWatching", "stops", "tears", "down", "all", "connections", "that", "are", "watching", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/watch.go#L54-L64
132,948
zabawaba99/firego
watch.go
Watch
func (fb *Firebase) Watch(notifications chan Event) error { fb.watchMtx.Lock() if fb.watching { fb.watchMtx.Unlock() close(notifications) return nil } fb.watching = true fb.watchMtx.Unlock() stop := make(chan struct{}) events, err := fb.watch(stop) if err != nil { return err } var closedManually boo...
go
func (fb *Firebase) Watch(notifications chan Event) error { fb.watchMtx.Lock() if fb.watching { fb.watchMtx.Unlock() close(notifications) return nil } fb.watching = true fb.watchMtx.Unlock() stop := make(chan struct{}) events, err := fb.watch(stop) if err != nil { return err } var closedManually boo...
[ "func", "(", "fb", "*", "Firebase", ")", "Watch", "(", "notifications", "chan", "Event", ")", "error", "{", "fb", ".", "watchMtx", ".", "Lock", "(", ")", "\n", "if", "fb", ".", "watching", "{", "fb", ".", "watchMtx", ".", "Unlock", "(", ")", "\n", ...
// Watch listens for changes on a firebase instance and // passes over to the given chan. // // Only one connection can be established at a time. The // second call to this function without a call to fb.StopWatching // will close the channel given and return nil immediately.
[ "Watch", "listens", "for", "changes", "on", "a", "firebase", "instance", "and", "passes", "over", "to", "the", "given", "chan", ".", "Only", "one", "connection", "can", "be", "established", "at", "a", "time", ".", "The", "second", "call", "to", "this", "...
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/watch.go#L78-L115
132,949
zabawaba99/firego
sync/node.go
NewNode
func NewNode(key string, data interface{}) *Node { n := &Node{ Key: key, } n.mtx.Lock() n.Children = map[string]*Node{} n.mtx.Unlock() if data == nil { return n } switch val := reflect.ValueOf(data); val.Kind() { case reflect.Map: for _, k := range val.MapKeys() { v := val.MapIndex(k) key := fmt...
go
func NewNode(key string, data interface{}) *Node { n := &Node{ Key: key, } n.mtx.Lock() n.Children = map[string]*Node{} n.mtx.Unlock() if data == nil { return n } switch val := reflect.ValueOf(data); val.Kind() { case reflect.Map: for _, k := range val.MapKeys() { v := val.MapIndex(k) key := fmt...
[ "func", "NewNode", "(", "key", "string", ",", "data", "interface", "{", "}", ")", "*", "Node", "{", "n", ":=", "&", "Node", "{", "Key", ":", "key", ",", "}", "\n\n", "n", ".", "mtx", ".", "Lock", "(", ")", "\n", "n", ".", "Children", "=", "ma...
// NewNode converts the given data into a node.
[ "NewNode", "converts", "the", "given", "data", "into", "a", "node", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/sync/node.go#L26-L75
132,950
zabawaba99/firego
sync/node.go
Objectify
func (n *Node) Objectify() interface{} { n.mtx.RLock() defer n.mtx.RUnlock() if n.isNil() { return nil } if n.Value != nil { return n.Value } if n.sliceKids { obj := make([]interface{}, len(n.Children)) for k, v := range n.Children { index, err := strconv.Atoi(k) if err != nil { continue ...
go
func (n *Node) Objectify() interface{} { n.mtx.RLock() defer n.mtx.RUnlock() if n.isNil() { return nil } if n.Value != nil { return n.Value } if n.sliceKids { obj := make([]interface{}, len(n.Children)) for k, v := range n.Children { index, err := strconv.Atoi(k) if err != nil { continue ...
[ "func", "(", "n", "*", "Node", ")", "Objectify", "(", ")", "interface", "{", "}", "{", "n", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "n", ".", "mtx", ".", "RUnlock", "(", ")", "\n\n", "if", "n", ".", "isNil", "(", ")", "{", "return"...
// Objectify turns the node and all its children into a go type. // If a node was created from a slice initially, a slice will be return. // If a node has child nodes, a map will be returned. // Otherwise, a primitive type will be returned.
[ "Objectify", "turns", "the", "node", "and", "all", "its", "children", "into", "a", "go", "type", ".", "If", "a", "node", "was", "created", "from", "a", "slice", "initially", "a", "slice", "will", "be", "return", ".", "If", "a", "node", "has", "child", ...
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/sync/node.go#L86-L116
132,951
zabawaba99/firego
event_callback.go
ChildAdded
func (fb *Firebase) ChildAdded(fn ChildEventFunc) error { return fb.addEventFunc(fn, fn.childAdded) }
go
func (fb *Firebase) ChildAdded(fn ChildEventFunc) error { return fb.addEventFunc(fn, fn.childAdded) }
[ "func", "(", "fb", "*", "Firebase", ")", "ChildAdded", "(", "fn", "ChildEventFunc", ")", "error", "{", "return", "fb", ".", "addEventFunc", "(", "fn", ",", "fn", ".", "childAdded", ")", "\n", "}" ]
// ChildAdded listens on the firebase instance and executes the callback // for every child that is added. // // You cannot set the same function twice on a Firebase reference, if you do // the first function will be overridden and you will not be able to close the // connection.
[ "ChildAdded", "listens", "on", "the", "firebase", "instance", "and", "executes", "the", "callback", "for", "every", "child", "that", "is", "added", ".", "You", "cannot", "set", "the", "same", "function", "twice", "on", "a", "Firebase", "reference", "if", "yo...
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/event_callback.go#L25-L27
132,952
zabawaba99/firego
event_callback.go
ChildChanged
func (fb *Firebase) ChildChanged(fn ChildEventFunc) error { return fb.addEventFunc(fn, fn.childChanged) }
go
func (fb *Firebase) ChildChanged(fn ChildEventFunc) error { return fb.addEventFunc(fn, fn.childChanged) }
[ "func", "(", "fb", "*", "Firebase", ")", "ChildChanged", "(", "fn", "ChildEventFunc", ")", "error", "{", "return", "fb", ".", "addEventFunc", "(", "fn", ",", "fn", ".", "childChanged", ")", "\n", "}" ]
// ChildChanged listens on the firebase instance and executes the callback // for every child that is changed. // // You cannot set the same function twice on a Firebase reference, if you do // the first function will be overridden and you will not be able to close the // connection.
[ "ChildChanged", "listens", "on", "the", "firebase", "instance", "and", "executes", "the", "callback", "for", "every", "child", "that", "is", "changed", ".", "You", "cannot", "set", "the", "same", "function", "twice", "on", "a", "Firebase", "reference", "if", ...
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/event_callback.go#L84-L86
132,953
zabawaba99/firego
event_callback.go
ChildRemoved
func (fb *Firebase) ChildRemoved(fn ChildEventFunc) error { return fb.addEventFunc(fn, fn.childRemoved) }
go
func (fb *Firebase) ChildRemoved(fn ChildEventFunc) error { return fb.addEventFunc(fn, fn.childRemoved) }
[ "func", "(", "fb", "*", "Firebase", ")", "ChildRemoved", "(", "fn", "ChildEventFunc", ")", "error", "{", "return", "fb", ".", "addEventFunc", "(", "fn", ",", "fn", ".", "childRemoved", ")", "\n", "}" ]
// ChildRemoved listens on the firebase instance and executes the callback // for every child that is deleted. // // You cannot set the same function twice on a Firebase reference, if you do // the first function will be overridden and you will not be able to close the // connection.
[ "ChildRemoved", "listens", "on", "the", "firebase", "instance", "and", "executes", "the", "callback", "for", "every", "child", "that", "is", "deleted", ".", "You", "cannot", "set", "the", "same", "function", "twice", "on", "a", "Firebase", "reference", "if", ...
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/event_callback.go#L151-L153
132,954
zabawaba99/firego
event_callback.go
RemoveEventFunc
func (fb *Firebase) RemoveEventFunc(fn ChildEventFunc) { fb.eventMtx.Lock() defer fb.eventMtx.Unlock() key := fmt.Sprintf("%v", fn) stop, ok := fb.eventFuncs[key] if !ok { return } delete(fb.eventFuncs, key) close(stop) }
go
func (fb *Firebase) RemoveEventFunc(fn ChildEventFunc) { fb.eventMtx.Lock() defer fb.eventMtx.Unlock() key := fmt.Sprintf("%v", fn) stop, ok := fb.eventFuncs[key] if !ok { return } delete(fb.eventFuncs, key) close(stop) }
[ "func", "(", "fb", "*", "Firebase", ")", "RemoveEventFunc", "(", "fn", "ChildEventFunc", ")", "{", "fb", ".", "eventMtx", ".", "Lock", "(", ")", "\n", "defer", "fb", ".", "eventMtx", ".", "Unlock", "(", ")", "\n\n", "key", ":=", "fmt", ".", "Sprintf"...
// RemoveEventFunc removes the given function from the firebase // reference.
[ "RemoveEventFunc", "removes", "the", "given", "function", "from", "the", "firebase", "reference", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/event_callback.go#L276-L288
132,955
zabawaba99/firego
sync/database.go
Add
func (d *Database) Add(path string, n *Node) { d.mtx.Lock() defer d.mtx.Unlock() if path == "" { d.root = n return } rabbitHole := strings.Split(path, "/") current := d.root for i := 0; i < len(rabbitHole)-1; i++ { step := rabbitHole[i] next, ok := current.Children[step] if !ok { next = &Node{ ...
go
func (d *Database) Add(path string, n *Node) { d.mtx.Lock() defer d.mtx.Unlock() if path == "" { d.root = n return } rabbitHole := strings.Split(path, "/") current := d.root for i := 0; i < len(rabbitHole)-1; i++ { step := rabbitHole[i] next, ok := current.Children[step] if !ok { next = &Node{ ...
[ "func", "(", "d", "*", "Database", ")", "Add", "(", "path", "string", ",", "n", "*", "Node", ")", "{", "d", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "if", "path", "==", "\"", "\"", ...
// Add puts a Node into the database.
[ "Add", "puts", "a", "Node", "into", "the", "database", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/sync/database.go#L25-L54
132,956
zabawaba99/firego
sync/database.go
Del
func (d *Database) Del(path string) { d.mtx.Lock() defer d.mtx.Unlock() if path == "" { d.root = &Node{ Children: map[string]*Node{}, } return } rabbitHole := strings.Split(path, "/") current := d.root // traverse to target node's parent var delIdx int for ; delIdx < len(rabbitHole)-1; delIdx++ { ...
go
func (d *Database) Del(path string) { d.mtx.Lock() defer d.mtx.Unlock() if path == "" { d.root = &Node{ Children: map[string]*Node{}, } return } rabbitHole := strings.Split(path, "/") current := d.root // traverse to target node's parent var delIdx int for ; delIdx < len(rabbitHole)-1; delIdx++ { ...
[ "func", "(", "d", "*", "Database", ")", "Del", "(", "path", "string", ")", "{", "d", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "if", "path", "==", "\"", "\"", "{", "d", ".", "root", ...
// Del removes the node at the given path.
[ "Del", "removes", "the", "node", "at", "the", "given", "path", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/sync/database.go#L88-L126
132,957
zabawaba99/firego
sync/database.go
Get
func (d *Database) Get(path string) *Node { d.mtx.RLock() defer d.mtx.RUnlock() current := d.root if path == "" { return current } rabbitHole := strings.Split(path, "/") for i := 0; i < len(rabbitHole); i++ { var ok bool current, ok = current.Children[rabbitHole[i]] if !ok { return nil } } retur...
go
func (d *Database) Get(path string) *Node { d.mtx.RLock() defer d.mtx.RUnlock() current := d.root if path == "" { return current } rabbitHole := strings.Split(path, "/") for i := 0; i < len(rabbitHole); i++ { var ok bool current, ok = current.Children[rabbitHole[i]] if !ok { return nil } } retur...
[ "func", "(", "d", "*", "Database", ")", "Get", "(", "path", "string", ")", "*", "Node", "{", "d", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "d", ".", "mtx", ".", "RUnlock", "(", ")", "\n\n", "current", ":=", "d", ".", "root", "\n", "...
// Get fetches a node at a given path.
[ "Get", "fetches", "a", "node", "at", "a", "given", "path", "." ]
3bcc4b6a45996b7c44e53ebe85e156de7c8c2819
https://github.com/zabawaba99/firego/blob/3bcc4b6a45996b7c44e53ebe85e156de7c8c2819/sync/database.go#L129-L147
132,958
influxdata/influxql
parse_tree.go
Group
func (t *ParseTree) Group(tokens ...Token) *ParseTree { for _, tok := range tokens { // Look for the parse tree for this token. if subtree := t.Tokens[tok]; subtree != nil { t = subtree continue } // No subtree exists yet. Verify that we don't have a conflicting // statement. if _, conflict := t.Han...
go
func (t *ParseTree) Group(tokens ...Token) *ParseTree { for _, tok := range tokens { // Look for the parse tree for this token. if subtree := t.Tokens[tok]; subtree != nil { t = subtree continue } // No subtree exists yet. Verify that we don't have a conflicting // statement. if _, conflict := t.Han...
[ "func", "(", "t", "*", "ParseTree", ")", "Group", "(", "tokens", "...", "Token", ")", "*", "ParseTree", "{", "for", "_", ",", "tok", ":=", "range", "tokens", "{", "// Look for the parse tree for this token.", "if", "subtree", ":=", "t", ".", "Tokens", "[",...
// Group groups together a set of related handlers with a common token prefix.
[ "Group", "groups", "together", "a", "set", "of", "related", "handlers", "with", "a", "common", "token", "prefix", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parse_tree.go#L21-L46
132,959
influxdata/influxql
parse_tree.go
Handle
func (t *ParseTree) Handle(tok Token, fn func(*Parser) (Statement, error)) { // Verify that there is no conflict for this token in this parse tree. if _, conflict := t.Tokens[tok]; conflict { panic(fmt.Sprintf("conflict for token %s", tok)) } if _, conflict := t.Handlers[tok]; conflict { panic(fmt.Sprintf("con...
go
func (t *ParseTree) Handle(tok Token, fn func(*Parser) (Statement, error)) { // Verify that there is no conflict for this token in this parse tree. if _, conflict := t.Tokens[tok]; conflict { panic(fmt.Sprintf("conflict for token %s", tok)) } if _, conflict := t.Handlers[tok]; conflict { panic(fmt.Sprintf("con...
[ "func", "(", "t", "*", "ParseTree", ")", "Handle", "(", "tok", "Token", ",", "fn", "func", "(", "*", "Parser", ")", "(", "Statement", ",", "error", ")", ")", "{", "// Verify that there is no conflict for this token in this parse tree.", "if", "_", ",", "confli...
// Handle registers a handler to be invoked when seeing the given token.
[ "Handle", "registers", "a", "handler", "to", "be", "invoked", "when", "seeing", "the", "given", "token", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parse_tree.go#L49-L64
132,960
influxdata/influxql
parse_tree.go
Parse
func (t *ParseTree) Parse(p *Parser) (Statement, error) { for { tok, pos, lit := p.ScanIgnoreWhitespace() if subtree := t.Tokens[tok]; subtree != nil { t = subtree continue } if stmt := t.Handlers[tok]; stmt != nil { return stmt(p) } // There were no registered handlers. Return the valid tokens ...
go
func (t *ParseTree) Parse(p *Parser) (Statement, error) { for { tok, pos, lit := p.ScanIgnoreWhitespace() if subtree := t.Tokens[tok]; subtree != nil { t = subtree continue } if stmt := t.Handlers[tok]; stmt != nil { return stmt(p) } // There were no registered handlers. Return the valid tokens ...
[ "func", "(", "t", "*", "ParseTree", ")", "Parse", "(", "p", "*", "Parser", ")", "(", "Statement", ",", "error", ")", "{", "for", "{", "tok", ",", "pos", ",", "lit", ":=", "p", ".", "ScanIgnoreWhitespace", "(", ")", "\n", "if", "subtree", ":=", "t...
// Parse parses a statement using the language defined in the parse tree.
[ "Parse", "parses", "a", "statement", "using", "the", "language", "defined", "in", "the", "parse", "tree", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parse_tree.go#L67-L82
132,961
influxdata/influxql
scanner.go
NewScanner
func NewScanner(r io.Reader) *Scanner { return &Scanner{r: &reader{r: bufio.NewReader(r)}} }
go
func NewScanner(r io.Reader) *Scanner { return &Scanner{r: &reader{r: bufio.NewReader(r)}} }
[ "func", "NewScanner", "(", "r", "io", ".", "Reader", ")", "*", "Scanner", "{", "return", "&", "Scanner", "{", "r", ":", "&", "reader", "{", "r", ":", "bufio", ".", "NewReader", "(", "r", ")", "}", "}", "\n", "}" ]
// NewScanner returns a new instance of Scanner.
[ "NewScanner", "returns", "a", "new", "instance", "of", "Scanner", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/scanner.go#L17-L19
132,962
influxdata/influxql
scanner.go
scanWhitespace
func (s *Scanner) scanWhitespace() (tok Token, pos Pos, lit string) { // Create a buffer and read the current character into it. var buf bytes.Buffer ch, pos := s.r.curr() _, _ = buf.WriteRune(ch) // Read every subsequent whitespace character into the buffer. // Non-whitespace characters and EOF will cause the l...
go
func (s *Scanner) scanWhitespace() (tok Token, pos Pos, lit string) { // Create a buffer and read the current character into it. var buf bytes.Buffer ch, pos := s.r.curr() _, _ = buf.WriteRune(ch) // Read every subsequent whitespace character into the buffer. // Non-whitespace characters and EOF will cause the l...
[ "func", "(", "s", "*", "Scanner", ")", "scanWhitespace", "(", ")", "(", "tok", "Token", ",", "pos", "Pos", ",", "lit", "string", ")", "{", "// Create a buffer and read the current character into it.", "var", "buf", "bytes", ".", "Buffer", "\n", "ch", ",", "p...
// scanWhitespace consumes the current rune and all contiguous whitespace.
[ "scanWhitespace", "consumes", "the", "current", "rune", "and", "all", "contiguous", "whitespace", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/scanner.go#L140-L161
132,963
influxdata/influxql
scanner.go
skipUntilNewline
func (s *Scanner) skipUntilNewline() { for { if ch, _ := s.r.read(); ch == '\n' || ch == eof { return } } }
go
func (s *Scanner) skipUntilNewline() { for { if ch, _ := s.r.read(); ch == '\n' || ch == eof { return } } }
[ "func", "(", "s", "*", "Scanner", ")", "skipUntilNewline", "(", ")", "{", "for", "{", "if", "ch", ",", "_", ":=", "s", ".", "r", ".", "read", "(", ")", ";", "ch", "==", "'\\n'", "||", "ch", "==", "eof", "{", "return", "\n", "}", "\n", "}", ...
// skipUntilNewline skips characters until it reaches a newline.
[ "skipUntilNewline", "skips", "characters", "until", "it", "reaches", "a", "newline", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/scanner.go#L164-L170
132,964
influxdata/influxql
scanner.go
scanString
func (s *Scanner) scanString() (tok Token, pos Pos, lit string) { s.r.unread() _, pos = s.r.curr() var err error lit, err = ScanString(s.r) if err == errBadString { return BADSTRING, pos, lit } else if err == errBadEscape { _, pos = s.r.curr() return BADESCAPE, pos, lit } return STRING, pos, lit }
go
func (s *Scanner) scanString() (tok Token, pos Pos, lit string) { s.r.unread() _, pos = s.r.curr() var err error lit, err = ScanString(s.r) if err == errBadString { return BADSTRING, pos, lit } else if err == errBadEscape { _, pos = s.r.curr() return BADESCAPE, pos, lit } return STRING, pos, lit }
[ "func", "(", "s", "*", "Scanner", ")", "scanString", "(", ")", "(", "tok", "Token", ",", "pos", "Pos", ",", "lit", "string", ")", "{", "s", ".", "r", ".", "unread", "(", ")", "\n", "_", ",", "pos", "=", "s", ".", "r", ".", "curr", "(", ")",...
// scanString consumes a contiguous string of non-quote characters. // Quote characters can be consumed if they're first escaped with a backslash.
[ "scanString", "consumes", "a", "contiguous", "string", "of", "non", "-", "quote", "characters", ".", "Quote", "characters", "can", "be", "consumed", "if", "they", "re", "first", "escaped", "with", "a", "backslash", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/scanner.go#L229-L242
132,965
influxdata/influxql
scanner.go
ScanRegex
func (s *Scanner) ScanRegex() (tok Token, pos Pos, lit string) { _, pos = s.r.curr() // Start & end sentinels. start, end := '/', '/' // Valid escape chars. escapes := map[rune]rune{'/': '/'} b, err := ScanDelimited(s.r, start, end, escapes, true) if err == errBadEscape { _, pos = s.r.curr() return BADESC...
go
func (s *Scanner) ScanRegex() (tok Token, pos Pos, lit string) { _, pos = s.r.curr() // Start & end sentinels. start, end := '/', '/' // Valid escape chars. escapes := map[rune]rune{'/': '/'} b, err := ScanDelimited(s.r, start, end, escapes, true) if err == errBadEscape { _, pos = s.r.curr() return BADESC...
[ "func", "(", "s", "*", "Scanner", ")", "ScanRegex", "(", ")", "(", "tok", "Token", ",", "pos", "Pos", ",", "lit", "string", ")", "{", "_", ",", "pos", "=", "s", ".", "r", ".", "curr", "(", ")", "\n\n", "// Start & end sentinels.", "start", ",", "...
// ScanRegex consumes a token to find escapes
[ "ScanRegex", "consumes", "a", "token", "to", "find", "escapes" ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/scanner.go#L245-L262
132,966
influxdata/influxql
scanner.go
scanNumber
func (s *Scanner) scanNumber() (tok Token, pos Pos, lit string) { var buf bytes.Buffer // Check if the initial rune is a ".". ch, pos := s.r.curr() if ch == '.' { // Peek and see if the next rune is a digit. ch1, _ := s.r.read() s.r.unread() if !isDigit(ch1) { return ILLEGAL, pos, "." } // Unread t...
go
func (s *Scanner) scanNumber() (tok Token, pos Pos, lit string) { var buf bytes.Buffer // Check if the initial rune is a ".". ch, pos := s.r.curr() if ch == '.' { // Peek and see if the next rune is a digit. ch1, _ := s.r.read() s.r.unread() if !isDigit(ch1) { return ILLEGAL, pos, "." } // Unread t...
[ "func", "(", "s", "*", "Scanner", ")", "scanNumber", "(", ")", "(", "tok", "Token", ",", "pos", "Pos", ",", "lit", "string", ")", "{", "var", "buf", "bytes", ".", "Buffer", "\n\n", "// Check if the initial rune is a \".\".", "ch", ",", "pos", ":=", "s", ...
// scanNumber consumes anything that looks like the start of a number.
[ "scanNumber", "consumes", "anything", "that", "looks", "like", "the", "start", "of", "a", "number", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/scanner.go#L265-L332
132,967
influxdata/influxql
scanner.go
scanDigits
func (s *Scanner) scanDigits() string { var buf bytes.Buffer for { ch, _ := s.r.read() if !isDigit(ch) { s.r.unread() break } _, _ = buf.WriteRune(ch) } return buf.String() }
go
func (s *Scanner) scanDigits() string { var buf bytes.Buffer for { ch, _ := s.r.read() if !isDigit(ch) { s.r.unread() break } _, _ = buf.WriteRune(ch) } return buf.String() }
[ "func", "(", "s", "*", "Scanner", ")", "scanDigits", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "for", "{", "ch", ",", "_", ":=", "s", ".", "r", ".", "read", "(", ")", "\n", "if", "!", "isDigit", "(", "ch", ")", "{",...
// scanDigits consumes a contiguous series of digits.
[ "scanDigits", "consumes", "a", "contiguous", "series", "of", "digits", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/scanner.go#L335-L346
132,968
influxdata/influxql
scanner.go
ScanRegex
func (s *bufScanner) ScanRegex() (tok Token, pos Pos, lit string) { return s.scanFunc(s.s.ScanRegex) }
go
func (s *bufScanner) ScanRegex() (tok Token, pos Pos, lit string) { return s.scanFunc(s.s.ScanRegex) }
[ "func", "(", "s", "*", "bufScanner", ")", "ScanRegex", "(", ")", "(", "tok", "Token", ",", "pos", "Pos", ",", "lit", "string", ")", "{", "return", "s", ".", "scanFunc", "(", "s", ".", "s", ".", "ScanRegex", ")", "\n", "}" ]
// ScanRegex reads a regex token from the scanner.
[ "ScanRegex", "reads", "a", "regex", "token", "from", "the", "scanner", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/scanner.go#L387-L389
132,969
influxdata/influxql
scanner.go
scanFunc
func (s *bufScanner) scanFunc(scan func() (Token, Pos, string)) (tok Token, pos Pos, lit string) { // If we have unread tokens then read them off the buffer first. if s.n > 0 { s.n-- return s.curr() } // Move buffer position forward and save the token. s.i = (s.i + 1) % len(s.buf) buf := &s.buf[s.i] buf.tok...
go
func (s *bufScanner) scanFunc(scan func() (Token, Pos, string)) (tok Token, pos Pos, lit string) { // If we have unread tokens then read them off the buffer first. if s.n > 0 { s.n-- return s.curr() } // Move buffer position forward and save the token. s.i = (s.i + 1) % len(s.buf) buf := &s.buf[s.i] buf.tok...
[ "func", "(", "s", "*", "bufScanner", ")", "scanFunc", "(", "scan", "func", "(", ")", "(", "Token", ",", "Pos", ",", "string", ")", ")", "(", "tok", "Token", ",", "pos", "Pos", ",", "lit", "string", ")", "{", "// If we have unread tokens then read them of...
// scanFunc uses the provided function to scan the next token.
[ "scanFunc", "uses", "the", "provided", "function", "to", "scan", "the", "next", "token", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/scanner.go#L392-L405
132,970
influxdata/influxql
scanner.go
ReadRune
func (r *reader) ReadRune() (ch rune, size int, err error) { ch, _ = r.read() if ch == eof { err = io.EOF } return }
go
func (r *reader) ReadRune() (ch rune, size int, err error) { ch, _ = r.read() if ch == eof { err = io.EOF } return }
[ "func", "(", "r", "*", "reader", ")", "ReadRune", "(", ")", "(", "ch", "rune", ",", "size", "int", ",", "err", "error", ")", "{", "ch", ",", "_", "=", "r", ".", "read", "(", ")", "\n", "if", "ch", "==", "eof", "{", "err", "=", "io", ".", ...
// ReadRune reads the next rune from the reader. // This is a wrapper function to implement the io.RuneReader interface. // Note that this function does not return size.
[ "ReadRune", "reads", "the", "next", "rune", "from", "the", "reader", ".", "This", "is", "a", "wrapper", "function", "to", "implement", "the", "io", ".", "RuneReader", "interface", ".", "Note", "that", "this", "function", "does", "not", "return", "size", "....
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/scanner.go#L433-L439
132,971
influxdata/influxql
scanner.go
read
func (r *reader) read() (ch rune, pos Pos) { // If we have unread characters then read them off the buffer first. if r.n > 0 { r.n-- return r.curr() } // Read next rune from underlying reader. // Any error (including io.EOF) should return as EOF. ch, _, err := r.r.ReadRune() if err != nil { ch = eof } el...
go
func (r *reader) read() (ch rune, pos Pos) { // If we have unread characters then read them off the buffer first. if r.n > 0 { r.n-- return r.curr() } // Read next rune from underlying reader. // Any error (including io.EOF) should return as EOF. ch, _, err := r.r.ReadRune() if err != nil { ch = eof } el...
[ "func", "(", "r", "*", "reader", ")", "read", "(", ")", "(", "ch", "rune", ",", "pos", "Pos", ")", "{", "// If we have unread characters then read them off the buffer first.", "if", "r", ".", "n", ">", "0", "{", "r", ".", "n", "--", "\n", "return", "r", ...
// read reads the next rune from the reader.
[ "read", "reads", "the", "next", "rune", "from", "the", "reader", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/scanner.go#L449-L491
132,972
influxdata/influxql
scanner.go
curr
func (r *reader) curr() (ch rune, pos Pos) { i := (r.i - r.n + len(r.buf)) % len(r.buf) buf := &r.buf[i] return buf.ch, buf.pos }
go
func (r *reader) curr() (ch rune, pos Pos) { i := (r.i - r.n + len(r.buf)) % len(r.buf) buf := &r.buf[i] return buf.ch, buf.pos }
[ "func", "(", "r", "*", "reader", ")", "curr", "(", ")", "(", "ch", "rune", ",", "pos", "Pos", ")", "{", "i", ":=", "(", "r", ".", "i", "-", "r", ".", "n", "+", "len", "(", "r", ".", "buf", ")", ")", "%", "len", "(", "r", ".", "buf", "...
// curr returns the last read character and position.
[ "curr", "returns", "the", "last", "read", "character", "and", "position", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/scanner.go#L499-L503
132,973
influxdata/influxql
scanner.go
ScanDelimited
func ScanDelimited(r io.RuneScanner, start, end rune, escapes map[rune]rune, escapesPassThru bool) ([]byte, error) { // Scan start delimiter. if ch, _, err := r.ReadRune(); err != nil { return nil, err } else if ch != start { return nil, fmt.Errorf("expected %s; found %s", string(start), string(ch)) } var buf...
go
func ScanDelimited(r io.RuneScanner, start, end rune, escapes map[rune]rune, escapesPassThru bool) ([]byte, error) { // Scan start delimiter. if ch, _, err := r.ReadRune(); err != nil { return nil, err } else if ch != start { return nil, fmt.Errorf("expected %s; found %s", string(start), string(ch)) } var buf...
[ "func", "ScanDelimited", "(", "r", "io", ".", "RuneScanner", ",", "start", ",", "end", "rune", ",", "escapes", "map", "[", "rune", "]", "rune", ",", "escapesPassThru", "bool", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "// Scan start delimiter."...
// ScanDelimited reads a delimited set of runes
[ "ScanDelimited", "reads", "a", "delimited", "set", "of", "runes" ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/scanner.go#L509-L555
132,974
influxdata/influxql
scanner.go
ScanString
func ScanString(r io.RuneScanner) (string, error) { ending, _, err := r.ReadRune() if err != nil { return "", errBadString } var buf bytes.Buffer for { ch0, _, err := r.ReadRune() if ch0 == ending { return buf.String(), nil } else if err != nil || ch0 == '\n' { return buf.String(), errBadString } ...
go
func ScanString(r io.RuneScanner) (string, error) { ending, _, err := r.ReadRune() if err != nil { return "", errBadString } var buf bytes.Buffer for { ch0, _, err := r.ReadRune() if ch0 == ending { return buf.String(), nil } else if err != nil || ch0 == '\n' { return buf.String(), errBadString } ...
[ "func", "ScanString", "(", "r", "io", ".", "RuneScanner", ")", "(", "string", ",", "error", ")", "{", "ending", ",", "_", ",", "err", ":=", "r", ".", "ReadRune", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "errBadStr...
// ScanString reads a quoted string from a rune reader.
[ "ScanString", "reads", "a", "quoted", "string", "from", "a", "rune", "reader", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/scanner.go#L558-L590
132,975
influxdata/influxql
scanner.go
ScanBareIdent
func ScanBareIdent(r io.RuneScanner) string { // Read every ident character into the buffer. // Non-ident characters and EOF will cause the loop to exit. var buf bytes.Buffer for { ch, _, err := r.ReadRune() if err != nil { break } else if !isIdentChar(ch) { r.UnreadRune() break } else { _, _ = ...
go
func ScanBareIdent(r io.RuneScanner) string { // Read every ident character into the buffer. // Non-ident characters and EOF will cause the loop to exit. var buf bytes.Buffer for { ch, _, err := r.ReadRune() if err != nil { break } else if !isIdentChar(ch) { r.UnreadRune() break } else { _, _ = ...
[ "func", "ScanBareIdent", "(", "r", "io", ".", "RuneScanner", ")", "string", "{", "// Read every ident character into the buffer.", "// Non-ident characters and EOF will cause the loop to exit.", "var", "buf", "bytes", ".", "Buffer", "\n", "for", "{", "ch", ",", "_", ","...
// ScanBareIdent reads bare identifier from a rune reader.
[ "ScanBareIdent", "reads", "bare", "identifier", "from", "a", "rune", "reader", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/scanner.go#L596-L612
132,976
influxdata/influxql
sanitize.go
Sanitize
func Sanitize(query string) string { if matches := sanitizeSetPassword.FindAllStringSubmatchIndex(query, -1); matches != nil { var buf bytes.Buffer i := 0 for _, match := range matches { buf.WriteString(query[i:match[2]]) buf.WriteString("[REDACTED]") i = match[3] } buf.WriteString(query[i:]) quer...
go
func Sanitize(query string) string { if matches := sanitizeSetPassword.FindAllStringSubmatchIndex(query, -1); matches != nil { var buf bytes.Buffer i := 0 for _, match := range matches { buf.WriteString(query[i:match[2]]) buf.WriteString("[REDACTED]") i = match[3] } buf.WriteString(query[i:]) quer...
[ "func", "Sanitize", "(", "query", "string", ")", "string", "{", "if", "matches", ":=", "sanitizeSetPassword", ".", "FindAllStringSubmatchIndex", "(", "query", ",", "-", "1", ")", ";", "matches", "!=", "nil", "{", "var", "buf", "bytes", ".", "Buffer", "\n",...
// Sanitize attempts to sanitize passwords out of a raw query. // It looks for patterns that may be related to the SET PASSWORD and CREATE USER // statements and will redact the password that should be there. It will attempt // to redact information from common invalid queries too, but it's not guaranteed // to succeed...
[ "Sanitize", "attempts", "to", "sanitize", "passwords", "out", "of", "a", "raw", "query", ".", "It", "looks", "for", "patterns", "that", "may", "be", "related", "to", "the", "SET", "PASSWORD", "and", "CREATE", "USER", "statements", "and", "will", "redact", ...
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/sanitize.go#L22-L47
132,977
influxdata/influxql
ast.go
InspectDataType
func InspectDataType(v interface{}) DataType { switch v.(type) { case float64: return Float case int64, int32, int: return Integer case string: return String case bool: return Boolean case uint64: return Unsigned case time.Time: return Time case time.Duration: return Duration default: return Un...
go
func InspectDataType(v interface{}) DataType { switch v.(type) { case float64: return Float case int64, int32, int: return Integer case string: return String case bool: return Boolean case uint64: return Unsigned case time.Time: return Time case time.Duration: return Duration default: return Un...
[ "func", "InspectDataType", "(", "v", "interface", "{", "}", ")", "DataType", "{", "switch", "v", ".", "(", "type", ")", "{", "case", "float64", ":", "return", "Float", "\n", "case", "int64", ",", "int32", ",", "int", ":", "return", "Integer", "\n", "...
// InspectDataType returns the data type of a given value.
[ "InspectDataType", "returns", "the", "data", "type", "of", "a", "given", "value", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L76-L95
132,978
influxdata/influxql
ast.go
DataTypeFromString
func DataTypeFromString(s string) DataType { switch s { case "float": return Float case "integer": return Integer case "unsigned": return Unsigned case "string": return String case "boolean": return Boolean case "time": return Time case "duration": return Duration case "tag": return Tag case "...
go
func DataTypeFromString(s string) DataType { switch s { case "float": return Float case "integer": return Integer case "unsigned": return Unsigned case "string": return String case "boolean": return Boolean case "time": return Time case "duration": return Duration case "tag": return Tag case "...
[ "func", "DataTypeFromString", "(", "s", "string", ")", "DataType", "{", "switch", "s", "{", "case", "\"", "\"", ":", "return", "Float", "\n", "case", "\"", "\"", ":", "return", "Integer", "\n", "case", "\"", "\"", ":", "return", "Unsigned", "\n", "case...
// DataTypeFromString returns a data type given the string representation of that // data type.
[ "DataTypeFromString", "returns", "a", "data", "type", "given", "the", "string", "representation", "of", "that", "data", "type", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L99-L122
132,979
influxdata/influxql
ast.go
Zero
func (d DataType) Zero() interface{} { switch d { case Float: return zeroFloat64 case Integer: return zeroInt64 case Unsigned: return zeroUint64 case String, Tag: return zeroString case Boolean: return zeroBoolean case Time: return zeroTime case Duration: return zeroDuration } return nil }
go
func (d DataType) Zero() interface{} { switch d { case Float: return zeroFloat64 case Integer: return zeroInt64 case Unsigned: return zeroUint64 case String, Tag: return zeroString case Boolean: return zeroBoolean case Time: return zeroTime case Duration: return zeroDuration } return nil }
[ "func", "(", "d", "DataType", ")", "Zero", "(", ")", "interface", "{", "}", "{", "switch", "d", "{", "case", "Float", ":", "return", "zeroFloat64", "\n", "case", "Integer", ":", "return", "zeroInt64", "\n", "case", "Unsigned", ":", "return", "zeroUint64"...
// Zero returns the zero value for the DataType. // The return value of this method, when sent back to InspectDataType, // may not produce the same value.
[ "Zero", "returns", "the", "zero", "value", "for", "the", "DataType", ".", "The", "return", "value", "of", "this", "method", "when", "sent", "back", "to", "InspectDataType", "may", "not", "produce", "the", "same", "value", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L154-L172
132,980
influxdata/influxql
ast.go
String
func (d DataType) String() string { switch d { case Float: return "float" case Integer: return "integer" case Unsigned: return "unsigned" case String: return "string" case Boolean: return "boolean" case Time: return "time" case Duration: return "duration" case Tag: return "tag" case AnyField: ...
go
func (d DataType) String() string { switch d { case Float: return "float" case Integer: return "integer" case Unsigned: return "unsigned" case String: return "string" case Boolean: return "boolean" case Time: return "time" case Duration: return "duration" case Tag: return "tag" case AnyField: ...
[ "func", "(", "d", "DataType", ")", "String", "(", ")", "string", "{", "switch", "d", "{", "case", "Float", ":", "return", "\"", "\"", "\n", "case", "Integer", ":", "return", "\"", "\"", "\n", "case", "Unsigned", ":", "return", "\"", "\"", "\n", "ca...
// String returns the human-readable string representation of the DataType.
[ "String", "returns", "the", "human", "-", "readable", "string", "representation", "of", "the", "DataType", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L175-L197
132,981
influxdata/influxql
ast.go
String
func (a Statements) String() string { var str []string for _, stmt := range a { str = append(str, stmt.String()) } return strings.Join(str, ";\n") }
go
func (a Statements) String() string { var str []string for _, stmt := range a { str = append(str, stmt.String()) } return strings.Join(str, ";\n") }
[ "func", "(", "a", "Statements", ")", "String", "(", ")", "string", "{", "var", "str", "[", "]", "string", "\n", "for", "_", ",", "stmt", ":=", "range", "a", "{", "str", "=", "append", "(", "str", ",", "stmt", ".", "String", "(", ")", ")", "\n",...
// String returns a string representation of the statements.
[ "String", "returns", "a", "string", "representation", "of", "the", "statements", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L297-L303
132,982
influxdata/influxql
ast.go
String
func (a Sources) String() string { var buf bytes.Buffer ubound := len(a) - 1 for i, src := range a { _, _ = buf.WriteString(src.String()) if i < ubound { _, _ = buf.WriteString(", ") } } return buf.String() }
go
func (a Sources) String() string { var buf bytes.Buffer ubound := len(a) - 1 for i, src := range a { _, _ = buf.WriteString(src.String()) if i < ubound { _, _ = buf.WriteString(", ") } } return buf.String() }
[ "func", "(", "a", "Sources", ")", "String", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n\n", "ubound", ":=", "len", "(", "a", ")", "-", "1", "\n", "for", "i", ",", "src", ":=", "range", "a", "{", "_", ",", "_", "=", "buf...
// String returns a string representation of a Sources array.
[ "String", "returns", "a", "string", "representation", "of", "a", "Sources", "array", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L446-L458
132,983
influxdata/influxql
ast.go
Measurements
func (a Sources) Measurements() []*Measurement { mms := make([]*Measurement, 0, len(a)) for _, src := range a { switch src := src.(type) { case *Measurement: mms = append(mms, src) case *SubQuery: mms = append(mms, src.Statement.Sources.Measurements()...) } } return mms }
go
func (a Sources) Measurements() []*Measurement { mms := make([]*Measurement, 0, len(a)) for _, src := range a { switch src := src.(type) { case *Measurement: mms = append(mms, src) case *SubQuery: mms = append(mms, src.Statement.Sources.Measurements()...) } } return mms }
[ "func", "(", "a", "Sources", ")", "Measurements", "(", ")", "[", "]", "*", "Measurement", "{", "mms", ":=", "make", "(", "[", "]", "*", "Measurement", ",", "0", ",", "len", "(", "a", ")", ")", "\n", "for", "_", ",", "src", ":=", "range", "a", ...
// Measurements returns all measurements including ones embedded in subqueries.
[ "Measurements", "returns", "all", "measurements", "including", "ones", "embedded", "in", "subqueries", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L461-L472
132,984
influxdata/influxql
ast.go
MarshalBinary
func (a Sources) MarshalBinary() ([]byte, error) { var pb internal.Measurements pb.Items = make([]*internal.Measurement, len(a)) for i, source := range a { pb.Items[i] = encodeMeasurement(source.(*Measurement)) } return proto.Marshal(&pb) }
go
func (a Sources) MarshalBinary() ([]byte, error) { var pb internal.Measurements pb.Items = make([]*internal.Measurement, len(a)) for i, source := range a { pb.Items[i] = encodeMeasurement(source.(*Measurement)) } return proto.Marshal(&pb) }
[ "func", "(", "a", "Sources", ")", "MarshalBinary", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "pb", "internal", ".", "Measurements", "\n", "pb", ".", "Items", "=", "make", "(", "[", "]", "*", "internal", ".", "Measurement", ","...
// MarshalBinary encodes a list of sources to a binary format.
[ "MarshalBinary", "encodes", "a", "list", "of", "sources", "to", "a", "binary", "format", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L475-L482
132,985
influxdata/influxql
ast.go
UnmarshalBinary
func (a *Sources) UnmarshalBinary(buf []byte) error { var pb internal.Measurements if err := proto.Unmarshal(buf, &pb); err != nil { return err } *a = make(Sources, len(pb.GetItems())) for i := range pb.GetItems() { mm, err := decodeMeasurement(pb.GetItems()[i]) if err != nil { return err } (*a)[i] = ...
go
func (a *Sources) UnmarshalBinary(buf []byte) error { var pb internal.Measurements if err := proto.Unmarshal(buf, &pb); err != nil { return err } *a = make(Sources, len(pb.GetItems())) for i := range pb.GetItems() { mm, err := decodeMeasurement(pb.GetItems()[i]) if err != nil { return err } (*a)[i] = ...
[ "func", "(", "a", "*", "Sources", ")", "UnmarshalBinary", "(", "buf", "[", "]", "byte", ")", "error", "{", "var", "pb", "internal", ".", "Measurements", "\n", "if", "err", ":=", "proto", ".", "Unmarshal", "(", "buf", ",", "&", "pb", ")", ";", "err"...
// UnmarshalBinary decodes binary data into a list of sources.
[ "UnmarshalBinary", "decodes", "binary", "data", "into", "a", "list", "of", "sources", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L485-L499
132,986
influxdata/influxql
ast.go
RequiredPrivileges
func (a Sources) RequiredPrivileges() (ExecutionPrivileges, error) { var ep ExecutionPrivileges for _, source := range a { switch source := source.(type) { case *Measurement: ep = append(ep, ExecutionPrivilege{ Name: source.Database, Privilege: ReadPrivilege, }) case *SubQuery: privs, err ...
go
func (a Sources) RequiredPrivileges() (ExecutionPrivileges, error) { var ep ExecutionPrivileges for _, source := range a { switch source := source.(type) { case *Measurement: ep = append(ep, ExecutionPrivilege{ Name: source.Database, Privilege: ReadPrivilege, }) case *SubQuery: privs, err ...
[ "func", "(", "a", "Sources", ")", "RequiredPrivileges", "(", ")", "(", "ExecutionPrivileges", ",", "error", ")", "{", "var", "ep", "ExecutionPrivileges", "\n", "for", "_", ",", "source", ":=", "range", "a", "{", "switch", "source", ":=", "source", ".", "...
// RequiredPrivileges recursively returns a list of execution privileges required.
[ "RequiredPrivileges", "recursively", "returns", "a", "list", "of", "execution", "privileges", "required", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L502-L522
132,987
influxdata/influxql
ast.go
String
func (field *SortField) String() string { var buf bytes.Buffer if field.Name != "" { _, _ = buf.WriteString(field.Name) _, _ = buf.WriteString(" ") } if field.Ascending { _, _ = buf.WriteString("ASC") } else { _, _ = buf.WriteString("DESC") } return buf.String() }
go
func (field *SortField) String() string { var buf bytes.Buffer if field.Name != "" { _, _ = buf.WriteString(field.Name) _, _ = buf.WriteString(" ") } if field.Ascending { _, _ = buf.WriteString("ASC") } else { _, _ = buf.WriteString("DESC") } return buf.String() }
[ "func", "(", "field", "*", "SortField", ")", "String", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "if", "field", ".", "Name", "!=", "\"", "\"", "{", "_", ",", "_", "=", "buf", ".", "WriteString", "(", "field", ".", "Name...
// String returns a string representation of a sort field.
[ "String", "returns", "a", "string", "representation", "of", "a", "sort", "field", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L550-L562
132,988
influxdata/influxql
ast.go
String
func (a SortFields) String() string { fields := make([]string, 0, len(a)) for _, field := range a { fields = append(fields, field.String()) } return strings.Join(fields, ", ") }
go
func (a SortFields) String() string { fields := make([]string, 0, len(a)) for _, field := range a { fields = append(fields, field.String()) } return strings.Join(fields, ", ") }
[ "func", "(", "a", "SortFields", ")", "String", "(", ")", "string", "{", "fields", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "a", ")", ")", "\n", "for", "_", ",", "field", ":=", "range", "a", "{", "fields", "=", "append",...
// String returns a string representation of sort fields.
[ "String", "returns", "a", "string", "representation", "of", "sort", "fields", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L568-L574
132,989
influxdata/influxql
ast.go
String
func (s *CreateDatabaseStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("CREATE DATABASE ") _, _ = buf.WriteString(QuoteIdent(s.Name)) if s.RetentionPolicyCreate { _, _ = buf.WriteString(" WITH") if s.RetentionPolicyDuration != nil { _, _ = buf.WriteString(" DURATION ") _, _ = buf....
go
func (s *CreateDatabaseStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("CREATE DATABASE ") _, _ = buf.WriteString(QuoteIdent(s.Name)) if s.RetentionPolicyCreate { _, _ = buf.WriteString(" WITH") if s.RetentionPolicyDuration != nil { _, _ = buf.WriteString(" DURATION ") _, _ = buf....
[ "func", "(", "s", "*", "CreateDatabaseStatement", ")", "String", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "_", ",", "_", "=", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "_", ",", "_", "=", "buf", ".", "Writ...
// String returns a string representation of the create database statement.
[ "String", "returns", "a", "string", "representation", "of", "the", "create", "database", "statement", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L598-L623
132,990
influxdata/influxql
ast.go
String
func (s *DropRetentionPolicyStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("DROP RETENTION POLICY ") _, _ = buf.WriteString(QuoteIdent(s.Name)) _, _ = buf.WriteString(" ON ") _, _ = buf.WriteString(QuoteIdent(s.Database)) return buf.String() }
go
func (s *DropRetentionPolicyStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("DROP RETENTION POLICY ") _, _ = buf.WriteString(QuoteIdent(s.Name)) _, _ = buf.WriteString(" ON ") _, _ = buf.WriteString(QuoteIdent(s.Database)) return buf.String() }
[ "func", "(", "s", "*", "DropRetentionPolicyStatement", ")", "String", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "_", ",", "_", "=", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "_", ",", "_", "=", "buf", ".", ...
// String returns a string representation of the drop retention policy statement.
[ "String", "returns", "a", "string", "representation", "of", "the", "drop", "retention", "policy", "statement", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L659-L666
132,991
influxdata/influxql
ast.go
String
func (s *CreateUserStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("CREATE USER ") _, _ = buf.WriteString(QuoteIdent(s.Name)) _, _ = buf.WriteString(" WITH PASSWORD ") _, _ = buf.WriteString("[REDACTED]") if s.Admin { _, _ = buf.WriteString(" WITH ALL PRIVILEGES") } return buf.String(...
go
func (s *CreateUserStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("CREATE USER ") _, _ = buf.WriteString(QuoteIdent(s.Name)) _, _ = buf.WriteString(" WITH PASSWORD ") _, _ = buf.WriteString("[REDACTED]") if s.Admin { _, _ = buf.WriteString(" WITH ALL PRIVILEGES") } return buf.String(...
[ "func", "(", "s", "*", "CreateUserStatement", ")", "String", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "_", ",", "_", "=", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "_", ",", "_", "=", "buf", ".", "WriteStr...
// String returns a string representation of the create user statement.
[ "String", "returns", "a", "string", "representation", "of", "the", "create", "user", "statement", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L691-L701
132,992
influxdata/influxql
ast.go
String
func (s *GrantAdminStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("GRANT ALL PRIVILEGES TO ") _, _ = buf.WriteString(QuoteIdent(s.User)) return buf.String() }
go
func (s *GrantAdminStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("GRANT ALL PRIVILEGES TO ") _, _ = buf.WriteString(QuoteIdent(s.User)) return buf.String() }
[ "func", "(", "s", "*", "GrantAdminStatement", ")", "String", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "_", ",", "_", "=", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "_", ",", "_", "=", "buf", ".", "WriteStr...
// String returns a string representation of the grant admin statement.
[ "String", "returns", "a", "string", "representation", "of", "the", "grant", "admin", "statement", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L800-L805
132,993
influxdata/influxql
ast.go
String
func (s *KillQueryStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("KILL QUERY ") _, _ = buf.WriteString(strconv.FormatUint(s.QueryID, 10)) if s.Host != "" { _, _ = buf.WriteString(" ON ") _, _ = buf.WriteString(QuoteIdent(s.Host)) } return buf.String() }
go
func (s *KillQueryStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("KILL QUERY ") _, _ = buf.WriteString(strconv.FormatUint(s.QueryID, 10)) if s.Host != "" { _, _ = buf.WriteString(" ON ") _, _ = buf.WriteString(QuoteIdent(s.Host)) } return buf.String() }
[ "func", "(", "s", "*", "KillQueryStatement", ")", "String", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "_", ",", "_", "=", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "_", ",", "_", "=", "buf", ".", "WriteStri...
// String returns a string representation of the kill query statement.
[ "String", "returns", "a", "string", "representation", "of", "the", "kill", "query", "statement", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L822-L831
132,994
influxdata/influxql
ast.go
String
func (s *SetPasswordUserStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("SET PASSWORD FOR ") _, _ = buf.WriteString(QuoteIdent(s.Name)) _, _ = buf.WriteString(" = ") _, _ = buf.WriteString("[REDACTED]") return buf.String() }
go
func (s *SetPasswordUserStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("SET PASSWORD FOR ") _, _ = buf.WriteString(QuoteIdent(s.Name)) _, _ = buf.WriteString(" = ") _, _ = buf.WriteString("[REDACTED]") return buf.String() }
[ "func", "(", "s", "*", "SetPasswordUserStatement", ")", "String", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "_", ",", "_", "=", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "_", ",", "_", "=", "buf", ".", "Wri...
// String returns a string representation of the set password statement.
[ "String", "returns", "a", "string", "representation", "of", "the", "set", "password", "statement", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L848-L855
132,995
influxdata/influxql
ast.go
String
func (s *RevokeStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("REVOKE ") _, _ = buf.WriteString(s.Privilege.String()) _, _ = buf.WriteString(" ON ") _, _ = buf.WriteString(QuoteIdent(s.On)) _, _ = buf.WriteString(" FROM ") _, _ = buf.WriteString(QuoteIdent(s.User)) return buf.String() ...
go
func (s *RevokeStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("REVOKE ") _, _ = buf.WriteString(s.Privilege.String()) _, _ = buf.WriteString(" ON ") _, _ = buf.WriteString(QuoteIdent(s.On)) _, _ = buf.WriteString(" FROM ") _, _ = buf.WriteString(QuoteIdent(s.User)) return buf.String() ...
[ "func", "(", "s", "*", "RevokeStatement", ")", "String", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "_", ",", "_", "=", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "_", ",", "_", "=", "buf", ".", "WriteString"...
// String returns a string representation of the revoke statement.
[ "String", "returns", "a", "string", "representation", "of", "the", "revoke", "statement", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L875-L884
132,996
influxdata/influxql
ast.go
String
func (s *AlterRetentionPolicyStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("ALTER RETENTION POLICY ") _, _ = buf.WriteString(QuoteIdent(s.Name)) _, _ = buf.WriteString(" ON ") _, _ = buf.WriteString(QuoteIdent(s.Database)) if s.Duration != nil { _, _ = buf.WriteString(" DURATION ") ...
go
func (s *AlterRetentionPolicyStatement) String() string { var buf bytes.Buffer _, _ = buf.WriteString("ALTER RETENTION POLICY ") _, _ = buf.WriteString(QuoteIdent(s.Name)) _, _ = buf.WriteString(" ON ") _, _ = buf.WriteString(QuoteIdent(s.Database)) if s.Duration != nil { _, _ = buf.WriteString(" DURATION ") ...
[ "func", "(", "s", "*", "AlterRetentionPolicyStatement", ")", "String", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "_", ",", "_", "=", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "_", ",", "_", "=", "buf", ".", ...
// String returns a string representation of the alter retention policy statement.
[ "String", "returns", "a", "string", "representation", "of", "the", "alter", "retention", "policy", "statement", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L989-L1016
132,997
influxdata/influxql
ast.go
TimeAscending
func (s *SelectStatement) TimeAscending() bool { return len(s.SortFields) == 0 || s.SortFields[0].Ascending }
go
func (s *SelectStatement) TimeAscending() bool { return len(s.SortFields) == 0 || s.SortFields[0].Ascending }
[ "func", "(", "s", "*", "SelectStatement", ")", "TimeAscending", "(", ")", "bool", "{", "return", "len", "(", "s", ".", "SortFields", ")", "==", "0", "||", "s", ".", "SortFields", "[", "0", "]", ".", "Ascending", "\n", "}" ]
// TimeAscending returns true if the time field is sorted in chronological order.
[ "TimeAscending", "returns", "true", "if", "the", "time", "field", "is", "sorted", "in", "chronological", "order", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L1108-L1110
132,998
influxdata/influxql
ast.go
Clone
func (s *SelectStatement) Clone() *SelectStatement { clone := *s clone.Fields = make(Fields, 0, len(s.Fields)) clone.Dimensions = make(Dimensions, 0, len(s.Dimensions)) clone.Sources = cloneSources(s.Sources) clone.SortFields = make(SortFields, 0, len(s.SortFields)) clone.Condition = CloneExpr(s.Condition) if s...
go
func (s *SelectStatement) Clone() *SelectStatement { clone := *s clone.Fields = make(Fields, 0, len(s.Fields)) clone.Dimensions = make(Dimensions, 0, len(s.Dimensions)) clone.Sources = cloneSources(s.Sources) clone.SortFields = make(SortFields, 0, len(s.SortFields)) clone.Condition = CloneExpr(s.Condition) if s...
[ "func", "(", "s", "*", "SelectStatement", ")", "Clone", "(", ")", "*", "SelectStatement", "{", "clone", ":=", "*", "s", "\n", "clone", ".", "Fields", "=", "make", "(", "Fields", ",", "0", ",", "len", "(", "s", ".", "Fields", ")", ")", "\n", "clon...
// Clone returns a deep copy of the statement.
[ "Clone", "returns", "a", "deep", "copy", "of", "the", "statement", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L1121-L1149
132,999
influxdata/influxql
ast.go
matchRegex
func matchRegex(re *syntax.Regexp) ([]string, bool) { // Exit if we see a case-insensitive flag as it is not something we support at this time. if re.Flags&syntax.FoldCase != 0 { return nil, false } switch re.Op { case syntax.OpLiteral: // We can rewrite this regex. return []string{string(re.Rune)}, true c...
go
func matchRegex(re *syntax.Regexp) ([]string, bool) { // Exit if we see a case-insensitive flag as it is not something we support at this time. if re.Flags&syntax.FoldCase != 0 { return nil, false } switch re.Op { case syntax.OpLiteral: // We can rewrite this regex. return []string{string(re.Rune)}, true c...
[ "func", "matchRegex", "(", "re", "*", "syntax", ".", "Regexp", ")", "(", "[", "]", "string", ",", "bool", ")", "{", "// Exit if we see a case-insensitive flag as it is not something we support at this time.", "if", "re", ".", "Flags", "&", "syntax", ".", "FoldCase",...
// matchRegex will match a regular expression to literals if possible.
[ "matchRegex", "will", "match", "a", "regular", "expression", "to", "literals", "if", "possible", "." ]
1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513
https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L1518-L1595