id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
137,900
bhoriuchi/go-bunyan
bunyan/logger.go
Child
func (l *Logger) Child(staticFields map[string]interface{}) Logger { newStaticFields := make(map[string]interface{}) // merge the static fields into the new logger for key, field := range l.staticFields { newStaticFields[string(key)] = field } for key, field := range staticFields { newStaticFields[string(key)...
go
func (l *Logger) Child(staticFields map[string]interface{}) Logger { newStaticFields := make(map[string]interface{}) // merge the static fields into the new logger for key, field := range l.staticFields { newStaticFields[string(key)] = field } for key, field := range staticFields { newStaticFields[string(key)...
[ "func", "(", "l", "*", "Logger", ")", "Child", "(", "staticFields", "map", "[", "string", "]", "interface", "{", "}", ")", "Logger", "{", "newStaticFields", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n\n", "// merge the...
// creates a new child logger with extra static fields
[ "creates", "a", "new", "child", "logger", "with", "extra", "static", "fields" ]
8815b5fdce8c649679da0123c957d4b5e4b6f8ca
https://github.com/bhoriuchi/go-bunyan/blob/8815b5fdce8c649679da0123c957d4b5e4b6f8ca/bunyan/logger.go#L101-L119
137,901
bhoriuchi/go-bunyan
bunyan/bunyan.go
CreateLogger
func CreateLogger(args ...interface{}) (Logger, error) { config := Config{} logger := Logger{} r := regexp.MustCompile(`bunyan.Config$`) if len(args) == 0 { return logger, fmt.Errorf("Create logger requires either a bunyan.Config or String argument") } // get hostname if hostname, err := os.Hostname(); err !...
go
func CreateLogger(args ...interface{}) (Logger, error) { config := Config{} logger := Logger{} r := regexp.MustCompile(`bunyan.Config$`) if len(args) == 0 { return logger, fmt.Errorf("Create logger requires either a bunyan.Config or String argument") } // get hostname if hostname, err := os.Hostname(); err !...
[ "func", "CreateLogger", "(", "args", "...", "interface", "{", "}", ")", "(", "Logger", ",", "error", ")", "{", "config", ":=", "Config", "{", "}", "\n", "logger", ":=", "Logger", "{", "}", "\n", "r", ":=", "regexp", ".", "MustCompile", "(", "`bunyan....
// CreateLogger creates a new bunyanLogger. // Either a Config or string can be passed as the only argument. // It returns a new Logger. If no errors were encountered, error will be nil.
[ "CreateLogger", "creates", "a", "new", "bunyanLogger", ".", "Either", "a", "Config", "or", "string", "can", "be", "passed", "as", "the", "only", "argument", ".", "It", "returns", "a", "new", "Logger", ".", "If", "no", "errors", "were", "encountered", "erro...
8815b5fdce8c649679da0123c957d4b5e4b6f8ca
https://github.com/bhoriuchi/go-bunyan/blob/8815b5fdce8c649679da0123c957d4b5e4b6f8ca/bunyan/bunyan.go#L25-L71
137,902
alecthomas/template
parse/lex.go
lexText
func lexText(l *lexer) stateFn { for { if strings.HasPrefix(l.input[l.pos:], l.leftDelim) { if l.pos > l.start { l.emit(itemText) } return lexLeftDelim } if l.next() == eof { break } } // Correctly reached EOF. if l.pos > l.start { l.emit(itemText) } l.emit(itemEOF) return nil }
go
func lexText(l *lexer) stateFn { for { if strings.HasPrefix(l.input[l.pos:], l.leftDelim) { if l.pos > l.start { l.emit(itemText) } return lexLeftDelim } if l.next() == eof { break } } // Correctly reached EOF. if l.pos > l.start { l.emit(itemText) } l.emit(itemEOF) return nil }
[ "func", "lexText", "(", "l", "*", "lexer", ")", "stateFn", "{", "for", "{", "if", "strings", ".", "HasPrefix", "(", "l", ".", "input", "[", "l", ".", "pos", ":", "]", ",", "l", ".", "leftDelim", ")", "{", "if", "l", ".", "pos", ">", "l", ".",...
// lexText scans until an opening action delimiter, "{{".
[ "lexText", "scans", "until", "an", "opening", "action", "delimiter", "{{", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/parse/lex.go#L213-L231
137,903
alecthomas/template
parse/lex.go
lexLeftDelim
func lexLeftDelim(l *lexer) stateFn { l.pos += Pos(len(l.leftDelim)) if strings.HasPrefix(l.input[l.pos:], leftComment) { return lexComment } l.emit(itemLeftDelim) l.parenDepth = 0 return lexInsideAction }
go
func lexLeftDelim(l *lexer) stateFn { l.pos += Pos(len(l.leftDelim)) if strings.HasPrefix(l.input[l.pos:], leftComment) { return lexComment } l.emit(itemLeftDelim) l.parenDepth = 0 return lexInsideAction }
[ "func", "lexLeftDelim", "(", "l", "*", "lexer", ")", "stateFn", "{", "l", ".", "pos", "+=", "Pos", "(", "len", "(", "l", ".", "leftDelim", ")", ")", "\n", "if", "strings", ".", "HasPrefix", "(", "l", ".", "input", "[", "l", ".", "pos", ":", "]"...
// lexLeftDelim scans the left delimiter, which is known to be present.
[ "lexLeftDelim", "scans", "the", "left", "delimiter", "which", "is", "known", "to", "be", "present", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/parse/lex.go#L234-L242
137,904
alecthomas/template
parse/parse.go
Parse
func Parse(name, text, leftDelim, rightDelim string, funcs ...map[string]interface{}) (treeSet map[string]*Tree, err error) { treeSet = make(map[string]*Tree) t := New(name) t.text = text _, err = t.Parse(text, leftDelim, rightDelim, treeSet, funcs...) return }
go
func Parse(name, text, leftDelim, rightDelim string, funcs ...map[string]interface{}) (treeSet map[string]*Tree, err error) { treeSet = make(map[string]*Tree) t := New(name) t.text = text _, err = t.Parse(text, leftDelim, rightDelim, treeSet, funcs...) return }
[ "func", "Parse", "(", "name", ",", "text", ",", "leftDelim", ",", "rightDelim", "string", ",", "funcs", "...", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "treeSet", "map", "[", "string", "]", "*", "Tree", ",", "err", "error", ")", ...
// Parse returns a map from template name to parse.Tree, created by parsing the // templates described in the argument string. The top-level template will be // given the specified name. If an error is encountered, parsing stops and an // empty map is returned with the error.
[ "Parse", "returns", "a", "map", "from", "template", "name", "to", "parse", ".", "Tree", "created", "by", "parsing", "the", "templates", "described", "in", "the", "argument", "string", ".", "The", "top", "-", "level", "template", "will", "be", "given", "the...
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/parse/parse.go#L50-L56
137,905
alecthomas/template
parse/parse.go
New
func New(name string, funcs ...map[string]interface{}) *Tree { return &Tree{ Name: name, funcs: funcs, } }
go
func New(name string, funcs ...map[string]interface{}) *Tree { return &Tree{ Name: name, funcs: funcs, } }
[ "func", "New", "(", "name", "string", ",", "funcs", "...", "map", "[", "string", "]", "interface", "{", "}", ")", "*", "Tree", "{", "return", "&", "Tree", "{", "Name", ":", "name", ",", "funcs", ":", "funcs", ",", "}", "\n", "}" ]
// Parsing. // New allocates a new parse tree with the given name.
[ "Parsing", ".", "New", "allocates", "a", "new", "parse", "tree", "with", "the", "given", "name", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/parse/parse.go#L124-L129
137,906
alecthomas/template
parse/parse.go
ErrorContext
func (t *Tree) ErrorContext(n Node) (location, context string) { pos := int(n.Position()) tree := n.tree() if tree == nil { tree = t } text := tree.text[:pos] byteNum := strings.LastIndex(text, "\n") if byteNum == -1 { byteNum = pos // On first line. } else { byteNum++ // After the newline. byteNum = po...
go
func (t *Tree) ErrorContext(n Node) (location, context string) { pos := int(n.Position()) tree := n.tree() if tree == nil { tree = t } text := tree.text[:pos] byteNum := strings.LastIndex(text, "\n") if byteNum == -1 { byteNum = pos // On first line. } else { byteNum++ // After the newline. byteNum = po...
[ "func", "(", "t", "*", "Tree", ")", "ErrorContext", "(", "n", "Node", ")", "(", "location", ",", "context", "string", ")", "{", "pos", ":=", "int", "(", "n", ".", "Position", "(", ")", ")", "\n", "tree", ":=", "n", ".", "tree", "(", ")", "\n", ...
// ErrorContext returns a textual representation of the location of the node in the input text. // The receiver is only used when the node does not have a pointer to the tree inside, // which can occur in old code.
[ "ErrorContext", "returns", "a", "textual", "representation", "of", "the", "location", "of", "the", "node", "in", "the", "input", "text", ".", "The", "receiver", "is", "only", "used", "when", "the", "node", "does", "not", "have", "a", "pointer", "to", "the"...
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/parse/parse.go#L134-L154
137,907
alecthomas/template
parse/parse.go
stopParse
func (t *Tree) stopParse() { t.lex = nil t.vars = nil t.funcs = nil }
go
func (t *Tree) stopParse() { t.lex = nil t.vars = nil t.funcs = nil }
[ "func", "(", "t", "*", "Tree", ")", "stopParse", "(", ")", "{", "t", ".", "lex", "=", "nil", "\n", "t", ".", "vars", "=", "nil", "\n", "t", ".", "funcs", "=", "nil", "\n", "}" ]
// stopParse terminates parsing.
[ "stopParse", "terminates", "parsing", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/parse/parse.go#L215-L219
137,908
alecthomas/template
parse/parse.go
add
func (t *Tree) add(treeSet map[string]*Tree) { tree := treeSet[t.Name] if tree == nil || IsEmptyTree(tree.Root) { treeSet[t.Name] = t return } if !IsEmptyTree(t.Root) { t.errorf("template: multiple definition of template %q", t.Name) } }
go
func (t *Tree) add(treeSet map[string]*Tree) { tree := treeSet[t.Name] if tree == nil || IsEmptyTree(tree.Root) { treeSet[t.Name] = t return } if !IsEmptyTree(t.Root) { t.errorf("template: multiple definition of template %q", t.Name) } }
[ "func", "(", "t", "*", "Tree", ")", "add", "(", "treeSet", "map", "[", "string", "]", "*", "Tree", ")", "{", "tree", ":=", "treeSet", "[", "t", ".", "Name", "]", "\n", "if", "tree", "==", "nil", "||", "IsEmptyTree", "(", "tree", ".", "Root", ")...
// add adds tree to the treeSet.
[ "add", "adds", "tree", "to", "the", "treeSet", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/parse/parse.go#L237-L246
137,909
alecthomas/template
parse/parse.go
hasFunction
func (t *Tree) hasFunction(name string) bool { for _, funcMap := range t.funcs { if funcMap == nil { continue } if funcMap[name] != nil { return true } } return false }
go
func (t *Tree) hasFunction(name string) bool { for _, funcMap := range t.funcs { if funcMap == nil { continue } if funcMap[name] != nil { return true } } return false }
[ "func", "(", "t", "*", "Tree", ")", "hasFunction", "(", "name", "string", ")", "bool", "{", "for", "_", ",", "funcMap", ":=", "range", "t", ".", "funcs", "{", "if", "funcMap", "==", "nil", "{", "continue", "\n", "}", "\n", "if", "funcMap", "[", "...
// hasFunction reports if a function name exists in the Tree's maps.
[ "hasFunction", "reports", "if", "a", "function", "name", "exists", "in", "the", "Tree", "s", "maps", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/parse/parse.go#L672-L682
137,910
alecthomas/template
parse/parse.go
popVars
func (t *Tree) popVars(n int) { t.vars = t.vars[:n] }
go
func (t *Tree) popVars(n int) { t.vars = t.vars[:n] }
[ "func", "(", "t", "*", "Tree", ")", "popVars", "(", "n", "int", ")", "{", "t", ".", "vars", "=", "t", ".", "vars", "[", ":", "n", "]", "\n", "}" ]
// popVars trims the variable list to the specified length
[ "popVars", "trims", "the", "variable", "list", "to", "the", "specified", "length" ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/parse/parse.go#L685-L687
137,911
alecthomas/template
parse/parse.go
useVar
func (t *Tree) useVar(pos Pos, name string) Node { v := t.newVariable(pos, name) for _, varName := range t.vars { if varName == v.Ident[0] { return v } } t.errorf("undefined variable %q", v.Ident[0]) return nil }
go
func (t *Tree) useVar(pos Pos, name string) Node { v := t.newVariable(pos, name) for _, varName := range t.vars { if varName == v.Ident[0] { return v } } t.errorf("undefined variable %q", v.Ident[0]) return nil }
[ "func", "(", "t", "*", "Tree", ")", "useVar", "(", "pos", "Pos", ",", "name", "string", ")", "Node", "{", "v", ":=", "t", ".", "newVariable", "(", "pos", ",", "name", ")", "\n", "for", "_", ",", "varName", ":=", "range", "t", ".", "vars", "{", ...
// useVar returns a node for a variable reference. It errors if the // variable is not defined.
[ "useVar", "returns", "a", "node", "for", "a", "variable", "reference", ".", "It", "errors", "if", "the", "variable", "is", "not", "defined", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/parse/parse.go#L691-L700
137,912
alecthomas/template
exec.go
push
func (s *state) push(name string, value reflect.Value) { s.vars = append(s.vars, variable{name, value}) }
go
func (s *state) push(name string, value reflect.Value) { s.vars = append(s.vars, variable{name, value}) }
[ "func", "(", "s", "*", "state", ")", "push", "(", "name", "string", ",", "value", "reflect", ".", "Value", ")", "{", "s", ".", "vars", "=", "append", "(", "s", ".", "vars", ",", "variable", "{", "name", ",", "value", "}", ")", "\n", "}" ]
// push pushes a new variable on the stack.
[ "push", "pushes", "a", "new", "variable", "on", "the", "stack", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/exec.go#L36-L38
137,913
alecthomas/template
exec.go
pop
func (s *state) pop(mark int) { s.vars = s.vars[0:mark] }
go
func (s *state) pop(mark int) { s.vars = s.vars[0:mark] }
[ "func", "(", "s", "*", "state", ")", "pop", "(", "mark", "int", ")", "{", "s", ".", "vars", "=", "s", ".", "vars", "[", "0", ":", "mark", "]", "\n", "}" ]
// pop pops the variable stack up to the mark.
[ "pop", "pops", "the", "variable", "stack", "up", "to", "the", "mark", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/exec.go#L46-L48
137,914
alecthomas/template
exec.go
setVar
func (s *state) setVar(n int, value reflect.Value) { s.vars[len(s.vars)-n].value = value }
go
func (s *state) setVar(n int, value reflect.Value) { s.vars[len(s.vars)-n].value = value }
[ "func", "(", "s", "*", "state", ")", "setVar", "(", "n", "int", ",", "value", "reflect", ".", "Value", ")", "{", "s", ".", "vars", "[", "len", "(", "s", ".", "vars", ")", "-", "n", "]", ".", "value", "=", "value", "\n", "}" ]
// setVar overwrites the top-nth variable on the stack. Used by range iterations.
[ "setVar", "overwrites", "the", "top", "-", "nth", "variable", "on", "the", "stack", ".", "Used", "by", "range", "iterations", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/exec.go#L51-L53
137,915
alecthomas/template
exec.go
varValue
func (s *state) varValue(name string) reflect.Value { for i := s.mark() - 1; i >= 0; i-- { if s.vars[i].name == name { return s.vars[i].value } } s.errorf("undefined variable: %s", name) return zero }
go
func (s *state) varValue(name string) reflect.Value { for i := s.mark() - 1; i >= 0; i-- { if s.vars[i].name == name { return s.vars[i].value } } s.errorf("undefined variable: %s", name) return zero }
[ "func", "(", "s", "*", "state", ")", "varValue", "(", "name", "string", ")", "reflect", ".", "Value", "{", "for", "i", ":=", "s", ".", "mark", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", "{", "if", "s", ".", "vars", "[", "i", ...
// varValue returns the value of the named variable.
[ "varValue", "returns", "the", "value", "of", "the", "named", "variable", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/exec.go#L56-L64
137,916
alecthomas/template
exec.go
doublePercent
func doublePercent(str string) string { if strings.Contains(str, "%") { str = strings.Replace(str, "%", "%%", -1) } return str }
go
func doublePercent(str string) string { if strings.Contains(str, "%") { str = strings.Replace(str, "%", "%%", -1) } return str }
[ "func", "doublePercent", "(", "str", "string", ")", "string", "{", "if", "strings", ".", "Contains", "(", "str", ",", "\"", "\"", ")", "{", "str", "=", "strings", ".", "Replace", "(", "str", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", ...
// doublePercent returns the string with %'s replaced by %%, if necessary, // so it can be used safely inside a Printf format string.
[ "doublePercent", "returns", "the", "string", "with", "%", "s", "replaced", "by", "%%", "if", "necessary", "so", "it", "can", "be", "used", "safely", "inside", "a", "Printf", "format", "string", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/exec.go#L75-L80
137,917
alecthomas/template
exec.go
ExecuteTemplate
func (t *Template) ExecuteTemplate(wr io.Writer, name string, data interface{}) error { tmpl := t.tmpl[name] if tmpl == nil { return fmt.Errorf("template: no template %q associated with template %q", name, t.name) } return tmpl.Execute(wr, data) }
go
func (t *Template) ExecuteTemplate(wr io.Writer, name string, data interface{}) error { tmpl := t.tmpl[name] if tmpl == nil { return fmt.Errorf("template: no template %q associated with template %q", name, t.name) } return tmpl.Execute(wr, data) }
[ "func", "(", "t", "*", "Template", ")", "ExecuteTemplate", "(", "wr", "io", ".", "Writer", ",", "name", "string", ",", "data", "interface", "{", "}", ")", "error", "{", "tmpl", ":=", "t", ".", "tmpl", "[", "name", "]", "\n", "if", "tmpl", "==", "...
// ExecuteTemplate applies the template associated with t that has the given name // to the specified data object and writes the output to wr. // If an error occurs executing the template or writing its output, // execution stops, but partial results may already have been written to // the output writer. // A template ...
[ "ExecuteTemplate", "applies", "the", "template", "associated", "with", "t", "that", "has", "the", "given", "name", "to", "the", "specified", "data", "object", "and", "writes", "the", "output", "to", "wr", ".", "If", "an", "error", "occurs", "executing", "the...
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/exec.go#L116-L122
137,918
alecthomas/template
exec.go
Execute
func (t *Template) Execute(wr io.Writer, data interface{}) (err error) { defer errRecover(&err) value := reflect.ValueOf(data) state := &state{ tmpl: t, wr: wr, vars: []variable{{"$", value}}, } t.init() if t.Tree == nil || t.Root == nil { var b bytes.Buffer for name, tmpl := range t.tmpl { if tmpl...
go
func (t *Template) Execute(wr io.Writer, data interface{}) (err error) { defer errRecover(&err) value := reflect.ValueOf(data) state := &state{ tmpl: t, wr: wr, vars: []variable{{"$", value}}, } t.init() if t.Tree == nil || t.Root == nil { var b bytes.Buffer for name, tmpl := range t.tmpl { if tmpl...
[ "func", "(", "t", "*", "Template", ")", "Execute", "(", "wr", "io", ".", "Writer", ",", "data", "interface", "{", "}", ")", "(", "err", "error", ")", "{", "defer", "errRecover", "(", "&", "err", ")", "\n", "value", ":=", "reflect", ".", "ValueOf", ...
// Execute applies a parsed template to the specified data object, // and writes the output to wr. // If an error occurs executing the template or writing its output, // execution stops, but partial results may already have been written to // the output writer. // A template may be executed safely in parallel.
[ "Execute", "applies", "a", "parsed", "template", "to", "the", "specified", "data", "object", "and", "writes", "the", "output", "to", "wr", ".", "If", "an", "error", "occurs", "executing", "the", "template", "or", "writing", "its", "output", "execution", "sto...
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/exec.go#L130-L158
137,919
alecthomas/template
exec.go
walk
func (s *state) walk(dot reflect.Value, node parse.Node) { s.at(node) switch node := node.(type) { case *parse.ActionNode: // Do not pop variables so they persist until next end. // Also, if the action declares variables, don't print the result. val := s.evalPipeline(dot, node.Pipe) if len(node.Pipe.Decl) ==...
go
func (s *state) walk(dot reflect.Value, node parse.Node) { s.at(node) switch node := node.(type) { case *parse.ActionNode: // Do not pop variables so they persist until next end. // Also, if the action declares variables, don't print the result. val := s.evalPipeline(dot, node.Pipe) if len(node.Pipe.Decl) ==...
[ "func", "(", "s", "*", "state", ")", "walk", "(", "dot", "reflect", ".", "Value", ",", "node", "parse", ".", "Node", ")", "{", "s", ".", "at", "(", "node", ")", "\n", "switch", "node", ":=", "node", ".", "(", "type", ")", "{", "case", "*", "p...
// Walk functions step through the major pieces of the template structure, // generating output as they go.
[ "Walk", "functions", "step", "through", "the", "major", "pieces", "of", "the", "template", "structure", "generating", "output", "as", "they", "go", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/exec.go#L162-L191
137,920
alecthomas/template
exec.go
walkIfOrWith
func (s *state) walkIfOrWith(typ parse.NodeType, dot reflect.Value, pipe *parse.PipeNode, list, elseList *parse.ListNode) { defer s.pop(s.mark()) val := s.evalPipeline(dot, pipe) truth, ok := isTrue(val) if !ok { s.errorf("if/with can't use %v", val) } if truth { if typ == parse.NodeWith { s.walk(val, list...
go
func (s *state) walkIfOrWith(typ parse.NodeType, dot reflect.Value, pipe *parse.PipeNode, list, elseList *parse.ListNode) { defer s.pop(s.mark()) val := s.evalPipeline(dot, pipe) truth, ok := isTrue(val) if !ok { s.errorf("if/with can't use %v", val) } if truth { if typ == parse.NodeWith { s.walk(val, list...
[ "func", "(", "s", "*", "state", ")", "walkIfOrWith", "(", "typ", "parse", ".", "NodeType", ",", "dot", "reflect", ".", "Value", ",", "pipe", "*", "parse", ".", "PipeNode", ",", "list", ",", "elseList", "*", "parse", ".", "ListNode", ")", "{", "defer"...
// walkIfOrWith walks an 'if' or 'with' node. The two control structures // are identical in behavior except that 'with' sets dot.
[ "walkIfOrWith", "walks", "an", "if", "or", "with", "node", ".", "The", "two", "control", "structures", "are", "identical", "in", "behavior", "except", "that", "with", "sets", "dot", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/exec.go#L195-L211
137,921
alecthomas/template
exec.go
evalPipeline
func (s *state) evalPipeline(dot reflect.Value, pipe *parse.PipeNode) (value reflect.Value) { if pipe == nil { return } s.at(pipe) for _, cmd := range pipe.Cmds { value = s.evalCommand(dot, cmd, value) // previous value is this one's final arg. // If the object has type interface{}, dig down one level to the ...
go
func (s *state) evalPipeline(dot reflect.Value, pipe *parse.PipeNode) (value reflect.Value) { if pipe == nil { return } s.at(pipe) for _, cmd := range pipe.Cmds { value = s.evalCommand(dot, cmd, value) // previous value is this one's final arg. // If the object has type interface{}, dig down one level to the ...
[ "func", "(", "s", "*", "state", ")", "evalPipeline", "(", "dot", "reflect", ".", "Value", ",", "pipe", "*", "parse", ".", "PipeNode", ")", "(", "value", "reflect", ".", "Value", ")", "{", "if", "pipe", "==", "nil", "{", "return", "\n", "}", "\n", ...
// Eval functions evaluate pipelines, commands, and their elements and extract // values from the data structure by examining fields, calling methods, and so on. // The printing of those values happens only through walk functions. // evalPipeline returns the value acquired by evaluating a pipeline. If the // pipeline h...
[ "Eval", "functions", "evaluate", "pipelines", "commands", "and", "their", "elements", "and", "extract", "values", "from", "the", "data", "structure", "by", "examining", "fields", "calling", "methods", "and", "so", "on", ".", "The", "printing", "of", "those", "...
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/exec.go#L327-L343
137,922
alecthomas/template
exec.go
idealConstant
func (s *state) idealConstant(constant *parse.NumberNode) reflect.Value { // These are ideal constants but we don't know the type // and we have no context. (If it was a method argument, // we'd know what we need.) The syntax guides us to some extent. s.at(constant) switch { case constant.IsComplex: return ref...
go
func (s *state) idealConstant(constant *parse.NumberNode) reflect.Value { // These are ideal constants but we don't know the type // and we have no context. (If it was a method argument, // we'd know what we need.) The syntax guides us to some extent. s.at(constant) switch { case constant.IsComplex: return ref...
[ "func", "(", "s", "*", "state", ")", "idealConstant", "(", "constant", "*", "parse", ".", "NumberNode", ")", "reflect", ".", "Value", "{", "// These are ideal constants but we don't know the type", "// and we have no context. (If it was a method argument,", "// we'd know wha...
// idealConstant is called to return the value of a number in a context where // we don't know the type. In that case, the syntax of the number tells us // its type, and we use Go rules to resolve. Note there is no such thing as // a uint ideal constant in this situation - the value must be of int type.
[ "idealConstant", "is", "called", "to", "return", "the", "value", "of", "a", "number", "in", "a", "context", "where", "we", "don", "t", "know", "the", "type", ".", "In", "that", "case", "the", "syntax", "of", "the", "number", "tells", "us", "its", "type...
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/exec.go#L389-L409
137,923
alecthomas/template
exec.go
evalFieldChain
func (s *state) evalFieldChain(dot, receiver reflect.Value, node parse.Node, ident []string, args []parse.Node, final reflect.Value) reflect.Value { n := len(ident) for i := 0; i < n-1; i++ { receiver = s.evalField(dot, ident[i], node, nil, zero, receiver) } // Now if it's a method, it gets the arguments. return...
go
func (s *state) evalFieldChain(dot, receiver reflect.Value, node parse.Node, ident []string, args []parse.Node, final reflect.Value) reflect.Value { n := len(ident) for i := 0; i < n-1; i++ { receiver = s.evalField(dot, ident[i], node, nil, zero, receiver) } // Now if it's a method, it gets the arguments. return...
[ "func", "(", "s", "*", "state", ")", "evalFieldChain", "(", "dot", ",", "receiver", "reflect", ".", "Value", ",", "node", "parse", ".", "Node", ",", "ident", "[", "]", "string", ",", "args", "[", "]", "parse", ".", "Node", ",", "final", "reflect", ...
// evalFieldChain evaluates .X.Y.Z possibly followed by arguments. // dot is the environment in which to evaluate arguments, while // receiver is the value being walked along the chain.
[ "evalFieldChain", "evaluates", ".", "X", ".", "Y", ".", "Z", "possibly", "followed", "by", "arguments", ".", "dot", "is", "the", "environment", "in", "which", "to", "evaluate", "arguments", "while", "receiver", "is", "the", "value", "being", "walked", "along...
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/exec.go#L444-L451
137,924
alecthomas/template
exec.go
validateType
func (s *state) validateType(value reflect.Value, typ reflect.Type) reflect.Value { if !value.IsValid() { if typ == nil || canBeNil(typ) { // An untyped nil interface{}. Accept as a proper nil value. return reflect.Zero(typ) } s.errorf("invalid value; expected %s", typ) } if typ != nil && !value.Type().A...
go
func (s *state) validateType(value reflect.Value, typ reflect.Type) reflect.Value { if !value.IsValid() { if typ == nil || canBeNil(typ) { // An untyped nil interface{}. Accept as a proper nil value. return reflect.Zero(typ) } s.errorf("invalid value; expected %s", typ) } if typ != nil && !value.Type().A...
[ "func", "(", "s", "*", "state", ")", "validateType", "(", "value", "reflect", ".", "Value", ",", "typ", "reflect", ".", "Type", ")", "reflect", ".", "Value", "{", "if", "!", "value", ".", "IsValid", "(", ")", "{", "if", "typ", "==", "nil", "||", ...
// validateType guarantees that the value is valid and assignable to the type.
[ "validateType", "guarantees", "that", "the", "value", "is", "valid", "and", "assignable", "to", "the", "type", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/exec.go#L587-L620
137,925
alecthomas/template
exec.go
printValue
func (s *state) printValue(n parse.Node, v reflect.Value) { s.at(n) iface, ok := printableValue(v) if !ok { s.errorf("can't print %s of type %s", n, v.Type()) } fmt.Fprint(s.wr, iface) }
go
func (s *state) printValue(n parse.Node, v reflect.Value) { s.at(n) iface, ok := printableValue(v) if !ok { s.errorf("can't print %s of type %s", n, v.Type()) } fmt.Fprint(s.wr, iface) }
[ "func", "(", "s", "*", "state", ")", "printValue", "(", "n", "parse", ".", "Node", ",", "v", "reflect", ".", "Value", ")", "{", "s", ".", "at", "(", "n", ")", "\n", "iface", ",", "ok", ":=", "printableValue", "(", "v", ")", "\n", "if", "!", "...
// printValue writes the textual representation of the value to the output of // the template.
[ "printValue", "writes", "the", "textual", "representation", "of", "the", "value", "to", "the", "output", "of", "the", "template", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/exec.go#L774-L781
137,926
alecthomas/template
template.go
Clone
func (t *Template) Clone() (*Template, error) { nt := t.copy(nil) nt.init() nt.tmpl[t.name] = nt for k, v := range t.tmpl { if k == t.name { // Already installed. continue } // The associated templates share nt's common structure. tmpl := v.copy(nt.common) nt.tmpl[k] = tmpl } for k, v := range t.pars...
go
func (t *Template) Clone() (*Template, error) { nt := t.copy(nil) nt.init() nt.tmpl[t.name] = nt for k, v := range t.tmpl { if k == t.name { // Already installed. continue } // The associated templates share nt's common structure. tmpl := v.copy(nt.common) nt.tmpl[k] = tmpl } for k, v := range t.pars...
[ "func", "(", "t", "*", "Template", ")", "Clone", "(", ")", "(", "*", "Template", ",", "error", ")", "{", "nt", ":=", "t", ".", "copy", "(", "nil", ")", "\n", "nt", ".", "init", "(", ")", "\n", "nt", ".", "tmpl", "[", "t", ".", "name", "]", ...
// Clone returns a duplicate of the template, including all associated // templates. The actual representation is not copied, but the name space of // associated templates is, so further calls to Parse in the copy will add // templates to the copy but not to the original. Clone can be used to prepare // common template...
[ "Clone", "returns", "a", "duplicate", "of", "the", "template", "including", "all", "associated", "templates", ".", "The", "actual", "representation", "is", "not", "copied", "but", "the", "name", "space", "of", "associated", "templates", "is", "so", "further", ...
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/template.go#L75-L94
137,927
alecthomas/template
template.go
copy
func (t *Template) copy(c *common) *Template { nt := New(t.name) nt.Tree = t.Tree nt.common = c nt.leftDelim = t.leftDelim nt.rightDelim = t.rightDelim return nt }
go
func (t *Template) copy(c *common) *Template { nt := New(t.name) nt.Tree = t.Tree nt.common = c nt.leftDelim = t.leftDelim nt.rightDelim = t.rightDelim return nt }
[ "func", "(", "t", "*", "Template", ")", "copy", "(", "c", "*", "common", ")", "*", "Template", "{", "nt", ":=", "New", "(", "t", ".", "name", ")", "\n", "nt", ".", "Tree", "=", "t", ".", "Tree", "\n", "nt", ".", "common", "=", "c", "\n", "n...
// copy returns a shallow copy of t, with common set to the argument.
[ "copy", "returns", "a", "shallow", "copy", "of", "t", "with", "common", "set", "to", "the", "argument", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/template.go#L97-L104
137,928
alecthomas/template
template.go
AddParseTree
func (t *Template) AddParseTree(name string, tree *parse.Tree) (*Template, error) { if t.common != nil && t.tmpl[name] != nil { return nil, fmt.Errorf("template: redefinition of template %q", name) } nt := t.New(name) nt.Tree = tree t.tmpl[name] = nt return nt, nil }
go
func (t *Template) AddParseTree(name string, tree *parse.Tree) (*Template, error) { if t.common != nil && t.tmpl[name] != nil { return nil, fmt.Errorf("template: redefinition of template %q", name) } nt := t.New(name) nt.Tree = tree t.tmpl[name] = nt return nt, nil }
[ "func", "(", "t", "*", "Template", ")", "AddParseTree", "(", "name", "string", ",", "tree", "*", "parse", ".", "Tree", ")", "(", "*", "Template", ",", "error", ")", "{", "if", "t", ".", "common", "!=", "nil", "&&", "t", ".", "tmpl", "[", "name", ...
// AddParseTree creates a new template with the name and parse tree // and associates it with t.
[ "AddParseTree", "creates", "a", "new", "template", "with", "the", "name", "and", "parse", "tree", "and", "associates", "it", "with", "t", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/template.go#L108-L116
137,929
alecthomas/template
template.go
Templates
func (t *Template) Templates() []*Template { if t.common == nil { return nil } // Return a slice so we don't expose the map. m := make([]*Template, 0, len(t.tmpl)) for _, v := range t.tmpl { m = append(m, v) } return m }
go
func (t *Template) Templates() []*Template { if t.common == nil { return nil } // Return a slice so we don't expose the map. m := make([]*Template, 0, len(t.tmpl)) for _, v := range t.tmpl { m = append(m, v) } return m }
[ "func", "(", "t", "*", "Template", ")", "Templates", "(", ")", "[", "]", "*", "Template", "{", "if", "t", ".", "common", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "// Return a slice so we don't expose the map.", "m", ":=", "make", "(", "[", "...
// Templates returns a slice of the templates associated with t, including t // itself.
[ "Templates", "returns", "a", "slice", "of", "the", "templates", "associated", "with", "t", "including", "t", "itself", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/template.go#L120-L130
137,930
alecthomas/template
template.go
Funcs
func (t *Template) Funcs(funcMap FuncMap) *Template { t.init() addValueFuncs(t.execFuncs, funcMap) addFuncs(t.parseFuncs, funcMap) return t }
go
func (t *Template) Funcs(funcMap FuncMap) *Template { t.init() addValueFuncs(t.execFuncs, funcMap) addFuncs(t.parseFuncs, funcMap) return t }
[ "func", "(", "t", "*", "Template", ")", "Funcs", "(", "funcMap", "FuncMap", ")", "*", "Template", "{", "t", ".", "init", "(", ")", "\n", "addValueFuncs", "(", "t", ".", "execFuncs", ",", "funcMap", ")", "\n", "addFuncs", "(", "t", ".", "parseFuncs", ...
// Funcs adds the elements of the argument map to the template's function map. // It panics if a value in the map is not a function with appropriate return // type. However, it is legal to overwrite elements of the map. The return // value is the template, so calls can be chained.
[ "Funcs", "adds", "the", "elements", "of", "the", "argument", "map", "to", "the", "template", "s", "function", "map", ".", "It", "panics", "if", "a", "value", "in", "the", "map", "is", "not", "a", "function", "with", "appropriate", "return", "type", ".", ...
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/template.go#L147-L152
137,931
alecthomas/template
template.go
Lookup
func (t *Template) Lookup(name string) *Template { if t.common == nil { return nil } return t.tmpl[name] }
go
func (t *Template) Lookup(name string) *Template { if t.common == nil { return nil } return t.tmpl[name] }
[ "func", "(", "t", "*", "Template", ")", "Lookup", "(", "name", "string", ")", "*", "Template", "{", "if", "t", ".", "common", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "t", ".", "tmpl", "[", "name", "]", "\n", "}" ]
// Lookup returns the template with the given name that is associated with t, // or nil if there is no such template.
[ "Lookup", "returns", "the", "template", "with", "the", "given", "name", "that", "is", "associated", "with", "t", "or", "nil", "if", "there", "is", "no", "such", "template", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/template.go#L156-L161
137,932
alecthomas/template
template.go
associate
func (t *Template) associate(new *Template, tree *parse.Tree) (bool, error) { if new.common != t.common { panic("internal error: associate not common") } name := new.name if old := t.tmpl[name]; old != nil { oldIsEmpty := parse.IsEmptyTree(old.Root) newIsEmpty := parse.IsEmptyTree(tree.Root) if newIsEmpty {...
go
func (t *Template) associate(new *Template, tree *parse.Tree) (bool, error) { if new.common != t.common { panic("internal error: associate not common") } name := new.name if old := t.tmpl[name]; old != nil { oldIsEmpty := parse.IsEmptyTree(old.Root) newIsEmpty := parse.IsEmptyTree(tree.Root) if newIsEmpty {...
[ "func", "(", "t", "*", "Template", ")", "associate", "(", "new", "*", "Template", ",", "tree", "*", "parse", ".", "Tree", ")", "(", "bool", ",", "error", ")", "{", "if", "new", ".", "common", "!=", "t", ".", "common", "{", "panic", "(", "\"", "...
// associate installs the new template into the group of templates associated // with t. It is an error to reuse a name except to overwrite an empty // template. The two are already known to share the common structure. // The boolean return value reports wither to store this tree as t.Tree.
[ "associate", "installs", "the", "new", "template", "into", "the", "group", "of", "templates", "associated", "with", "t", ".", "It", "is", "an", "error", "to", "reuse", "a", "name", "except", "to", "overwrite", "an", "empty", "template", ".", "The", "two", ...
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/template.go#L200-L218
137,933
alecthomas/template
helper.go
ParseFiles
func (t *Template) ParseFiles(filenames ...string) (*Template, error) { return parseFiles(t, filenames...) }
go
func (t *Template) ParseFiles(filenames ...string) (*Template, error) { return parseFiles(t, filenames...) }
[ "func", "(", "t", "*", "Template", ")", "ParseFiles", "(", "filenames", "...", "string", ")", "(", "*", "Template", ",", "error", ")", "{", "return", "parseFiles", "(", "t", ",", "filenames", "...", ")", "\n", "}" ]
// ParseFiles parses the named files and associates the resulting templates with // t. If an error occurs, parsing stops and the returned template is nil; // otherwise it is t. There must be at least one file.
[ "ParseFiles", "parses", "the", "named", "files", "and", "associates", "the", "resulting", "templates", "with", "t", ".", "If", "an", "error", "occurs", "parsing", "stops", "and", "the", "returned", "template", "is", "nil", ";", "otherwise", "it", "is", "t", ...
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/helper.go#L39-L41
137,934
alecthomas/template
helper.go
ParseGlob
func (t *Template) ParseGlob(pattern string) (*Template, error) { return parseGlob(t, pattern) }
go
func (t *Template) ParseGlob(pattern string) (*Template, error) { return parseGlob(t, pattern) }
[ "func", "(", "t", "*", "Template", ")", "ParseGlob", "(", "pattern", "string", ")", "(", "*", "Template", ",", "error", ")", "{", "return", "parseGlob", "(", "t", ",", "pattern", ")", "\n", "}" ]
// ParseGlob parses the template definitions in the files identified by the // pattern and associates the resulting templates with t. The pattern is // processed by filepath.Glob and must match at least one file. ParseGlob is // equivalent to calling t.ParseFiles with the list of files matched by the // pattern.
[ "ParseGlob", "parses", "the", "template", "definitions", "in", "the", "files", "identified", "by", "the", "pattern", "and", "associates", "the", "resulting", "templates", "with", "t", ".", "The", "pattern", "is", "processed", "by", "filepath", ".", "Glob", "an...
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/helper.go#L94-L96
137,935
alecthomas/template
helper.go
parseGlob
func parseGlob(t *Template, pattern string) (*Template, error) { filenames, err := filepath.Glob(pattern) if err != nil { return nil, err } if len(filenames) == 0 { return nil, fmt.Errorf("template: pattern matches no files: %#q", pattern) } return parseFiles(t, filenames...) }
go
func parseGlob(t *Template, pattern string) (*Template, error) { filenames, err := filepath.Glob(pattern) if err != nil { return nil, err } if len(filenames) == 0 { return nil, fmt.Errorf("template: pattern matches no files: %#q", pattern) } return parseFiles(t, filenames...) }
[ "func", "parseGlob", "(", "t", "*", "Template", ",", "pattern", "string", ")", "(", "*", "Template", ",", "error", ")", "{", "filenames", ",", "err", ":=", "filepath", ".", "Glob", "(", "pattern", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// parseGlob is the implementation of the function and method ParseGlob.
[ "parseGlob", "is", "the", "implementation", "of", "the", "function", "and", "method", "ParseGlob", "." ]
a0175ee3bccc567396460bf5acd36800cb10c49c
https://github.com/alecthomas/template/blob/a0175ee3bccc567396460bf5acd36800cb10c49c/helper.go#L99-L108
137,936
go-logfmt/logfmt
encode.go
MarshalKeyvals
func MarshalKeyvals(keyvals ...interface{}) ([]byte, error) { buf := &bytes.Buffer{} if err := NewEncoder(buf).EncodeKeyvals(keyvals...); err != nil { return nil, err } return buf.Bytes(), nil }
go
func MarshalKeyvals(keyvals ...interface{}) ([]byte, error) { buf := &bytes.Buffer{} if err := NewEncoder(buf).EncodeKeyvals(keyvals...); err != nil { return nil, err } return buf.Bytes(), nil }
[ "func", "MarshalKeyvals", "(", "keyvals", "...", "interface", "{", "}", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "buf", ":=", "&", "bytes", ".", "Buffer", "{", "}", "\n", "if", "err", ":=", "NewEncoder", "(", "buf", ")", ".", "EncodeKeyv...
// MarshalKeyvals returns the logfmt encoding of keyvals, a variadic sequence // of alternating keys and values.
[ "MarshalKeyvals", "returns", "the", "logfmt", "encoding", "of", "keyvals", "a", "variadic", "sequence", "of", "alternating", "keys", "and", "values", "." ]
07c9b44f60d7ffdfb7d8efe1ad539965737836dc
https://github.com/go-logfmt/logfmt/blob/07c9b44f60d7ffdfb7d8efe1ad539965737836dc/encode.go#L16-L22
137,937
go-logfmt/logfmt
encode.go
EncodeKeyval
func (enc *Encoder) EncodeKeyval(key, value interface{}) error { enc.scratch.Reset() if enc.needSep { if _, err := enc.scratch.Write(space); err != nil { return err } } if err := writeKey(&enc.scratch, key); err != nil { return err } if _, err := enc.scratch.Write(equals); err != nil { return err } i...
go
func (enc *Encoder) EncodeKeyval(key, value interface{}) error { enc.scratch.Reset() if enc.needSep { if _, err := enc.scratch.Write(space); err != nil { return err } } if err := writeKey(&enc.scratch, key); err != nil { return err } if _, err := enc.scratch.Write(equals); err != nil { return err } i...
[ "func", "(", "enc", "*", "Encoder", ")", "EncodeKeyval", "(", "key", ",", "value", "interface", "{", "}", ")", "error", "{", "enc", ".", "scratch", ".", "Reset", "(", ")", "\n", "if", "enc", ".", "needSep", "{", "if", "_", ",", "err", ":=", "enc"...
// EncodeKeyval writes the logfmt encoding of key and value to the stream. A // single space is written before the second and subsequent keys in a record. // Nothing is written if a non-nil error is returned.
[ "EncodeKeyval", "writes", "the", "logfmt", "encoding", "of", "key", "and", "value", "to", "the", "stream", ".", "A", "single", "space", "is", "written", "before", "the", "second", "and", "subsequent", "keys", "in", "a", "record", ".", "Nothing", "is", "wri...
07c9b44f60d7ffdfb7d8efe1ad539965737836dc
https://github.com/go-logfmt/logfmt/blob/07c9b44f60d7ffdfb7d8efe1ad539965737836dc/encode.go#L48-L67
137,938
go-logfmt/logfmt
encode.go
keyRuneFilter
func keyRuneFilter(r rune) rune { if r <= ' ' || r == '=' || r == '"' || r == utf8.RuneError { return -1 } return r }
go
func keyRuneFilter(r rune) rune { if r <= ' ' || r == '=' || r == '"' || r == utf8.RuneError { return -1 } return r }
[ "func", "keyRuneFilter", "(", "r", "rune", ")", "rune", "{", "if", "r", "<=", "' '", "||", "r", "==", "'='", "||", "r", "==", "'\"'", "||", "r", "==", "utf8", ".", "RuneError", "{", "return", "-", "1", "\n", "}", "\n", "return", "r", "\n", "}" ...
// keyRuneFilter returns r for all valid key runes, and -1 for all invalid key // runes. When used as the mapping function for strings.Map and bytes.Map // functions it causes them to remove invalid key runes from strings or byte // slices respectively.
[ "keyRuneFilter", "returns", "r", "for", "all", "valid", "key", "runes", "and", "-", "1", "for", "all", "invalid", "key", "runes", ".", "When", "used", "as", "the", "mapping", "function", "for", "strings", ".", "Map", "and", "bytes", ".", "Map", "function...
07c9b44f60d7ffdfb7d8efe1ad539965737836dc
https://github.com/go-logfmt/logfmt/blob/07c9b44f60d7ffdfb7d8efe1ad539965737836dc/encode.go#L172-L177
137,939
go-logfmt/logfmt
encode.go
EndRecord
func (enc *Encoder) EndRecord() error { _, err := enc.w.Write(newline) if err == nil { enc.needSep = false } return err }
go
func (enc *Encoder) EndRecord() error { _, err := enc.w.Write(newline) if err == nil { enc.needSep = false } return err }
[ "func", "(", "enc", "*", "Encoder", ")", "EndRecord", "(", ")", "error", "{", "_", ",", "err", ":=", "enc", ".", "w", ".", "Write", "(", "newline", ")", "\n", "if", "err", "==", "nil", "{", "enc", ".", "needSep", "=", "false", "\n", "}", "\n", ...
// EndRecord writes a newline character to the stream and resets the encoder // to the beginning of a new record.
[ "EndRecord", "writes", "a", "newline", "character", "to", "the", "stream", "and", "resets", "the", "encoder", "to", "the", "beginning", "of", "a", "new", "record", "." ]
07c9b44f60d7ffdfb7d8efe1ad539965737836dc
https://github.com/go-logfmt/logfmt/blob/07c9b44f60d7ffdfb7d8efe1ad539965737836dc/encode.go#L263-L269
137,940
go-logfmt/logfmt
decode.go
NewDecoder
func NewDecoder(r io.Reader) *Decoder { dec := &Decoder{ s: bufio.NewScanner(r), } return dec }
go
func NewDecoder(r io.Reader) *Decoder { dec := &Decoder{ s: bufio.NewScanner(r), } return dec }
[ "func", "NewDecoder", "(", "r", "io", ".", "Reader", ")", "*", "Decoder", "{", "dec", ":=", "&", "Decoder", "{", "s", ":", "bufio", ".", "NewScanner", "(", "r", ")", ",", "}", "\n", "return", "dec", "\n", "}" ]
// NewDecoder returns a new decoder that reads from r. // // The decoder introduces its own buffering and may read data from r beyond // the logfmt records requested.
[ "NewDecoder", "returns", "a", "new", "decoder", "that", "reads", "from", "r", ".", "The", "decoder", "introduces", "its", "own", "buffering", "and", "may", "read", "data", "from", "r", "beyond", "the", "logfmt", "records", "requested", "." ]
07c9b44f60d7ffdfb7d8efe1ad539965737836dc
https://github.com/go-logfmt/logfmt/blob/07c9b44f60d7ffdfb7d8efe1ad539965737836dc/decode.go#L25-L30
137,941
go-logfmt/logfmt
decode.go
ScanRecord
func (dec *Decoder) ScanRecord() bool { if dec.err != nil { return false } if !dec.s.Scan() { dec.err = dec.s.Err() return false } dec.lineNum++ dec.pos = 0 return true }
go
func (dec *Decoder) ScanRecord() bool { if dec.err != nil { return false } if !dec.s.Scan() { dec.err = dec.s.Err() return false } dec.lineNum++ dec.pos = 0 return true }
[ "func", "(", "dec", "*", "Decoder", ")", "ScanRecord", "(", ")", "bool", "{", "if", "dec", ".", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n", "if", "!", "dec", ".", "s", ".", "Scan", "(", ")", "{", "dec", ".", "err", "=", "dec"...
// ScanRecord advances the Decoder to the next record, which can then be // parsed with the ScanKeyval method. It returns false when decoding stops, // either by reaching the end of the input or an error. After ScanRecord // returns false, the Err method will return any error that occurred during // decoding, except th...
[ "ScanRecord", "advances", "the", "Decoder", "to", "the", "next", "record", "which", "can", "then", "be", "parsed", "with", "the", "ScanKeyval", "method", ".", "It", "returns", "false", "when", "decoding", "stops", "either", "by", "reaching", "the", "end", "o...
07c9b44f60d7ffdfb7d8efe1ad539965737836dc
https://github.com/go-logfmt/logfmt/blob/07c9b44f60d7ffdfb7d8efe1ad539965737836dc/decode.go#L37-L48
137,942
go-logfmt/logfmt
fuzz.go
Fuzz
func Fuzz(data []byte) int { parsed, err := parse(data) if err != nil { return 0 } var w1 bytes.Buffer if err = write(parsed, &w1); err != nil { panic(err) } parsed, err = parse(w1.Bytes()) if err != nil { panic(err) } var w2 bytes.Buffer if err = write(parsed, &w2); err != nil { panic(err) } if !b...
go
func Fuzz(data []byte) int { parsed, err := parse(data) if err != nil { return 0 } var w1 bytes.Buffer if err = write(parsed, &w1); err != nil { panic(err) } parsed, err = parse(w1.Bytes()) if err != nil { panic(err) } var w2 bytes.Buffer if err = write(parsed, &w2); err != nil { panic(err) } if !b...
[ "func", "Fuzz", "(", "data", "[", "]", "byte", ")", "int", "{", "parsed", ",", "err", ":=", "parse", "(", "data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", "\n", "}", "\n", "var", "w1", "bytes", ".", "Buffer", "\n", "if", "err", ...
// Fuzz checks reserialized data matches
[ "Fuzz", "checks", "reserialized", "data", "matches" ]
07c9b44f60d7ffdfb7d8efe1ad539965737836dc
https://github.com/go-logfmt/logfmt/blob/07c9b44f60d7ffdfb7d8efe1ad539965737836dc/fuzz.go#L16-L37
137,943
juhanoi/radix
bench/bench.go
benchmark
func benchmark(c *redis.Client, testname string, command string, params ...interface{}) { fmt.Printf("===== %s =====\n", testname) start := time.Now() for i := 0; i < *requests; i++ { c.Cmd(command, params...) } duration := time.Now().Sub(start) rps := float64(*requests) / duration.Seconds() fmt.Println("Req...
go
func benchmark(c *redis.Client, testname string, command string, params ...interface{}) { fmt.Printf("===== %s =====\n", testname) start := time.Now() for i := 0; i < *requests; i++ { c.Cmd(command, params...) } duration := time.Now().Sub(start) rps := float64(*requests) / duration.Seconds() fmt.Println("Req...
[ "func", "benchmark", "(", "c", "*", "redis", ".", "Client", ",", "testname", "string", ",", "command", "string", ",", "params", "...", "interface", "{", "}", ")", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "testname", ")", "\n", "start",...
// benchmark benchmarks the given command with the given parameters // and displays the given test name.
[ "benchmark", "benchmarks", "the", "given", "command", "with", "the", "given", "parameters", "and", "displays", "the", "given", "test", "name", "." ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/bench/bench.go#L26-L38
137,944
juhanoi/radix
extra/sentinel/sentinel.go
PutMaster
func (c *Client) PutMaster(name string, client *redis.Client) { c.putCh <- &putReq{name, client} }
go
func (c *Client) PutMaster(name string, client *redis.Client) { c.putCh <- &putReq{name, client} }
[ "func", "(", "c", "*", "Client", ")", "PutMaster", "(", "name", "string", ",", "client", "*", "redis", ".", "Client", ")", "{", "c", ".", "putCh", "<-", "&", "putReq", "{", "name", ",", "client", "}", "\n", "}" ]
// Return a connection for a master of a given name. As with the pool package, // do not return a connection which is having connectivity issues, or which is // otherwise unable to perform requests.
[ "Return", "a", "connection", "for", "a", "master", "of", "a", "given", "name", ".", "As", "with", "the", "pool", "package", "do", "not", "return", "a", "connection", "which", "is", "having", "connectivity", "issues", "or", "which", "is", "otherwise", "unab...
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/extra/sentinel/sentinel.go#L257-L259
137,945
juhanoi/radix
redis/client.go
Dial
func Dial(network, addr string) (*Client, error) { return DialTimeout(network, addr, time.Duration(0)) }
go
func Dial(network, addr string) (*Client, error) { return DialTimeout(network, addr, time.Duration(0)) }
[ "func", "Dial", "(", "network", ",", "addr", "string", ")", "(", "*", "Client", ",", "error", ")", "{", "return", "DialTimeout", "(", "network", ",", "addr", ",", "time", ".", "Duration", "(", "0", ")", ")", "\n", "}" ]
// Dial connects to the given Redis server.
[ "Dial", "connects", "to", "the", "given", "Redis", "server", "." ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/client.go#L60-L62
137,946
juhanoi/radix
redis/client.go
Cmd
func (c *Client) Cmd(cmd string, args ...interface{}) *Reply { err := c.writeRequest(&request{cmd, args}) if err != nil { return &Reply{Type: ErrorReply, Err: err} } return c.ReadReply() }
go
func (c *Client) Cmd(cmd string, args ...interface{}) *Reply { err := c.writeRequest(&request{cmd, args}) if err != nil { return &Reply{Type: ErrorReply, Err: err} } return c.ReadReply() }
[ "func", "(", "c", "*", "Client", ")", "Cmd", "(", "cmd", "string", ",", "args", "...", "interface", "{", "}", ")", "*", "Reply", "{", "err", ":=", "c", ".", "writeRequest", "(", "&", "request", "{", "cmd", ",", "args", "}", ")", "\n", "if", "er...
// Cmd calls the given Redis command.
[ "Cmd", "calls", "the", "given", "Redis", "command", "." ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/client.go#L72-L78
137,947
juhanoi/radix
redis/client.go
GetReply
func (c *Client) GetReply() *Reply { if len(c.completed) > 0 { r := c.completed[0] c.completed = c.completed[1:] return r } c.completed = nil if len(c.pending) == 0 { return &Reply{Type: ErrorReply, Err: PipelineQueueEmptyError} } nreqs := len(c.pending) err := c.writeRequest(c.pending...) c.pending =...
go
func (c *Client) GetReply() *Reply { if len(c.completed) > 0 { r := c.completed[0] c.completed = c.completed[1:] return r } c.completed = nil if len(c.pending) == 0 { return &Reply{Type: ErrorReply, Err: PipelineQueueEmptyError} } nreqs := len(c.pending) err := c.writeRequest(c.pending...) c.pending =...
[ "func", "(", "c", "*", "Client", ")", "GetReply", "(", ")", "*", "Reply", "{", "if", "len", "(", "c", ".", "completed", ")", ">", "0", "{", "r", ":=", "c", ".", "completed", "[", "0", "]", "\n", "c", ".", "completed", "=", "c", ".", "complete...
// GetReply returns the reply for the next request in the pipeline queue. // Error reply with PipelineQueueEmptyError is returned, // if the pipeline queue is empty.
[ "GetReply", "returns", "the", "reply", "for", "the", "next", "request", "in", "the", "pipeline", "queue", ".", "Error", "reply", "with", "PipelineQueueEmptyError", "is", "returned", "if", "the", "pipeline", "queue", "is", "empty", "." ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/client.go#L89-L114
137,948
juhanoi/radix
redis/resp/resp.go
ReadMessage
func ReadMessage(reader io.Reader) (*Message, error) { r := bufio.NewReader(reader) return bufioReadMessage(r) }
go
func ReadMessage(reader io.Reader) (*Message, error) { r := bufio.NewReader(reader) return bufioReadMessage(r) }
[ "func", "ReadMessage", "(", "reader", "io", ".", "Reader", ")", "(", "*", "Message", ",", "error", ")", "{", "r", ":=", "bufio", ".", "NewReader", "(", "reader", ")", "\n", "return", "bufioReadMessage", "(", "r", ")", "\n", "}" ]
// ReadMessage attempts to read a message object from the given io.Reader, parse // it, and return a Message struct representing it
[ "ReadMessage", "attempts", "to", "read", "a", "message", "object", "from", "the", "given", "io", ".", "Reader", "parse", "it", "and", "return", "a", "Message", "struct", "representing", "it" ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/resp/resp.go#L80-L83
137,949
juhanoi/radix
redis/resp/resp.go
Bytes
func (m *Message) Bytes() ([]byte, error) { if b, ok := m.val.([]byte); ok { return b, nil } return nil, badType }
go
func (m *Message) Bytes() ([]byte, error) { if b, ok := m.val.([]byte); ok { return b, nil } return nil, badType }
[ "func", "(", "m", "*", "Message", ")", "Bytes", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "b", ",", "ok", ":=", "m", ".", "val", ".", "(", "[", "]", "byte", ")", ";", "ok", "{", "return", "b", ",", "nil", "\n", "}", ...
// Bytes returns a byte slice representing the value of the Message. Only valid // for a Message of type SimpleStr, Err, and BulkStr. Others will return an // error
[ "Bytes", "returns", "a", "byte", "slice", "representing", "the", "value", "of", "the", "Message", ".", "Only", "valid", "for", "a", "Message", "of", "type", "SimpleStr", "Err", "and", "BulkStr", ".", "Others", "will", "return", "an", "error" ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/resp/resp.go#L203-L208
137,950
juhanoi/radix
redis/resp/resp.go
Str
func (m *Message) Str() (string, error) { b, err := m.Bytes() if err != nil { return "", err } return string(b), nil }
go
func (m *Message) Str() (string, error) { b, err := m.Bytes() if err != nil { return "", err } return string(b), nil }
[ "func", "(", "m", "*", "Message", ")", "Str", "(", ")", "(", "string", ",", "error", ")", "{", "b", ",", "err", ":=", "m", ".", "Bytes", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "retu...
// Str is a Convenience method around Bytes which converts the output to a // string
[ "Str", "is", "a", "Convenience", "method", "around", "Bytes", "which", "converts", "the", "output", "to", "a", "string" ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/resp/resp.go#L212-L218
137,951
juhanoi/radix
redis/resp/resp.go
Int
func (m *Message) Int() (int64, error) { if i, ok := m.val.(int64); ok { return i, nil } return 0, badType }
go
func (m *Message) Int() (int64, error) { if i, ok := m.val.(int64); ok { return i, nil } return 0, badType }
[ "func", "(", "m", "*", "Message", ")", "Int", "(", ")", "(", "int64", ",", "error", ")", "{", "if", "i", ",", "ok", ":=", "m", ".", "val", ".", "(", "int64", ")", ";", "ok", "{", "return", "i", ",", "nil", "\n", "}", "\n", "return", "0", ...
// Int returns an int64 representing the value of the Message. Only valid for // Int messages
[ "Int", "returns", "an", "int64", "representing", "the", "value", "of", "the", "Message", ".", "Only", "valid", "for", "Int", "messages" ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/resp/resp.go#L222-L227
137,952
juhanoi/radix
redis/resp/resp.go
Err
func (m *Message) Err() (error, error) { if m.Type != Err { return nil, badType } s, err := m.Str() if err != nil { return nil, err } return errors.New(s), nil }
go
func (m *Message) Err() (error, error) { if m.Type != Err { return nil, badType } s, err := m.Str() if err != nil { return nil, err } return errors.New(s), nil }
[ "func", "(", "m", "*", "Message", ")", "Err", "(", ")", "(", "error", ",", "error", ")", "{", "if", "m", ".", "Type", "!=", "Err", "{", "return", "nil", ",", "badType", "\n", "}", "\n", "s", ",", "err", ":=", "m", ".", "Str", "(", ")", "\n"...
// Err returns an error representing the value of the Message. Only valid for // Err messages
[ "Err", "returns", "an", "error", "representing", "the", "value", "of", "the", "Message", ".", "Only", "valid", "for", "Err", "messages" ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/resp/resp.go#L231-L240
137,953
juhanoi/radix
redis/resp/resp.go
Array
func (m *Message) Array() ([]*Message, error) { if a, ok := m.val.([]*Message); ok { return a, nil } return nil, badType }
go
func (m *Message) Array() ([]*Message, error) { if a, ok := m.val.([]*Message); ok { return a, nil } return nil, badType }
[ "func", "(", "m", "*", "Message", ")", "Array", "(", ")", "(", "[", "]", "*", "Message", ",", "error", ")", "{", "if", "a", ",", "ok", ":=", "m", ".", "val", ".", "(", "[", "]", "*", "Message", ")", ";", "ok", "{", "return", "a", ",", "ni...
// Array returns the Message slice encompassed by this Messsage, assuming the // Message is of type Array
[ "Array", "returns", "the", "Message", "slice", "encompassed", "by", "this", "Messsage", "assuming", "the", "Message", "is", "of", "type", "Array" ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/resp/resp.go#L244-L249
137,954
juhanoi/radix
redis/resp/resp.go
WriteMessage
func WriteMessage(w io.Writer, m *Message) error { _, err := w.Write(m.raw) return err }
go
func WriteMessage(w io.Writer, m *Message) error { _, err := w.Write(m.raw) return err }
[ "func", "WriteMessage", "(", "w", "io", ".", "Writer", ",", "m", "*", "Message", ")", "error", "{", "_", ",", "err", ":=", "w", ".", "Write", "(", "m", ".", "raw", ")", "\n", "return", "err", "\n", "}" ]
// WriteMessage takes in the given Message and writes its encoded form to the // given io.Writer
[ "WriteMessage", "takes", "in", "the", "given", "Message", "and", "writes", "its", "encoded", "form", "to", "the", "given", "io", ".", "Writer" ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/resp/resp.go#L261-L264
137,955
juhanoi/radix
redis/resp/resp.go
AppendArbitrary
func AppendArbitrary(buf []byte, m interface{}) []byte { return appendArb(buf, m, false, false) }
go
func AppendArbitrary(buf []byte, m interface{}) []byte { return appendArb(buf, m, false, false) }
[ "func", "AppendArbitrary", "(", "buf", "[", "]", "byte", ",", "m", "interface", "{", "}", ")", "[", "]", "byte", "{", "return", "appendArb", "(", "buf", ",", "m", ",", "false", ",", "false", ")", "\n", "}" ]
// AppendArbitrary takes in any primitive golang value, or Message, and appends // its encoded form to the given buffer, inferring types where appropriate. It // then returns the appended buffer
[ "AppendArbitrary", "takes", "in", "any", "primitive", "golang", "value", "or", "Message", "and", "appends", "its", "encoded", "form", "to", "the", "given", "buffer", "inferring", "types", "where", "appropriate", ".", "It", "then", "returns", "the", "appended", ...
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/resp/resp.go#L269-L271
137,956
juhanoi/radix
redis/resp/resp.go
WriteArbitrary
func WriteArbitrary(w io.Writer, m interface{}) error { buf := AppendArbitrary(make([]byte, 0, 1024), m) _, err := w.Write(buf) return err }
go
func WriteArbitrary(w io.Writer, m interface{}) error { buf := AppendArbitrary(make([]byte, 0, 1024), m) _, err := w.Write(buf) return err }
[ "func", "WriteArbitrary", "(", "w", "io", ".", "Writer", ",", "m", "interface", "{", "}", ")", "error", "{", "buf", ":=", "AppendArbitrary", "(", "make", "(", "[", "]", "byte", ",", "0", ",", "1024", ")", ",", "m", ")", "\n", "_", ",", "err", "...
// WriteArbitrary takes in any primitive golang value, or Message, and writes // its encoded form to the given io.Writer, inferring types where appropriate.
[ "WriteArbitrary", "takes", "in", "any", "primitive", "golang", "value", "or", "Message", "and", "writes", "its", "encoded", "form", "to", "the", "given", "io", ".", "Writer", "inferring", "types", "where", "appropriate", "." ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/resp/resp.go#L275-L279
137,957
juhanoi/radix
redis/resp/resp.go
AppendArbitraryAsStrings
func AppendArbitraryAsStrings(buf []byte, m interface{}) []byte { return appendArb(buf, m, true, false) }
go
func AppendArbitraryAsStrings(buf []byte, m interface{}) []byte { return appendArb(buf, m, true, false) }
[ "func", "AppendArbitraryAsStrings", "(", "buf", "[", "]", "byte", ",", "m", "interface", "{", "}", ")", "[", "]", "byte", "{", "return", "appendArb", "(", "buf", ",", "m", ",", "true", ",", "false", ")", "\n", "}" ]
// AppendArbitraryAsString is similar to AppendArbitraryAsFlattenedString except // that it won't flatten any embedded arrays.
[ "AppendArbitraryAsString", "is", "similar", "to", "AppendArbitraryAsFlattenedString", "except", "that", "it", "won", "t", "flatten", "any", "embedded", "arrays", "." ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/resp/resp.go#L283-L285
137,958
juhanoi/radix
redis/resp/resp.go
WriteArbitraryAsString
func WriteArbitraryAsString(w io.Writer, m interface{}) error { buf := AppendArbitraryAsStrings(make([]byte, 0, 1024), m) _, err := w.Write(buf) return err }
go
func WriteArbitraryAsString(w io.Writer, m interface{}) error { buf := AppendArbitraryAsStrings(make([]byte, 0, 1024), m) _, err := w.Write(buf) return err }
[ "func", "WriteArbitraryAsString", "(", "w", "io", ".", "Writer", ",", "m", "interface", "{", "}", ")", "error", "{", "buf", ":=", "AppendArbitraryAsStrings", "(", "make", "(", "[", "]", "byte", ",", "0", ",", "1024", ")", ",", "m", ")", "\n", "_", ...
// WriteArbitraryAsString is similar to WriteArbitraryAsFlattenedString except // that it won't flatten any embedded arrays.
[ "WriteArbitraryAsString", "is", "similar", "to", "WriteArbitraryAsFlattenedString", "except", "that", "it", "won", "t", "flatten", "any", "embedded", "arrays", "." ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/resp/resp.go#L289-L293
137,959
juhanoi/radix
extra/pool/pool.go
Get
func (p *Pool) Get() (*redis.Client, error) { select { case conn := <-p.pool: return conn, nil default: return p.df(p.network, p.addr) } }
go
func (p *Pool) Get() (*redis.Client, error) { select { case conn := <-p.pool: return conn, nil default: return p.df(p.network, p.addr) } }
[ "func", "(", "p", "*", "Pool", ")", "Get", "(", ")", "(", "*", "redis", ".", "Client", ",", "error", ")", "{", "select", "{", "case", "conn", ":=", "<-", "p", ".", "pool", ":", "return", "conn", ",", "nil", "\n", "default", ":", "return", "p", ...
// Retrieves an available redis client. If there are none available it will // create a new one on the fly
[ "Retrieves", "an", "available", "redis", "client", ".", "If", "there", "are", "none", "available", "it", "will", "create", "a", "new", "one", "on", "the", "fly" ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/extra/pool/pool.go#L95-L102
137,960
juhanoi/radix
redis/reply.go
Bytes
func (r *Reply) Bytes() ([]byte, error) { if r.Type == ErrorReply { return nil, r.Err } if !(r.Type == StatusReply || r.Type == BulkReply) { return nil, errors.New("string value is not available for this reply type") } return r.buf, nil }
go
func (r *Reply) Bytes() ([]byte, error) { if r.Type == ErrorReply { return nil, r.Err } if !(r.Type == StatusReply || r.Type == BulkReply) { return nil, errors.New("string value is not available for this reply type") } return r.buf, nil }
[ "func", "(", "r", "*", "Reply", ")", "Bytes", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "r", ".", "Type", "==", "ErrorReply", "{", "return", "nil", ",", "r", ".", "Err", "\n", "}", "\n", "if", "!", "(", "r", ".", "Type"...
// Bytes returns the reply value as a byte string or // an error, if the reply type is not StatusReply or BulkReply.
[ "Bytes", "returns", "the", "reply", "value", "as", "a", "byte", "string", "or", "an", "error", "if", "the", "reply", "type", "is", "not", "StatusReply", "or", "BulkReply", "." ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/reply.go#L72-L81
137,961
juhanoi/radix
redis/reply.go
Int64
func (r *Reply) Int64() (int64, error) { if r.Type == ErrorReply { return 0, r.Err } if r.Type != IntegerReply { s, err := r.Str() if err == nil { i64, err := strconv.ParseInt(s, 10, 64) if err != nil { return 0, errors.New("failed to parse integer value from string value") } else { return i64...
go
func (r *Reply) Int64() (int64, error) { if r.Type == ErrorReply { return 0, r.Err } if r.Type != IntegerReply { s, err := r.Str() if err == nil { i64, err := strconv.ParseInt(s, 10, 64) if err != nil { return 0, errors.New("failed to parse integer value from string value") } else { return i64...
[ "func", "(", "r", "*", "Reply", ")", "Int64", "(", ")", "(", "int64", ",", "error", ")", "{", "if", "r", ".", "Type", "==", "ErrorReply", "{", "return", "0", ",", "r", ".", "Err", "\n", "}", "\n", "if", "r", ".", "Type", "!=", "IntegerReply", ...
// Int64 returns the reply value as a int64 or an error, // if the reply type is not IntegerReply or the reply type // BulkReply could not be parsed to an int64.
[ "Int64", "returns", "the", "reply", "value", "as", "a", "int64", "or", "an", "error", "if", "the", "reply", "type", "is", "not", "IntegerReply", "or", "the", "reply", "type", "BulkReply", "could", "not", "be", "parsed", "to", "an", "int64", "." ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/reply.go#L96-L115
137,962
juhanoi/radix
redis/reply.go
Float64
func (r *Reply) Float64() (float64, error) { if r.Type == ErrorReply { return 0, r.Err } if r.Type == BulkReply { s, err := r.Str() if err != nil { return 0, err } f64, err := strconv.ParseFloat(s, 64) if err != nil { return 0, errors.New("failed to parse float value from string value") } else { ...
go
func (r *Reply) Float64() (float64, error) { if r.Type == ErrorReply { return 0, r.Err } if r.Type == BulkReply { s, err := r.Str() if err != nil { return 0, err } f64, err := strconv.ParseFloat(s, 64) if err != nil { return 0, errors.New("failed to parse float value from string value") } else { ...
[ "func", "(", "r", "*", "Reply", ")", "Float64", "(", ")", "(", "float64", ",", "error", ")", "{", "if", "r", ".", "Type", "==", "ErrorReply", "{", "return", "0", ",", "r", ".", "Err", "\n", "}", "\n", "if", "r", ".", "Type", "==", "BulkReply", ...
// Float64 returns the reply value as a float64 or an error, // if the reply type is not BulkReply or the reply type // BulkReply could not be parsed to an float64.
[ "Float64", "returns", "the", "reply", "value", "as", "a", "float64", "or", "an", "error", "if", "the", "reply", "type", "is", "not", "BulkReply", "or", "the", "reply", "type", "BulkReply", "could", "not", "be", "parsed", "to", "an", "float64", "." ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/reply.go#L130-L148
137,963
juhanoi/radix
redis/reply.go
Bool
func (r *Reply) Bool() (bool, error) { if r.Type == ErrorReply { return false, r.Err } i, err := r.Int() if err == nil { if i == 0 { return false, nil } return true, nil } s, err := r.Str() if err == nil { if s == "0" { return false, nil } return true, nil } return false, errors.New("bo...
go
func (r *Reply) Bool() (bool, error) { if r.Type == ErrorReply { return false, r.Err } i, err := r.Int() if err == nil { if i == 0 { return false, nil } return true, nil } s, err := r.Str() if err == nil { if s == "0" { return false, nil } return true, nil } return false, errors.New("bo...
[ "func", "(", "r", "*", "Reply", ")", "Bool", "(", ")", "(", "bool", ",", "error", ")", "{", "if", "r", ".", "Type", "==", "ErrorReply", "{", "return", "false", ",", "r", ".", "Err", "\n", "}", "\n", "i", ",", "err", ":=", "r", ".", "Int", "...
// Bool returns false, if the reply value equals to 0 or "0", otherwise true; or // an error, if the reply type is not IntegerReply or BulkReply.
[ "Bool", "returns", "false", "if", "the", "reply", "value", "equals", "to", "0", "or", "0", "otherwise", "true", ";", "or", "an", "error", "if", "the", "reply", "type", "is", "not", "IntegerReply", "or", "BulkReply", "." ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/reply.go#L152-L175
137,964
juhanoi/radix
redis/reply.go
List
func (r *Reply) List() ([]string, error) { // Doing all this in two places instead of just calling ListBytes() so we don't have // to iterate twice if r.Type == ErrorReply { return nil, r.Err } if r.Type != MultiReply { return nil, errors.New("reply type is not MultiReply") } strings := make([]string, len(r...
go
func (r *Reply) List() ([]string, error) { // Doing all this in two places instead of just calling ListBytes() so we don't have // to iterate twice if r.Type == ErrorReply { return nil, r.Err } if r.Type != MultiReply { return nil, errors.New("reply type is not MultiReply") } strings := make([]string, len(r...
[ "func", "(", "r", "*", "Reply", ")", "List", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "// Doing all this in two places instead of just calling ListBytes() so we don't have", "// to iterate twice", "if", "r", ".", "Type", "==", "ErrorReply", "{", ...
// List returns a multi bulk reply as a slice of strings or an error. // The reply type must be MultiReply and its elements' types must all be either BulkReply or NilReply. // Nil elements are returned as empty strings. // Useful for list commands.
[ "List", "returns", "a", "multi", "bulk", "reply", "as", "a", "slice", "of", "strings", "or", "an", "error", ".", "The", "reply", "type", "must", "be", "MultiReply", "and", "its", "elements", "types", "must", "all", "be", "either", "BulkReply", "or", "Nil...
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/reply.go#L181-L203
137,965
juhanoi/radix
redis/reply.go
ListBytes
func (r *Reply) ListBytes() ([][]byte, error) { if r.Type == ErrorReply { return nil, r.Err } if r.Type != MultiReply { return nil, errors.New("reply type is not MultiReply") } bufs := make([][]byte, len(r.Elems)) for i, v := range r.Elems { if v.Type == BulkReply { bufs[i] = v.buf } else if v.Type ==...
go
func (r *Reply) ListBytes() ([][]byte, error) { if r.Type == ErrorReply { return nil, r.Err } if r.Type != MultiReply { return nil, errors.New("reply type is not MultiReply") } bufs := make([][]byte, len(r.Elems)) for i, v := range r.Elems { if v.Type == BulkReply { bufs[i] = v.buf } else if v.Type ==...
[ "func", "(", "r", "*", "Reply", ")", "ListBytes", "(", ")", "(", "[", "]", "[", "]", "byte", ",", "error", ")", "{", "if", "r", ".", "Type", "==", "ErrorReply", "{", "return", "nil", ",", "r", ".", "Err", "\n", "}", "\n", "if", "r", ".", "T...
// ListBytes returns a multi bulk reply as a slice of bytes slices or an error. // The reply type must be MultiReply and its elements' types must all be either BulkReply or NilReply. // Nil elements are returned as nil. // Useful for list commands.
[ "ListBytes", "returns", "a", "multi", "bulk", "reply", "as", "a", "slice", "of", "bytes", "slices", "or", "an", "error", ".", "The", "reply", "type", "must", "be", "MultiReply", "and", "its", "elements", "types", "must", "all", "be", "either", "BulkReply",...
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/redis/reply.go#L209-L229
137,966
juhanoi/radix
extra/pubsub/sub.go
Timeout
func (r *SubReply) Timeout() bool { if r.Err == nil { return false } t, ok := r.Err.(*net.OpError) return ok && t.Timeout() }
go
func (r *SubReply) Timeout() bool { if r.Err == nil { return false } t, ok := r.Err.(*net.OpError) return ok && t.Timeout() }
[ "func", "(", "r", "*", "SubReply", ")", "Timeout", "(", ")", "bool", "{", "if", "r", ".", "Err", "==", "nil", "{", "return", "false", "\n", "}", "\n", "t", ",", "ok", ":=", "r", ".", "Err", ".", "(", "*", "net", ".", "OpError", ")", "\n", "...
// Timeout determines if this SubReply is an error type // due to a timeout reading from the network
[ "Timeout", "determines", "if", "this", "SubReply", "is", "an", "error", "type", "due", "to", "a", "timeout", "reading", "from", "the", "network" ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/extra/pubsub/sub.go#L41-L47
137,967
juhanoi/radix
extra/cluster/cluster.go
NewClusterWithOpts
func NewClusterWithOpts(o Opts) (*Cluster, error) { if o.PoolSize == 0 { o.PoolSize = 10 } if o.PoolThrottle == 0 { o.PoolThrottle = 500 * time.Millisecond } if o.ResetThrottle == 0 { o.ResetThrottle = 500 * time.Millisecond } c := Cluster{ o: o, mapping: mapping{}, pools: ...
go
func NewClusterWithOpts(o Opts) (*Cluster, error) { if o.PoolSize == 0 { o.PoolSize = 10 } if o.PoolThrottle == 0 { o.PoolThrottle = 500 * time.Millisecond } if o.ResetThrottle == 0 { o.ResetThrottle = 500 * time.Millisecond } c := Cluster{ o: o, mapping: mapping{}, pools: ...
[ "func", "NewClusterWithOpts", "(", "o", "Opts", ")", "(", "*", "Cluster", ",", "error", ")", "{", "if", "o", ".", "PoolSize", "==", "0", "{", "o", ".", "PoolSize", "=", "10", "\n", "}", "\n", "if", "o", ".", "PoolThrottle", "==", "0", "{", "o", ...
// NewClusterWithOpts is the same as NewCluster, but with more fine-tuned // configuration options. See ClusterOpts for more available options
[ "NewClusterWithOpts", "is", "the", "same", "as", "NewCluster", "but", "with", "more", "fine", "-", "tuned", "configuration", "options", ".", "See", "ClusterOpts", "for", "more", "available", "options" ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/extra/cluster/cluster.go#L121-L152
137,968
juhanoi/radix
extra/cluster/cluster.go
getConn
func (c *Cluster) getConn(key, addr string) (string, *redis.Client, error) { respCh := make(chan *connTup) c.callCh <- func(c *Cluster) { if key != "" { addr = c.addrForKeyInner(key) } var pool *pool.Pool if addr == "" { addr, pool = c.getRandomPoolInner() } else { var ok bool var err error ...
go
func (c *Cluster) getConn(key, addr string) (string, *redis.Client, error) { respCh := make(chan *connTup) c.callCh <- func(c *Cluster) { if key != "" { addr = c.addrForKeyInner(key) } var pool *pool.Pool if addr == "" { addr, pool = c.getRandomPoolInner() } else { var ok bool var err error ...
[ "func", "(", "c", "*", "Cluster", ")", "getConn", "(", "key", ",", "addr", "string", ")", "(", "string", ",", "*", "redis", ".", "Client", ",", "error", ")", "{", "respCh", ":=", "make", "(", "chan", "*", "connTup", ")", "\n", "c", ".", "callCh",...
// Returns a connection for the given key or given address, depending on which // is set. Even if addr is given the returned addr may be different, if that // addr didn't have an associated pool and one couldn't be created
[ "Returns", "a", "connection", "for", "the", "given", "key", "or", "given", "address", "depending", "on", "which", "is", "set", ".", "Even", "if", "addr", "is", "given", "the", "returned", "addr", "may", "be", "different", "if", "that", "addr", "didn", "t...
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/extra/cluster/cluster.go#L192-L240
137,969
juhanoi/radix
extra/cluster/cluster.go
keyFromArg
func keyFromArg(arg interface{}) (string, error) { switch argv := arg.(type) { case string: return argv, nil case []byte: return string(argv), nil default: switch reflect.TypeOf(arg).Kind() { case reflect.Slice: argVal := reflect.ValueOf(arg) if argVal.Len() < 1 { return "", BadCmdNoKey } fi...
go
func keyFromArg(arg interface{}) (string, error) { switch argv := arg.(type) { case string: return argv, nil case []byte: return string(argv), nil default: switch reflect.TypeOf(arg).Kind() { case reflect.Slice: argVal := reflect.ValueOf(arg) if argVal.Len() < 1 { return "", BadCmdNoKey } fi...
[ "func", "keyFromArg", "(", "arg", "interface", "{", "}", ")", "(", "string", ",", "error", ")", "{", "switch", "argv", ":=", "arg", ".", "(", "type", ")", "{", "case", "string", ":", "return", "argv", ",", "nil", "\n", "case", "[", "]", "byte", "...
// We unfortunately support some weird stuff for command arguments, such as // automatically flattening slices and things like that. So this gets // complicated. Usually the user will do something normal like pass in a string // or byte slice though, so usually this will be pretty fast
[ "We", "unfortunately", "support", "some", "weird", "stuff", "for", "command", "arguments", "such", "as", "automatically", "flattening", "slices", "and", "things", "like", "that", ".", "So", "this", "gets", "complicated", ".", "Usually", "the", "user", "will", ...
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/extra/cluster/cluster.go#L545-L567
137,970
juhanoi/radix
extra/cluster/cluster.go
Close
func (c *Cluster) Close() { c.callCh <- func(c *Cluster) { for addr, p := range c.pools { p.Empty() delete(c.pools, addr) } c.resetThrottle.Stop() } close(c.stopCh) }
go
func (c *Cluster) Close() { c.callCh <- func(c *Cluster) { for addr, p := range c.pools { p.Empty() delete(c.pools, addr) } c.resetThrottle.Stop() } close(c.stopCh) }
[ "func", "(", "c", "*", "Cluster", ")", "Close", "(", ")", "{", "c", ".", "callCh", "<-", "func", "(", "c", "*", "Cluster", ")", "{", "for", "addr", ",", "p", ":=", "range", "c", ".", "pools", "{", "p", ".", "Empty", "(", ")", "\n", "delete", ...
// Close calls Close on all connected clients. Once this is called no other // methods should be called on this instance of Cluster
[ "Close", "calls", "Close", "on", "all", "connected", "clients", ".", "Once", "this", "is", "called", "no", "other", "methods", "should", "be", "called", "on", "this", "instance", "of", "Cluster" ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/extra/cluster/cluster.go#L595-L604
137,971
juhanoi/radix
extra/cluster/crc16.go
CRC16
func CRC16(buf []byte) uint16 { crc := uint16(0) for _, b := range buf { index := byte(crc>>8) ^ b crc = (crc << 8) ^ tab[index] } return crc }
go
func CRC16(buf []byte) uint16 { crc := uint16(0) for _, b := range buf { index := byte(crc>>8) ^ b crc = (crc << 8) ^ tab[index] } return crc }
[ "func", "CRC16", "(", "buf", "[", "]", "byte", ")", "uint16", "{", "crc", ":=", "uint16", "(", "0", ")", "\n", "for", "_", ",", "b", ":=", "range", "buf", "{", "index", ":=", "byte", "(", "crc", ">>", "8", ")", "^", "b", "\n", "crc", "=", "...
// CRC16 returns checksum for a given set of bytes based on the crc algorithm // defined for hashing redis keys in a cluster setup
[ "CRC16", "returns", "checksum", "for", "a", "given", "set", "of", "bytes", "based", "on", "the", "crc", "algorithm", "defined", "for", "hashing", "redis", "keys", "in", "a", "cluster", "setup" ]
3528e87a910c6730810cec1be187f989d7d9442a
https://github.com/juhanoi/radix/blob/3528e87a910c6730810cec1be187f989d7d9442a/extra/cluster/crc16.go#L40-L47
137,972
ian-kent/go-log
logger/logger.go
New
func New(name string) Logger { l := Logger(&logger{ level: levels.DEBUG, name: name, enabled: make(map[levels.LogLevel]bool), appender: appenders.Console(), children: make([]Logger, 0), parent: nil, ExitOnFatal: true, }) l.SetLevel(levels.DEBUG) return l }
go
func New(name string) Logger { l := Logger(&logger{ level: levels.DEBUG, name: name, enabled: make(map[levels.LogLevel]bool), appender: appenders.Console(), children: make([]Logger, 0), parent: nil, ExitOnFatal: true, }) l.SetLevel(levels.DEBUG) return l }
[ "func", "New", "(", "name", "string", ")", "Logger", "{", "l", ":=", "Logger", "(", "&", "logger", "{", "level", ":", "levels", ".", "DEBUG", ",", "name", ":", "name", ",", "enabled", ":", "make", "(", "map", "[", "levels", ".", "LogLevel", "]", ...
// New returns a new Logger
[ "New", "returns", "a", "new", "Logger" ]
5731446c36ab9f716106ce0731f484c50fdf1ad1
https://github.com/ian-kent/go-log/blob/5731446c36ab9f716106ce0731f484c50fdf1ad1/logger/logger.go#L56-L68
137,973
dropbox/dropbox-sdk-go-unofficial
dropbox/common/types.go
UnmarshalJSON
func (u *PathRoot) UnmarshalJSON(body []byte) error { type wrap struct { dropbox.Tagged } var w wrap var err error if err = json.Unmarshal(body, &w); err != nil { return err } u.Tag = w.Tag switch u.Tag { case "root": err = json.Unmarshal(body, &u.Root) if err != nil { return err } case "namespa...
go
func (u *PathRoot) UnmarshalJSON(body []byte) error { type wrap struct { dropbox.Tagged } var w wrap var err error if err = json.Unmarshal(body, &w); err != nil { return err } u.Tag = w.Tag switch u.Tag { case "root": err = json.Unmarshal(body, &u.Root) if err != nil { return err } case "namespa...
[ "func", "(", "u", "*", "PathRoot", ")", "UnmarshalJSON", "(", "body", "[", "]", "byte", ")", "error", "{", "type", "wrap", "struct", "{", "dropbox", ".", "Tagged", "\n", "}", "\n", "var", "w", "wrap", "\n", "var", "err", "error", "\n", "if", "err",...
// UnmarshalJSON deserializes into a PathRoot instance
[ "UnmarshalJSON", "deserializes", "into", "a", "PathRoot", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/common/types.go#L52-L77
137,974
dropbox/dropbox-sdk-go-unofficial
dropbox/common/types.go
UnmarshalJSON
func (u *PathRootError) UnmarshalJSON(body []byte) error { type wrap struct { dropbox.Tagged // InvalidRoot : The root namespace id in Dropbox-API-Path-Root header // is not valid. The value of this error is use's latest root info. InvalidRoot json.RawMessage `json:"invalid_root,omitempty"` } var w wrap var...
go
func (u *PathRootError) UnmarshalJSON(body []byte) error { type wrap struct { dropbox.Tagged // InvalidRoot : The root namespace id in Dropbox-API-Path-Root header // is not valid. The value of this error is use's latest root info. InvalidRoot json.RawMessage `json:"invalid_root,omitempty"` } var w wrap var...
[ "func", "(", "u", "*", "PathRootError", ")", "UnmarshalJSON", "(", "body", "[", "]", "byte", ")", "error", "{", "type", "wrap", "struct", "{", "dropbox", ".", "Tagged", "\n", "// InvalidRoot : The root namespace id in Dropbox-API-Path-Root header", "// is not valid. T...
// UnmarshalJSON deserializes into a PathRootError instance
[ "UnmarshalJSON", "deserializes", "into", "a", "PathRootError", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/common/types.go#L95-L117
137,975
dropbox/dropbox-sdk-go-unofficial
dropbox/common/types.go
NewRootInfo
func NewRootInfo(RootNamespaceId string, HomeNamespaceId string) *RootInfo { s := new(RootInfo) s.RootNamespaceId = RootNamespaceId s.HomeNamespaceId = HomeNamespaceId return s }
go
func NewRootInfo(RootNamespaceId string, HomeNamespaceId string) *RootInfo { s := new(RootInfo) s.RootNamespaceId = RootNamespaceId s.HomeNamespaceId = HomeNamespaceId return s }
[ "func", "NewRootInfo", "(", "RootNamespaceId", "string", ",", "HomeNamespaceId", "string", ")", "*", "RootInfo", "{", "s", ":=", "new", "(", "RootInfo", ")", "\n", "s", ".", "RootNamespaceId", "=", "RootNamespaceId", "\n", "s", ".", "HomeNamespaceId", "=", "...
// NewRootInfo returns a new RootInfo instance
[ "NewRootInfo", "returns", "a", "new", "RootInfo", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/common/types.go#L131-L136
137,976
dropbox/dropbox-sdk-go-unofficial
dropbox/common/types.go
IsRootInfoFromJSON
func IsRootInfoFromJSON(data []byte) (IsRootInfo, error) { var t rootInfoUnion if err := json.Unmarshal(data, &t); err != nil { return nil, err } switch t.Tag { case "team": return t.Team, nil case "user": return t.User, nil } return nil, nil }
go
func IsRootInfoFromJSON(data []byte) (IsRootInfo, error) { var t rootInfoUnion if err := json.Unmarshal(data, &t); err != nil { return nil, err } switch t.Tag { case "team": return t.Team, nil case "user": return t.User, nil } return nil, nil }
[ "func", "IsRootInfoFromJSON", "(", "data", "[", "]", "byte", ")", "(", "IsRootInfo", ",", "error", ")", "{", "var", "t", "rootInfoUnion", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "t", ")", ";", "err", "!=", "nil", "...
// IsRootInfoFromJSON converts JSON to a concrete IsRootInfo instance
[ "IsRootInfoFromJSON", "converts", "JSON", "to", "a", "concrete", "IsRootInfo", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/common/types.go#L193-L207
137,977
dropbox/dropbox-sdk-go-unofficial
dropbox/common/types.go
NewTeamRootInfo
func NewTeamRootInfo(RootNamespaceId string, HomeNamespaceId string, HomePath string) *TeamRootInfo { s := new(TeamRootInfo) s.RootNamespaceId = RootNamespaceId s.HomeNamespaceId = HomeNamespaceId s.HomePath = HomePath return s }
go
func NewTeamRootInfo(RootNamespaceId string, HomeNamespaceId string, HomePath string) *TeamRootInfo { s := new(TeamRootInfo) s.RootNamespaceId = RootNamespaceId s.HomeNamespaceId = HomeNamespaceId s.HomePath = HomePath return s }
[ "func", "NewTeamRootInfo", "(", "RootNamespaceId", "string", ",", "HomeNamespaceId", "string", ",", "HomePath", "string", ")", "*", "TeamRootInfo", "{", "s", ":=", "new", "(", "TeamRootInfo", ")", "\n", "s", ".", "RootNamespaceId", "=", "RootNamespaceId", "\n", ...
// NewTeamRootInfo returns a new TeamRootInfo instance
[ "NewTeamRootInfo", "returns", "a", "new", "TeamRootInfo", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/common/types.go#L218-L224
137,978
dropbox/dropbox-sdk-go-unofficial
dropbox/common/types.go
NewUserRootInfo
func NewUserRootInfo(RootNamespaceId string, HomeNamespaceId string) *UserRootInfo { s := new(UserRootInfo) s.RootNamespaceId = RootNamespaceId s.HomeNamespaceId = HomeNamespaceId return s }
go
func NewUserRootInfo(RootNamespaceId string, HomeNamespaceId string) *UserRootInfo { s := new(UserRootInfo) s.RootNamespaceId = RootNamespaceId s.HomeNamespaceId = HomeNamespaceId return s }
[ "func", "NewUserRootInfo", "(", "RootNamespaceId", "string", ",", "HomeNamespaceId", "string", ")", "*", "UserRootInfo", "{", "s", ":=", "new", "(", "UserRootInfo", ")", "\n", "s", ".", "RootNamespaceId", "=", "RootNamespaceId", "\n", "s", ".", "HomeNamespaceId"...
// NewUserRootInfo returns a new UserRootInfo instance
[ "NewUserRootInfo", "returns", "a", "new", "UserRootInfo", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/common/types.go#L233-L238
137,979
dropbox/dropbox-sdk-go-unofficial
dropbox/users/types.go
NewAccount
func NewAccount(AccountId string, Name *Name, Email string, EmailVerified bool, Disabled bool) *Account { s := new(Account) s.AccountId = AccountId s.Name = Name s.Email = Email s.EmailVerified = EmailVerified s.Disabled = Disabled return s }
go
func NewAccount(AccountId string, Name *Name, Email string, EmailVerified bool, Disabled bool) *Account { s := new(Account) s.AccountId = AccountId s.Name = Name s.Email = Email s.EmailVerified = EmailVerified s.Disabled = Disabled return s }
[ "func", "NewAccount", "(", "AccountId", "string", ",", "Name", "*", "Name", ",", "Email", "string", ",", "EmailVerified", "bool", ",", "Disabled", "bool", ")", "*", "Account", "{", "s", ":=", "new", "(", "Account", ")", "\n", "s", ".", "AccountId", "="...
// NewAccount returns a new Account instance
[ "NewAccount", "returns", "a", "new", "Account", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/users/types.go#L55-L63
137,980
dropbox/dropbox-sdk-go-unofficial
dropbox/users/types.go
NewBasicAccount
func NewBasicAccount(AccountId string, Name *Name, Email string, EmailVerified bool, Disabled bool, IsTeammate bool) *BasicAccount { s := new(BasicAccount) s.AccountId = AccountId s.Name = Name s.Email = Email s.EmailVerified = EmailVerified s.Disabled = Disabled s.IsTeammate = IsTeammate return s }
go
func NewBasicAccount(AccountId string, Name *Name, Email string, EmailVerified bool, Disabled bool, IsTeammate bool) *BasicAccount { s := new(BasicAccount) s.AccountId = AccountId s.Name = Name s.Email = Email s.EmailVerified = EmailVerified s.Disabled = Disabled s.IsTeammate = IsTeammate return s }
[ "func", "NewBasicAccount", "(", "AccountId", "string", ",", "Name", "*", "Name", ",", "Email", "string", ",", "EmailVerified", "bool", ",", "Disabled", "bool", ",", "IsTeammate", "bool", ")", "*", "BasicAccount", "{", "s", ":=", "new", "(", "BasicAccount", ...
// NewBasicAccount returns a new BasicAccount instance
[ "NewBasicAccount", "returns", "a", "new", "BasicAccount", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/users/types.go#L77-L86
137,981
dropbox/dropbox-sdk-go-unofficial
dropbox/users/types.go
NewFullAccount
func NewFullAccount(AccountId string, Name *Name, Email string, EmailVerified bool, Disabled bool, Locale string, ReferralLink string, IsPaired bool, AccountType *users_common.AccountType, RootInfo common.IsRootInfo) *FullAccount { s := new(FullAccount) s.AccountId = AccountId s.Name = Name s.Email = Email s.Email...
go
func NewFullAccount(AccountId string, Name *Name, Email string, EmailVerified bool, Disabled bool, Locale string, ReferralLink string, IsPaired bool, AccountType *users_common.AccountType, RootInfo common.IsRootInfo) *FullAccount { s := new(FullAccount) s.AccountId = AccountId s.Name = Name s.Email = Email s.Email...
[ "func", "NewFullAccount", "(", "AccountId", "string", ",", "Name", "*", "Name", ",", "Email", "string", ",", "EmailVerified", "bool", ",", "Disabled", "bool", ",", "Locale", "string", ",", "ReferralLink", "string", ",", "IsPaired", "bool", ",", "AccountType", ...
// NewFullAccount returns a new FullAccount instance
[ "NewFullAccount", "returns", "a", "new", "FullAccount", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/users/types.go#L117-L130
137,982
dropbox/dropbox-sdk-go-unofficial
dropbox/users/types.go
UnmarshalJSON
func (u *FullAccount) UnmarshalJSON(b []byte) error { type wrap struct { // AccountId : The user's unique Dropbox ID. AccountId string `json:"account_id"` // Name : Details of a user's name. Name *Name `json:"name"` // Email : The user's e-mail address. Do not rely on this without // checking the `email_ve...
go
func (u *FullAccount) UnmarshalJSON(b []byte) error { type wrap struct { // AccountId : The user's unique Dropbox ID. AccountId string `json:"account_id"` // Name : Details of a user's name. Name *Name `json:"name"` // Email : The user's e-mail address. Do not rely on this without // checking the `email_ve...
[ "func", "(", "u", "*", "FullAccount", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "type", "wrap", "struct", "{", "// AccountId : The user's unique Dropbox ID.", "AccountId", "string", "`json:\"account_id\"`", "\n", "// Name : Details of a user...
// UnmarshalJSON deserializes into a FullAccount instance
[ "UnmarshalJSON", "deserializes", "into", "a", "FullAccount", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/users/types.go#L133-L199
137,983
dropbox/dropbox-sdk-go-unofficial
dropbox/users/types.go
NewTeam
func NewTeam(Id string, Name string) *Team { s := new(Team) s.Id = Id s.Name = Name return s }
go
func NewTeam(Id string, Name string) *Team { s := new(Team) s.Id = Id s.Name = Name return s }
[ "func", "NewTeam", "(", "Id", "string", ",", "Name", "string", ")", "*", "Team", "{", "s", ":=", "new", "(", "Team", ")", "\n", "s", ".", "Id", "=", "Id", "\n", "s", ".", "Name", "=", "Name", "\n", "return", "s", "\n", "}" ]
// NewTeam returns a new Team instance
[ "NewTeam", "returns", "a", "new", "Team", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/users/types.go#L210-L215
137,984
dropbox/dropbox-sdk-go-unofficial
dropbox/users/types.go
NewFullTeam
func NewFullTeam(Id string, Name string, SharingPolicies *team_policies.TeamSharingPolicies, OfficeAddinPolicy *team_policies.OfficeAddInPolicy) *FullTeam { s := new(FullTeam) s.Id = Id s.Name = Name s.SharingPolicies = SharingPolicies s.OfficeAddinPolicy = OfficeAddinPolicy return s }
go
func NewFullTeam(Id string, Name string, SharingPolicies *team_policies.TeamSharingPolicies, OfficeAddinPolicy *team_policies.OfficeAddInPolicy) *FullTeam { s := new(FullTeam) s.Id = Id s.Name = Name s.SharingPolicies = SharingPolicies s.OfficeAddinPolicy = OfficeAddinPolicy return s }
[ "func", "NewFullTeam", "(", "Id", "string", ",", "Name", "string", ",", "SharingPolicies", "*", "team_policies", ".", "TeamSharingPolicies", ",", "OfficeAddinPolicy", "*", "team_policies", ".", "OfficeAddInPolicy", ")", "*", "FullTeam", "{", "s", ":=", "new", "(...
// NewFullTeam returns a new FullTeam instance
[ "NewFullTeam", "returns", "a", "new", "FullTeam", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/users/types.go#L227-L234
137,985
dropbox/dropbox-sdk-go-unofficial
dropbox/users/types.go
NewGetAccountArg
func NewGetAccountArg(AccountId string) *GetAccountArg { s := new(GetAccountArg) s.AccountId = AccountId return s }
go
func NewGetAccountArg(AccountId string) *GetAccountArg { s := new(GetAccountArg) s.AccountId = AccountId return s }
[ "func", "NewGetAccountArg", "(", "AccountId", "string", ")", "*", "GetAccountArg", "{", "s", ":=", "new", "(", "GetAccountArg", ")", "\n", "s", ".", "AccountId", "=", "AccountId", "\n", "return", "s", "\n", "}" ]
// NewGetAccountArg returns a new GetAccountArg instance
[ "NewGetAccountArg", "returns", "a", "new", "GetAccountArg", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/users/types.go#L243-L247
137,986
dropbox/dropbox-sdk-go-unofficial
dropbox/users/types.go
NewGetAccountBatchArg
func NewGetAccountBatchArg(AccountIds []string) *GetAccountBatchArg { s := new(GetAccountBatchArg) s.AccountIds = AccountIds return s }
go
func NewGetAccountBatchArg(AccountIds []string) *GetAccountBatchArg { s := new(GetAccountBatchArg) s.AccountIds = AccountIds return s }
[ "func", "NewGetAccountBatchArg", "(", "AccountIds", "[", "]", "string", ")", "*", "GetAccountBatchArg", "{", "s", ":=", "new", "(", "GetAccountBatchArg", ")", "\n", "s", ".", "AccountIds", "=", "AccountIds", "\n", "return", "s", "\n", "}" ]
// NewGetAccountBatchArg returns a new GetAccountBatchArg instance
[ "NewGetAccountBatchArg", "returns", "a", "new", "GetAccountBatchArg", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/users/types.go#L257-L261
137,987
dropbox/dropbox-sdk-go-unofficial
dropbox/users/types.go
UnmarshalJSON
func (u *GetAccountBatchError) UnmarshalJSON(body []byte) error { type wrap struct { dropbox.Tagged } var w wrap var err error if err = json.Unmarshal(body, &w); err != nil { return err } u.Tag = w.Tag switch u.Tag { case "no_account": err = json.Unmarshal(body, &u.NoAccount) if err != nil { return...
go
func (u *GetAccountBatchError) UnmarshalJSON(body []byte) error { type wrap struct { dropbox.Tagged } var w wrap var err error if err = json.Unmarshal(body, &w); err != nil { return err } u.Tag = w.Tag switch u.Tag { case "no_account": err = json.Unmarshal(body, &u.NoAccount) if err != nil { return...
[ "func", "(", "u", "*", "GetAccountBatchError", ")", "UnmarshalJSON", "(", "body", "[", "]", "byte", ")", "error", "{", "type", "wrap", "struct", "{", "dropbox", ".", "Tagged", "\n", "}", "\n", "var", "w", "wrap", "\n", "var", "err", "error", "\n", "i...
// UnmarshalJSON deserializes into a GetAccountBatchError instance
[ "UnmarshalJSON", "deserializes", "into", "a", "GetAccountBatchError", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/users/types.go#L278-L297
137,988
dropbox/dropbox-sdk-go-unofficial
dropbox/users/types.go
NewIndividualSpaceAllocation
func NewIndividualSpaceAllocation(Allocated uint64) *IndividualSpaceAllocation { s := new(IndividualSpaceAllocation) s.Allocated = Allocated return s }
go
func NewIndividualSpaceAllocation(Allocated uint64) *IndividualSpaceAllocation { s := new(IndividualSpaceAllocation) s.Allocated = Allocated return s }
[ "func", "NewIndividualSpaceAllocation", "(", "Allocated", "uint64", ")", "*", "IndividualSpaceAllocation", "{", "s", ":=", "new", "(", "IndividualSpaceAllocation", ")", "\n", "s", ".", "Allocated", "=", "Allocated", "\n", "return", "s", "\n", "}" ]
// NewIndividualSpaceAllocation returns a new IndividualSpaceAllocation instance
[ "NewIndividualSpaceAllocation", "returns", "a", "new", "IndividualSpaceAllocation", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/users/types.go#L317-L321
137,989
dropbox/dropbox-sdk-go-unofficial
dropbox/users/types.go
NewName
func NewName(GivenName string, Surname string, FamiliarName string, DisplayName string, AbbreviatedName string) *Name { s := new(Name) s.GivenName = GivenName s.Surname = Surname s.FamiliarName = FamiliarName s.DisplayName = DisplayName s.AbbreviatedName = AbbreviatedName return s }
go
func NewName(GivenName string, Surname string, FamiliarName string, DisplayName string, AbbreviatedName string) *Name { s := new(Name) s.GivenName = GivenName s.Surname = Surname s.FamiliarName = FamiliarName s.DisplayName = DisplayName s.AbbreviatedName = AbbreviatedName return s }
[ "func", "NewName", "(", "GivenName", "string", ",", "Surname", "string", ",", "FamiliarName", "string", ",", "DisplayName", "string", ",", "AbbreviatedName", "string", ")", "*", "Name", "{", "s", ":=", "new", "(", "Name", ")", "\n", "s", ".", "GivenName", ...
// NewName returns a new Name instance
[ "NewName", "returns", "a", "new", "Name", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/users/types.go#L343-L351
137,990
dropbox/dropbox-sdk-go-unofficial
dropbox/users/types.go
UnmarshalJSON
func (u *SpaceAllocation) UnmarshalJSON(body []byte) error { type wrap struct { dropbox.Tagged // Individual : The user's space allocation applies only to their // individual account. Individual json.RawMessage `json:"individual,omitempty"` // Team : The user shares space with other members of their team. ...
go
func (u *SpaceAllocation) UnmarshalJSON(body []byte) error { type wrap struct { dropbox.Tagged // Individual : The user's space allocation applies only to their // individual account. Individual json.RawMessage `json:"individual,omitempty"` // Team : The user shares space with other members of their team. ...
[ "func", "(", "u", "*", "SpaceAllocation", ")", "UnmarshalJSON", "(", "body", "[", "]", "byte", ")", "error", "{", "type", "wrap", "struct", "{", "dropbox", ".", "Tagged", "\n", "// Individual : The user's space allocation applies only to their", "// individual account...
// UnmarshalJSON deserializes into a SpaceAllocation instance
[ "UnmarshalJSON", "deserializes", "into", "a", "SpaceAllocation", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/users/types.go#L372-L402
137,991
dropbox/dropbox-sdk-go-unofficial
dropbox/users/types.go
NewSpaceUsage
func NewSpaceUsage(Used uint64, Allocation *SpaceAllocation) *SpaceUsage { s := new(SpaceUsage) s.Used = Used s.Allocation = Allocation return s }
go
func NewSpaceUsage(Used uint64, Allocation *SpaceAllocation) *SpaceUsage { s := new(SpaceUsage) s.Used = Used s.Allocation = Allocation return s }
[ "func", "NewSpaceUsage", "(", "Used", "uint64", ",", "Allocation", "*", "SpaceAllocation", ")", "*", "SpaceUsage", "{", "s", ":=", "new", "(", "SpaceUsage", ")", "\n", "s", ".", "Used", "=", "Used", "\n", "s", ".", "Allocation", "=", "Allocation", "\n", ...
// NewSpaceUsage returns a new SpaceUsage instance
[ "NewSpaceUsage", "returns", "a", "new", "SpaceUsage", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/users/types.go#L413-L418
137,992
dropbox/dropbox-sdk-go-unofficial
dropbox/users/types.go
NewTeamSpaceAllocation
func NewTeamSpaceAllocation(Used uint64, Allocated uint64, UserWithinTeamSpaceAllocated uint64, UserWithinTeamSpaceLimitType *team_common.MemberSpaceLimitType) *TeamSpaceAllocation { s := new(TeamSpaceAllocation) s.Used = Used s.Allocated = Allocated s.UserWithinTeamSpaceAllocated = UserWithinTeamSpaceAllocated s....
go
func NewTeamSpaceAllocation(Used uint64, Allocated uint64, UserWithinTeamSpaceAllocated uint64, UserWithinTeamSpaceLimitType *team_common.MemberSpaceLimitType) *TeamSpaceAllocation { s := new(TeamSpaceAllocation) s.Used = Used s.Allocated = Allocated s.UserWithinTeamSpaceAllocated = UserWithinTeamSpaceAllocated s....
[ "func", "NewTeamSpaceAllocation", "(", "Used", "uint64", ",", "Allocated", "uint64", ",", "UserWithinTeamSpaceAllocated", "uint64", ",", "UserWithinTeamSpaceLimitType", "*", "team_common", ".", "MemberSpaceLimitType", ")", "*", "TeamSpaceAllocation", "{", "s", ":=", "ne...
// NewTeamSpaceAllocation returns a new TeamSpaceAllocation instance
[ "NewTeamSpaceAllocation", "returns", "a", "new", "TeamSpaceAllocation", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/users/types.go#L436-L443
137,993
dropbox/dropbox-sdk-go-unofficial
dropbox/file_requests/types.go
NewCreateFileRequestArgs
func NewCreateFileRequestArgs(Title string, Destination string) *CreateFileRequestArgs { s := new(CreateFileRequestArgs) s.Title = Title s.Destination = Destination s.Open = true return s }
go
func NewCreateFileRequestArgs(Title string, Destination string) *CreateFileRequestArgs { s := new(CreateFileRequestArgs) s.Title = Title s.Destination = Destination s.Open = true return s }
[ "func", "NewCreateFileRequestArgs", "(", "Title", "string", ",", "Destination", "string", ")", "*", "CreateFileRequestArgs", "{", "s", ":=", "new", "(", "CreateFileRequestArgs", ")", "\n", "s", ".", "Title", "=", "Title", "\n", "s", ".", "Destination", "=", ...
// NewCreateFileRequestArgs returns a new CreateFileRequestArgs instance
[ "NewCreateFileRequestArgs", "returns", "a", "new", "CreateFileRequestArgs", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/file_requests/types.go#L50-L56
137,994
dropbox/dropbox-sdk-go-unofficial
dropbox/file_requests/types.go
NewFileRequest
func NewFileRequest(Id string, Url string, Title string, Created time.Time, IsOpen bool, FileCount int64) *FileRequest { s := new(FileRequest) s.Id = Id s.Url = Url s.Title = Title s.Created = Created s.IsOpen = IsOpen s.FileCount = FileCount return s }
go
func NewFileRequest(Id string, Url string, Title string, Created time.Time, IsOpen bool, FileCount int64) *FileRequest { s := new(FileRequest) s.Id = Id s.Url = Url s.Title = Title s.Created = Created s.IsOpen = IsOpen s.FileCount = FileCount return s }
[ "func", "NewFileRequest", "(", "Id", "string", ",", "Url", "string", ",", "Title", "string", ",", "Created", "time", ".", "Time", ",", "IsOpen", "bool", ",", "FileCount", "int64", ")", "*", "FileRequest", "{", "s", ":=", "new", "(", "FileRequest", ")", ...
// NewFileRequest returns a new FileRequest instance
[ "NewFileRequest", "returns", "a", "new", "FileRequest", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/file_requests/types.go#L132-L141
137,995
dropbox/dropbox-sdk-go-unofficial
dropbox/file_requests/types.go
NewFileRequestDeadline
func NewFileRequestDeadline(Deadline time.Time) *FileRequestDeadline { s := new(FileRequestDeadline) s.Deadline = Deadline return s }
go
func NewFileRequestDeadline(Deadline time.Time) *FileRequestDeadline { s := new(FileRequestDeadline) s.Deadline = Deadline return s }
[ "func", "NewFileRequestDeadline", "(", "Deadline", "time", ".", "Time", ")", "*", "FileRequestDeadline", "{", "s", ":=", "new", "(", "FileRequestDeadline", ")", "\n", "s", ".", "Deadline", "=", "Deadline", "\n", "return", "s", "\n", "}" ]
// NewFileRequestDeadline returns a new FileRequestDeadline instance
[ "NewFileRequestDeadline", "returns", "a", "new", "FileRequestDeadline", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/file_requests/types.go#L153-L157
137,996
dropbox/dropbox-sdk-go-unofficial
dropbox/file_requests/types.go
NewGetFileRequestArgs
func NewGetFileRequestArgs(Id string) *GetFileRequestArgs { s := new(GetFileRequestArgs) s.Id = Id return s }
go
func NewGetFileRequestArgs(Id string) *GetFileRequestArgs { s := new(GetFileRequestArgs) s.Id = Id return s }
[ "func", "NewGetFileRequestArgs", "(", "Id", "string", ")", "*", "GetFileRequestArgs", "{", "s", ":=", "new", "(", "GetFileRequestArgs", ")", "\n", "s", ".", "Id", "=", "Id", "\n", "return", "s", "\n", "}" ]
// NewGetFileRequestArgs returns a new GetFileRequestArgs instance
[ "NewGetFileRequestArgs", "returns", "a", "new", "GetFileRequestArgs", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/file_requests/types.go#L166-L170
137,997
dropbox/dropbox-sdk-go-unofficial
dropbox/file_requests/types.go
NewListFileRequestsResult
func NewListFileRequestsResult(FileRequests []*FileRequest) *ListFileRequestsResult { s := new(ListFileRequestsResult) s.FileRequests = FileRequests return s }
go
func NewListFileRequestsResult(FileRequests []*FileRequest) *ListFileRequestsResult { s := new(ListFileRequestsResult) s.FileRequests = FileRequests return s }
[ "func", "NewListFileRequestsResult", "(", "FileRequests", "[", "]", "*", "FileRequest", ")", "*", "ListFileRequestsResult", "{", "s", ":=", "new", "(", "ListFileRequestsResult", ")", "\n", "s", ".", "FileRequests", "=", "FileRequests", "\n", "return", "s", "\n",...
// NewListFileRequestsResult returns a new ListFileRequestsResult instance
[ "NewListFileRequestsResult", "returns", "a", "new", "ListFileRequestsResult", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/file_requests/types.go#L224-L228
137,998
dropbox/dropbox-sdk-go-unofficial
dropbox/file_requests/types.go
NewUpdateFileRequestArgs
func NewUpdateFileRequestArgs(Id string) *UpdateFileRequestArgs { s := new(UpdateFileRequestArgs) s.Id = Id s.Deadline = &UpdateFileRequestDeadline{Tagged: dropbox.Tagged{"no_update"}} return s }
go
func NewUpdateFileRequestArgs(Id string) *UpdateFileRequestArgs { s := new(UpdateFileRequestArgs) s.Id = Id s.Deadline = &UpdateFileRequestDeadline{Tagged: dropbox.Tagged{"no_update"}} return s }
[ "func", "NewUpdateFileRequestArgs", "(", "Id", "string", ")", "*", "UpdateFileRequestArgs", "{", "s", ":=", "new", "(", "UpdateFileRequestArgs", ")", "\n", "s", ".", "Id", "=", "Id", "\n", "s", ".", "Deadline", "=", "&", "UpdateFileRequestDeadline", "{", "Ta...
// NewUpdateFileRequestArgs returns a new UpdateFileRequestArgs instance
[ "NewUpdateFileRequestArgs", "returns", "a", "new", "UpdateFileRequestArgs", "instance" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/file_requests/types.go#L248-L253
137,999
dropbox/dropbox-sdk-go-unofficial
dropbox/sdk.go
LogDebug
func (c *Config) LogDebug(format string, v ...interface{}) { c.doLog(LogDebug, format, v...) }
go
func (c *Config) LogDebug(format string, v ...interface{}) { c.doLog(LogDebug, format, v...) }
[ "func", "(", "c", "*", "Config", ")", "LogDebug", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "c", ".", "doLog", "(", "LogDebug", ",", "format", ",", "v", "...", ")", "\n", "}" ]
// LogDebug emits a debug level SDK log if config's log level is at least LogDebug
[ "LogDebug", "emits", "a", "debug", "level", "SDK", "log", "if", "config", "s", "log", "level", "is", "at", "least", "LogDebug" ]
af4558f5e44cef90c2d963e50e76e7dfa46d0c48
https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/af4558f5e44cef90c2d963e50e76e7dfa46d0c48/dropbox/sdk.go#L99-L101