id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
136,800
elodina/go-avro
decoder.go
ReadFixed
func (bd *BinaryDecoder) ReadFixed(bytes []byte) error { return bd.readBytes(bytes, 0, len(bytes)) }
go
func (bd *BinaryDecoder) ReadFixed(bytes []byte) error { return bd.readBytes(bytes, 0, len(bytes)) }
[ "func", "(", "bd", "*", "BinaryDecoder", ")", "ReadFixed", "(", "bytes", "[", "]", "byte", ")", "error", "{", "return", "bd", ".", "readBytes", "(", "bytes", ",", "0", ",", "len", "(", "bytes", ")", ")", "\n", "}" ]
// ReadFixed reads fixed sized binary object into the provided buffer. // Returns an error if it occurs.
[ "ReadFixed", "reads", "fixed", "sized", "binary", "object", "into", "the", "provided", "buffer", ".", "Returns", "an", "error", "if", "it", "occurs", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/decoder.go#L275-L277
136,801
elodina/go-avro
decoder.go
ReadFixedWithBounds
func (bd *BinaryDecoder) ReadFixedWithBounds(bytes []byte, start int, length int) error { return bd.readBytes(bytes, start, length) }
go
func (bd *BinaryDecoder) ReadFixedWithBounds(bytes []byte, start int, length int) error { return bd.readBytes(bytes, start, length) }
[ "func", "(", "bd", "*", "BinaryDecoder", ")", "ReadFixedWithBounds", "(", "bytes", "[", "]", "byte", ",", "start", "int", ",", "length", "int", ")", "error", "{", "return", "bd", ".", "readBytes", "(", "bytes", ",", "start", ",", "length", ")", "\n", ...
// ReadFixedWithBounds reads fixed sized binary object into the provided buffer. // The second parameter is the position where the data needs to be written, the third is the size of binary object. // Returns an error if it occurs.
[ "ReadFixedWithBounds", "reads", "fixed", "sized", "binary", "object", "into", "the", "provided", "buffer", ".", "The", "second", "parameter", "is", "the", "position", "where", "the", "data", "needs", "to", "be", "written", "the", "third", "is", "the", "size", ...
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/decoder.go#L282-L284
136,802
elodina/go-avro
decoder.go
SetBlock
func (bd *BinaryDecoder) SetBlock(block *DataBlock) { bd.buf = block.Data bd.Seek(0) }
go
func (bd *BinaryDecoder) SetBlock(block *DataBlock) { bd.buf = block.Data bd.Seek(0) }
[ "func", "(", "bd", "*", "BinaryDecoder", ")", "SetBlock", "(", "block", "*", "DataBlock", ")", "{", "bd", ".", "buf", "=", "block", ".", "Data", "\n", "bd", ".", "Seek", "(", "0", ")", "\n", "}" ]
// SetBlock is used for Avro Object Container Files where the data is split in blocks and sets a data block // for this decoder and sets the position to the start of this block.
[ "SetBlock", "is", "used", "for", "Avro", "Object", "Container", "Files", "where", "the", "data", "is", "split", "in", "blocks", "and", "sets", "a", "data", "block", "for", "this", "decoder", "and", "sets", "the", "position", "to", "the", "start", "of", "...
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/decoder.go#L288-L291
136,803
elodina/go-avro
generic_record.go
NewGenericRecord
func NewGenericRecord(schema Schema) *GenericRecord { return &GenericRecord{ fields: make(map[string]interface{}), schema: schema, } }
go
func NewGenericRecord(schema Schema) *GenericRecord { return &GenericRecord{ fields: make(map[string]interface{}), schema: schema, } }
[ "func", "NewGenericRecord", "(", "schema", "Schema", ")", "*", "GenericRecord", "{", "return", "&", "GenericRecord", "{", "fields", ":", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", ",", "schema", ":", "schema", ",", "}", "\n", "...
// NewGenericRecord creates a new GenericRecord.
[ "NewGenericRecord", "creates", "a", "new", "GenericRecord", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/generic_record.go#L34-L39
136,804
elodina/go-avro
generic_record.go
Set
func (gr *GenericRecord) Set(name string, value interface{}) { gr.fields[name] = value }
go
func (gr *GenericRecord) Set(name string, value interface{}) { gr.fields[name] = value }
[ "func", "(", "gr", "*", "GenericRecord", ")", "Set", "(", "name", "string", ",", "value", "interface", "{", "}", ")", "{", "gr", ".", "fields", "[", "name", "]", "=", "value", "\n", "}" ]
// Set sets a value for a given name.
[ "Set", "sets", "a", "value", "for", "a", "given", "name", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/generic_record.go#L47-L49
136,805
elodina/go-avro
generic_record.go
String
func (gr *GenericRecord) String() string { m := gr.Map() buf, err := json.Marshal(m) if err != nil { panic(err) } return string(buf) }
go
func (gr *GenericRecord) String() string { m := gr.Map() buf, err := json.Marshal(m) if err != nil { panic(err) } return string(buf) }
[ "func", "(", "gr", "*", "GenericRecord", ")", "String", "(", ")", "string", "{", "m", ":=", "gr", ".", "Map", "(", ")", "\n", "buf", ",", "err", ":=", "json", ".", "Marshal", "(", "m", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "...
// String returns a JSON representation of this GenericRecord.
[ "String", "returns", "a", "JSON", "representation", "of", "this", "GenericRecord", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/generic_record.go#L57-L64
136,806
elodina/go-avro
generic_record.go
Map
func (gr *GenericRecord) Map() map[string]interface{} { m := make(map[string]interface{}) for k, v := range gr.fields { if r, ok := v.(*GenericRecord); ok { v = r.Map() } if a, ok := v.([]interface{}); ok { slice := make([]interface{}, len(a)) for i, elem := range a { if rec, ok := elem.(*GenericRe...
go
func (gr *GenericRecord) Map() map[string]interface{} { m := make(map[string]interface{}) for k, v := range gr.fields { if r, ok := v.(*GenericRecord); ok { v = r.Map() } if a, ok := v.([]interface{}); ok { slice := make([]interface{}, len(a)) for i, elem := range a { if rec, ok := elem.(*GenericRe...
[ "func", "(", "gr", "*", "GenericRecord", ")", "Map", "(", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "m", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "for", "k", ",", "v", ":=", "range", "gr"...
// Map returns a map representation of this GenericRecord.
[ "Map", "returns", "a", "map", "representation", "of", "this", "GenericRecord", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/generic_record.go#L67-L86
136,807
elodina/go-avro
schema.go
MarshalJSON
func (s *RecursiveSchema) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf(`"%s"`, s.Actual.GetName())), nil }
go
func (s *RecursiveSchema) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf(`"%s"`, s.Actual.GetName())), nil }
[ "func", "(", "s", "*", "RecursiveSchema", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "[", "]", "byte", "(", "fmt", ".", "Sprintf", "(", "`\"%s\"`", ",", "s", ".", "Actual", ".", "GetName", "(", ")", ")"...
// MarshalJSON serializes the given schema as JSON. Never returns an error.
[ "MarshalJSON", "serializes", "the", "given", "schema", "as", "JSON", ".", "Never", "returns", "an", "error", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/schema.go#L536-L538
136,808
elodina/go-avro
schema.go
Prop
func (this *SchemaField) Prop(key string) (interface{}, bool) { if this.Properties != nil { if prop, ok := this.Properties[key]; ok { return prop, true } } return nil, false }
go
func (this *SchemaField) Prop(key string) (interface{}, bool) { if this.Properties != nil { if prop, ok := this.Properties[key]; ok { return prop, true } } return nil, false }
[ "func", "(", "this", "*", "SchemaField", ")", "Prop", "(", "key", "string", ")", "(", "interface", "{", "}", ",", "bool", ")", "{", "if", "this", ".", "Properties", "!=", "nil", "{", "if", "prop", ",", "ok", ":=", "this", ".", "Properties", "[", ...
// Gets a custom non-reserved property from this schemafield and a bool representing if it exists.
[ "Gets", "a", "custom", "non", "-", "reserved", "property", "from", "this", "schemafield", "and", "a", "bool", "representing", "if", "it", "exists", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/schema.go#L550-L557
136,809
elodina/go-avro
schema.go
String
func (s *SchemaField) String() string { return fmt.Sprintf("[SchemaField: Name: %s, Doc: %s, Default: %v, Type: %s]", s.Name, s.Doc, s.Default, s.Type) }
go
func (s *SchemaField) String() string { return fmt.Sprintf("[SchemaField: Name: %s, Doc: %s, Default: %v, Type: %s]", s.Name, s.Doc, s.Default, s.Type) }
[ "func", "(", "s", "*", "SchemaField", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "s", ".", "Name", ",", "s", ".", "Doc", ",", "s", ".", "Default", ",", "s", ".", "Type", ")", "\n", "}" ]
// String returns a JSON representation of SchemaField.
[ "String", "returns", "a", "JSON", "representation", "of", "SchemaField", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/schema.go#L589-L591
136,810
elodina/go-avro
schema.go
Prop
func (s *ArraySchema) Prop(key string) (interface{}, bool) { if s.Properties != nil { if prop, ok := s.Properties[key]; ok { return prop, true } } return nil, false }
go
func (s *ArraySchema) Prop(key string) (interface{}, bool) { if s.Properties != nil { if prop, ok := s.Properties[key]; ok { return prop, true } } return nil, false }
[ "func", "(", "s", "*", "ArraySchema", ")", "Prop", "(", "key", "string", ")", "(", "interface", "{", "}", ",", "bool", ")", "{", "if", "s", ".", "Properties", "!=", "nil", "{", "if", "prop", ",", "ok", ":=", "s", ".", "Properties", "[", "key", ...
// Prop gets a custom non-reserved property from this schema and a bool representing if it exists.
[ "Prop", "gets", "a", "custom", "non", "-", "reserved", "property", "from", "this", "schema", "and", "a", "bool", "representing", "if", "it", "exists", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/schema.go#L684-L692
136,811
elodina/go-avro
schema.go
String
func (s *MapSchema) String() string { bytes, err := json.MarshalIndent(s, "", " ") if err != nil { panic(err) } return string(bytes) }
go
func (s *MapSchema) String() string { bytes, err := json.MarshalIndent(s, "", " ") if err != nil { panic(err) } return string(bytes) }
[ "func", "(", "s", "*", "MapSchema", ")", "String", "(", ")", "string", "{", "bytes", ",", "err", ":=", "json", ".", "MarshalIndent", "(", "s", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")",...
// String returns a JSON representation of MapSchema.
[ "String", "returns", "a", "JSON", "representation", "of", "MapSchema", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/schema.go#L720-L727
136,812
elodina/go-avro
schema.go
String
func (s *UnionSchema) String() string { bytes, err := json.MarshalIndent(s, "", " ") if err != nil { panic(err) } return fmt.Sprintf(`{"type": %s}`, string(bytes)) }
go
func (s *UnionSchema) String() string { bytes, err := json.MarshalIndent(s, "", " ") if err != nil { panic(err) } return fmt.Sprintf(`{"type": %s}`, string(bytes)) }
[ "func", "(", "s", "*", "UnionSchema", ")", "String", "(", ")", "string", "{", "bytes", ",", "err", ":=", "json", ".", "MarshalIndent", "(", "s", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")...
// String returns a JSON representation of UnionSchema.
[ "String", "returns", "a", "JSON", "representation", "of", "UnionSchema", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/schema.go#L773-L780
136,813
elodina/go-avro
schema.go
GetType
func (s *UnionSchema) GetType(v reflect.Value) int { if s.Types != nil { for i := range s.Types { if t := s.Types[i]; t.Validate(v) { return i } } } return -1 }
go
func (s *UnionSchema) GetType(v reflect.Value) int { if s.Types != nil { for i := range s.Types { if t := s.Types[i]; t.Validate(v) { return i } } } return -1 }
[ "func", "(", "s", "*", "UnionSchema", ")", "GetType", "(", "v", "reflect", ".", "Value", ")", "int", "{", "if", "s", ".", "Types", "!=", "nil", "{", "for", "i", ":=", "range", "s", ".", "Types", "{", "if", "t", ":=", "s", ".", "Types", "[", "...
// GetType gets the index of actual union type for a given value.
[ "GetType", "gets", "the", "index", "of", "actual", "union", "type", "for", "a", "given", "value", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/schema.go#L798-L808
136,814
elodina/go-avro
schema.go
GetFullName
func GetFullName(schema Schema) string { switch sch := schema.(type) { case *RecordSchema: return getFullName(sch.GetName(), sch.Namespace) case *EnumSchema: return getFullName(sch.GetName(), sch.Namespace) case *FixedSchema: return getFullName(sch.GetName(), sch.Namespace) default: return schema.GetName()...
go
func GetFullName(schema Schema) string { switch sch := schema.(type) { case *RecordSchema: return getFullName(sch.GetName(), sch.Namespace) case *EnumSchema: return getFullName(sch.GetName(), sch.Namespace) case *FixedSchema: return getFullName(sch.GetName(), sch.Namespace) default: return schema.GetName()...
[ "func", "GetFullName", "(", "schema", "Schema", ")", "string", "{", "switch", "sch", ":=", "schema", ".", "(", "type", ")", "{", "case", "*", "RecordSchema", ":", "return", "getFullName", "(", "sch", ".", "GetName", "(", ")", ",", "sch", ".", "Namespac...
// GetFullName returns a fully-qualified name for a schema if possible. The format is namespace.name.
[ "GetFullName", "returns", "a", "fully", "-", "qualified", "name", "for", "a", "schema", "if", "possible", ".", "The", "format", "is", "namespace", ".", "name", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/schema.go#L886-L897
136,815
elodina/go-avro
schema.go
ParseSchemaFile
func ParseSchemaFile(file string) (Schema, error) { fileContents, err := ioutil.ReadFile(file) if err != nil { return nil, err } return ParseSchema(string(fileContents)) }
go
func ParseSchemaFile(file string) (Schema, error) { fileContents, err := ioutil.ReadFile(file) if err != nil { return nil, err } return ParseSchema(string(fileContents)) }
[ "func", "ParseSchemaFile", "(", "file", "string", ")", "(", "Schema", ",", "error", ")", "{", "fileContents", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "file", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", ...
// ParseSchemaFile parses a given file. // May return an error if schema is not parsable or file does not exist.
[ "ParseSchemaFile", "parses", "a", "given", "file", ".", "May", "return", "an", "error", "if", "schema", "is", "not", "parsable", "or", "file", "does", "not", "exist", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/schema.go#L901-L908
136,816
elodina/go-avro
schema.go
ParseSchemaWithRegistry
func ParseSchemaWithRegistry(rawSchema string, schemas map[string]Schema) (Schema, error) { var schema interface{} if err := json.Unmarshal([]byte(rawSchema), &schema); err != nil { schema = rawSchema } return schemaByType(schema, schemas, "") }
go
func ParseSchemaWithRegistry(rawSchema string, schemas map[string]Schema) (Schema, error) { var schema interface{} if err := json.Unmarshal([]byte(rawSchema), &schema); err != nil { schema = rawSchema } return schemaByType(schema, schemas, "") }
[ "func", "ParseSchemaWithRegistry", "(", "rawSchema", "string", ",", "schemas", "map", "[", "string", "]", "Schema", ")", "(", "Schema", ",", "error", ")", "{", "var", "schema", "interface", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "("...
// ParseSchemaWithRegistry parses a given schema using the provided registry for type lookup. // Registry will be filled up during parsing. // May return an error if schema is not parsable or has insufficient information about any type.
[ "ParseSchemaWithRegistry", "parses", "a", "given", "schema", "using", "the", "provided", "registry", "for", "type", "lookup", ".", "Registry", "will", "be", "filled", "up", "during", "parsing", ".", "May", "return", "an", "error", "if", "schema", "is", "not", ...
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/schema.go#L920-L927
136,817
elodina/go-avro
schema.go
MustParseSchema
func MustParseSchema(rawSchema string) Schema { s, err := ParseSchema(rawSchema) if err != nil { panic(err) } return s }
go
func MustParseSchema(rawSchema string) Schema { s, err := ParseSchema(rawSchema) if err != nil { panic(err) } return s }
[ "func", "MustParseSchema", "(", "rawSchema", "string", ")", "Schema", "{", "s", ",", "err", ":=", "ParseSchema", "(", "rawSchema", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "s", "\n", "}" ]
// MustParseSchema is like ParseSchema, but panics if the given schema cannot be parsed.
[ "MustParseSchema", "is", "like", "ParseSchema", "but", "panics", "if", "the", "given", "schema", "cannot", "be", "parsed", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/schema.go#L930-L936
136,818
elodina/go-avro
schema.go
getProperties
func getProperties(v map[string]interface{}) map[string]interface{} { props := make(map[string]interface{}) for name, value := range v { if !isReserved(name) { props[name] = value } } return props }
go
func getProperties(v map[string]interface{}) map[string]interface{} { props := make(map[string]interface{}) for name, value := range v { if !isReserved(name) { props[name] = value } } return props }
[ "func", "getProperties", "(", "v", "map", "[", "string", "]", "interface", "{", "}", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "props", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "for", "name",...
// gets custom string properties from a given schema
[ "gets", "custom", "string", "properties", "from", "a", "given", "schema" ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/schema.go#L1151-L1159
136,819
elodina/go-avro
data_file.go
NewDataFileReader
func NewDataFileReader(filename string, datumReader DatumReader) (*DataFileReader, error) { buf, err := ioutil.ReadFile(filename) if err != nil { return nil, err } return newDataFileReaderBytes(buf, datumReader) }
go
func NewDataFileReader(filename string, datumReader DatumReader) (*DataFileReader, error) { buf, err := ioutil.ReadFile(filename) if err != nil { return nil, err } return newDataFileReaderBytes(buf, datumReader) }
[ "func", "NewDataFileReader", "(", "filename", "string", ",", "datumReader", "DatumReader", ")", "(", "*", "DataFileReader", ",", "error", ")", "{", "buf", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "filename", ")", "\n", "if", "err", "!=", "nil", ...
// NewDataFileReader creates a new DataFileReader for a given file and using the given DatumReader to read the data from that file. // May return an error if the file contains invalid data or is just missing.
[ "NewDataFileReader", "creates", "a", "new", "DataFileReader", "for", "a", "given", "file", "and", "using", "the", "given", "DatumReader", "to", "read", "the", "data", "from", "that", "file", ".", "May", "return", "an", "error", "if", "the", "file", "contains...
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/data_file.go#L61-L68
136,820
elodina/go-avro
data_file.go
newDataFileReaderBytes
func newDataFileReaderBytes(buf []byte, datumReader DatumReader) (reader *DataFileReader, err error) { if len(buf) < len(magic) || !bytes.Equal(magic, buf[0:4]) { return nil, NotAvroFile } dec := NewBinaryDecoder(buf) blockDecoder := NewBinaryDecoder(nil) reader = &DataFileReader{ data: buf, dec: ...
go
func newDataFileReaderBytes(buf []byte, datumReader DatumReader) (reader *DataFileReader, err error) { if len(buf) < len(magic) || !bytes.Equal(magic, buf[0:4]) { return nil, NotAvroFile } dec := NewBinaryDecoder(buf) blockDecoder := NewBinaryDecoder(nil) reader = &DataFileReader{ data: buf, dec: ...
[ "func", "newDataFileReaderBytes", "(", "buf", "[", "]", "byte", ",", "datumReader", "DatumReader", ")", "(", "reader", "*", "DataFileReader", ",", "err", "error", ")", "{", "if", "len", "(", "buf", ")", "<", "len", "(", "magic", ")", "||", "!", "bytes"...
// separated out mainly for testing currently, will be refactored later for io.Reader paradigm
[ "separated", "out", "mainly", "for", "testing", "currently", "will", "be", "refactored", "later", "for", "io", ".", "Reader", "paradigm" ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/data_file.go#L71-L103
136,821
elodina/go-avro
data_file.go
NextBlock
func (reader *DataFileReader) NextBlock() error { blockCount, err := reader.dec.ReadLong() if err != nil { return err } blockSize, err := reader.dec.ReadLong() if err != nil { return err } if blockSize > math.MaxInt32 || blockSize < 0 { return fmt.Errorf("Block size invalid or too large: %d", blockSize) ...
go
func (reader *DataFileReader) NextBlock() error { blockCount, err := reader.dec.ReadLong() if err != nil { return err } blockSize, err := reader.dec.ReadLong() if err != nil { return err } if blockSize > math.MaxInt32 || blockSize < 0 { return fmt.Errorf("Block size invalid or too large: %d", blockSize) ...
[ "func", "(", "reader", "*", "DataFileReader", ")", "NextBlock", "(", ")", "error", "{", "blockCount", ",", "err", ":=", "reader", ".", "dec", ".", "ReadLong", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "blockSi...
// NextBlock tells this DataFileReader to skip current block and move to next one. // May return an error if the block is malformed or no more blocks left to read.
[ "NextBlock", "tells", "this", "DataFileReader", "to", "skip", "current", "block", "and", "move", "to", "next", "one", ".", "May", "return", "an", "error", "if", "the", "block", "is", "malformed", "or", "no", "more", "blocks", "left", "to", "read", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/data_file.go#L154-L191
136,822
elodina/go-avro
data_file.go
NewDataFileWriter
func NewDataFileWriter(output io.Writer, schema Schema, datumWriter DatumWriter) (writer *DataFileWriter, err error) { encoder := NewBinaryEncoder(output) datumWriter.SetSchema(schema) sync := []byte("1234567890abcdef") // TODO come up with other sync value header := &objFileHeader{ Magic: magic, Meta: map[str...
go
func NewDataFileWriter(output io.Writer, schema Schema, datumWriter DatumWriter) (writer *DataFileWriter, err error) { encoder := NewBinaryEncoder(output) datumWriter.SetSchema(schema) sync := []byte("1234567890abcdef") // TODO come up with other sync value header := &objFileHeader{ Magic: magic, Meta: map[str...
[ "func", "NewDataFileWriter", "(", "output", "io", ".", "Writer", ",", "schema", "Schema", ",", "datumWriter", "DatumWriter", ")", "(", "writer", "*", "DataFileWriter", ",", "err", "error", ")", "{", "encoder", ":=", "NewBinaryEncoder", "(", "output", ")", "\...
// NewDataFileWriter creates a new DataFileWriter for given output and schema using the given DatumWriter to write the data to that Writer. // May return an error if writing fails.
[ "NewDataFileWriter", "creates", "a", "new", "DataFileWriter", "for", "given", "output", "and", "schema", "using", "the", "given", "DatumWriter", "to", "write", "the", "data", "to", "that", "Writer", ".", "May", "return", "an", "error", "if", "writing", "fails"...
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/data_file.go#L210-L239
136,823
cloudflare/cfssl_trust
info/info.go
WriteCertificateInformation
func WriteCertificateInformation(w io.Writer, db *sql.DB, cert *certdb.Certificate) error { tx, err := db.Begin() if err != nil { fmt.Fprintf(os.Stderr, "[!] %s\n", err) os.Exit(1) } defer certdb.Finalize(&err, tx) err = writeBasicInformation(w, cert.X509()) if err != nil { return err } err = writeCerti...
go
func WriteCertificateInformation(w io.Writer, db *sql.DB, cert *certdb.Certificate) error { tx, err := db.Begin() if err != nil { fmt.Fprintf(os.Stderr, "[!] %s\n", err) os.Exit(1) } defer certdb.Finalize(&err, tx) err = writeBasicInformation(w, cert.X509()) if err != nil { return err } err = writeCerti...
[ "func", "WriteCertificateInformation", "(", "w", "io", ".", "Writer", ",", "db", "*", "sql", ".", "DB", ",", "cert", "*", "certdb", ".", "Certificate", ")", "error", "{", "tx", ",", "err", ":=", "db", ".", "Begin", "(", ")", "\n", "if", "err", "!="...
// WriteCertificateInformation pretty prints details about the given certificate // to the given io.Writer.
[ "WriteCertificateInformation", "pretty", "prints", "details", "about", "the", "given", "certificate", "to", "the", "given", "io", ".", "Writer", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/info/info.go#L54-L73
136,824
cloudflare/cfssl_trust
info/info.go
LoadCertificateMetadata
func LoadCertificateMetadata(tx *sql.Tx, cert *certdb.Certificate) (*CertificateMetadata, error) { x509Cert := cert.X509() cm := &CertificateMetadata{ SKI: cert.SKI, AKI: cert.AKI, Serial: x509Cert.SerialNumber, Subject: common.NameToString(x509Cert.Subject), Issuer: common.NameToString(x509Cert.I...
go
func LoadCertificateMetadata(tx *sql.Tx, cert *certdb.Certificate) (*CertificateMetadata, error) { x509Cert := cert.X509() cm := &CertificateMetadata{ SKI: cert.SKI, AKI: cert.AKI, Serial: x509Cert.SerialNumber, Subject: common.NameToString(x509Cert.Subject), Issuer: common.NameToString(x509Cert.I...
[ "func", "LoadCertificateMetadata", "(", "tx", "*", "sql", ".", "Tx", ",", "cert", "*", "certdb", ".", "Certificate", ")", "(", "*", "CertificateMetadata", ",", "error", ")", "{", "x509Cert", ":=", "cert", ".", "X509", "(", ")", "\n", "cm", ":=", "&", ...
// LoadCertificateMetadata returns the metadata for a given certificate.
[ "LoadCertificateMetadata", "returns", "the", "metadata", "for", "a", "given", "certificate", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/info/info.go#L87-L101
136,825
cloudflare/cfssl_trust
info/info.go
WriteCertificateMetadata
func WriteCertificateMetadata(w io.Writer, cert *CertificateMetadata) error { x509Cert := cert.cert.X509() _, err := fmt.Fprintf(w, `Subject: %s Issuer: %s Not Before: %s Not After: %s `, (cert.Subject), (cert.Issuer), x509Cert.NotBefore.UTC().Format(common.DateFormat), x509Cert.NotAfter.UTC().Format(common.D...
go
func WriteCertificateMetadata(w io.Writer, cert *CertificateMetadata) error { x509Cert := cert.cert.X509() _, err := fmt.Fprintf(w, `Subject: %s Issuer: %s Not Before: %s Not After: %s `, (cert.Subject), (cert.Issuer), x509Cert.NotBefore.UTC().Format(common.DateFormat), x509Cert.NotAfter.UTC().Format(common.D...
[ "func", "WriteCertificateMetadata", "(", "w", "io", ".", "Writer", ",", "cert", "*", "CertificateMetadata", ")", "error", "{", "x509Cert", ":=", "cert", ".", "cert", ".", "X509", "(", ")", "\n", "_", ",", "err", ":=", "fmt", ".", "Fprintf", "(", "w", ...
// WriteCertificateMetadata pretty prints the certificate metadata to // the given io.Writer.
[ "WriteCertificateMetadata", "pretty", "prints", "the", "certificate", "metadata", "to", "the", "given", "io", ".", "Writer", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/info/info.go#L105-L135
136,826
cloudflare/cfssl_trust
model/certdb/bundle.go
CollectRelease
func CollectRelease(bundle, version string, tx *sql.Tx) ([]*Certificate, error) { rel, err := NewRelease(bundle, version) if err != nil { return nil, err } err = rel.Select(tx) if err != nil { if err == sql.ErrNoRows { err = errors.New("model/certdb: invalid release " + version) } return nil, err } ...
go
func CollectRelease(bundle, version string, tx *sql.Tx) ([]*Certificate, error) { rel, err := NewRelease(bundle, version) if err != nil { return nil, err } err = rel.Select(tx) if err != nil { if err == sql.ErrNoRows { err = errors.New("model/certdb: invalid release " + version) } return nil, err } ...
[ "func", "CollectRelease", "(", "bundle", ",", "version", "string", ",", "tx", "*", "sql", ".", "Tx", ")", "(", "[", "]", "*", "Certificate", ",", "error", ")", "{", "rel", ",", "err", ":=", "NewRelease", "(", "bundle", ",", "version", ")", "\n", "i...
// CollectRelease grabs all the certificates in a release, ordering // them by the oldest.
[ "CollectRelease", "grabs", "all", "the", "certificates", "in", "a", "release", "ordering", "them", "by", "the", "oldest", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/bundle.go#L12-L58
136,827
cloudflare/cfssl_trust
release/release.go
New
func New() Release { now := time.Now() return Release{ Year: now.Year(), Month: int(now.Month()), } }
go
func New() Release { now := time.Now() return Release{ Year: now.Year(), Month: int(now.Month()), } }
[ "func", "New", "(", ")", "Release", "{", "now", ":=", "time", ".", "Now", "(", ")", "\n\n", "return", "Release", "{", "Year", ":", "now", ".", "Year", "(", ")", ",", "Month", ":", "int", "(", "now", ".", "Month", "(", ")", ")", ",", "}", "\n"...
// New returns a release for the current year and month with a zero // iteration counter.
[ "New", "returns", "a", "release", "for", "the", "current", "year", "and", "month", "with", "a", "zero", "iteration", "counter", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/release/release.go#L14-L21
136,828
cloudflare/cfssl_trust
release/release.go
IncAt
func (r Release) IncAt(now time.Time) (Release, error) { year := now.Year() month := int(now.Month()) rel := Release{ Year: r.Year, Month: r.Month, Iteration: r.Iteration, Extra: r.Extra, } if r.Year > year { return rel, errors.New("release: incremented release caused a regression (year)")...
go
func (r Release) IncAt(now time.Time) (Release, error) { year := now.Year() month := int(now.Month()) rel := Release{ Year: r.Year, Month: r.Month, Iteration: r.Iteration, Extra: r.Extra, } if r.Year > year { return rel, errors.New("release: incremented release caused a regression (year)")...
[ "func", "(", "r", "Release", ")", "IncAt", "(", "now", "time", ".", "Time", ")", "(", "Release", ",", "error", ")", "{", "year", ":=", "now", ".", "Year", "(", ")", "\n", "month", ":=", "int", "(", "now", ".", "Month", "(", ")", ")", "\n\n", ...
// IncAt increments the release assuming the given timestamp. This is // useful for verifying increments.
[ "IncAt", "increments", "the", "release", "assuming", "the", "given", "timestamp", ".", "This", "is", "useful", "for", "verifying", "increments", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/release/release.go#L97-L128
136,829
cloudflare/cfssl_trust
release/release.go
Parse
func Parse(in string) (Release, error) { var rel Release parts := strings.Split(in, ".") if len(parts) != 3 { return rel, errors.New("release: invalid release " + in) } var err error rel.Year, err = strconv.Atoi(parts[0]) if err != nil { return rel, err } else if rel.Year > 2038 || rel.Year < 2000 { retu...
go
func Parse(in string) (Release, error) { var rel Release parts := strings.Split(in, ".") if len(parts) != 3 { return rel, errors.New("release: invalid release " + in) } var err error rel.Year, err = strconv.Atoi(parts[0]) if err != nil { return rel, err } else if rel.Year > 2038 || rel.Year < 2000 { retu...
[ "func", "Parse", "(", "in", "string", ")", "(", "Release", ",", "error", ")", "{", "var", "rel", "Release", "\n", "parts", ":=", "strings", ".", "Split", "(", "in", ",", "\"", "\"", ")", "\n", "if", "len", "(", "parts", ")", "!=", "3", "{", "re...
// Parse takes a version string and returns a release structure.
[ "Parse", "takes", "a", "version", "string", "and", "returns", "a", "release", "structure", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/release/release.go#L131-L164
136,830
cloudflare/cfssl_trust
cli/root.go
cleanup
func cleanup(tx *sql.Tx, db *sql.DB, err error) { if tx != nil { if err != nil { err = tx.Rollback() if err != nil { fmt.Fprintf(os.Stderr, "[!] error while rolling back transaction: %s\n", err) os.Exit(1) } } else { err = tx.Commit() if err != nil { fmt.Fprintf(os.Stderr, "[!] error whi...
go
func cleanup(tx *sql.Tx, db *sql.DB, err error) { if tx != nil { if err != nil { err = tx.Rollback() if err != nil { fmt.Fprintf(os.Stderr, "[!] error while rolling back transaction: %s\n", err) os.Exit(1) } } else { err = tx.Commit() if err != nil { fmt.Fprintf(os.Stderr, "[!] error whi...
[ "func", "cleanup", "(", "tx", "*", "sql", ".", "Tx", ",", "db", "*", "sql", ".", "DB", ",", "err", "error", ")", "{", "if", "tx", "!=", "nil", "{", "if", "err", "!=", "nil", "{", "err", "=", "tx", ".", "Rollback", "(", ")", "\n", "if", "err...
// If err isn't nil, this should rollback the transaction. If err is // nil, it should commit the transaction. Finally, it should close the // database.
[ "If", "err", "isn", "t", "nil", "this", "should", "rollback", "the", "transaction", ".", "If", "err", "is", "nil", "it", "should", "commit", "the", "transaction", ".", "Finally", "it", "should", "close", "the", "database", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/cli/root.go#L54-L78
136,831
cloudflare/cfssl_trust
model/certdb/certificate.go
Finalize
func Finalize(err *error, tx *sql.Tx) { if *err == nil { *err = tx.Commit() if *err != nil { fmt.Fprintf(os.Stderr, "[!] failed to commit transaction: %s\n", *err) os.Exit(1) } } else { tx.Rollback() } }
go
func Finalize(err *error, tx *sql.Tx) { if *err == nil { *err = tx.Commit() if *err != nil { fmt.Fprintf(os.Stderr, "[!] failed to commit transaction: %s\n", *err) os.Exit(1) } } else { tx.Rollback() } }
[ "func", "Finalize", "(", "err", "*", "error", ",", "tx", "*", "sql", ".", "Tx", ")", "{", "if", "*", "err", "==", "nil", "{", "*", "err", "=", "tx", ".", "Commit", "(", ")", "\n", "if", "*", "err", "!=", "nil", "{", "fmt", ".", "Fprintf", "...
// Finalize finishes a transaction, committing it if needed or rolling // back on error.
[ "Finalize", "finishes", "a", "transaction", "committing", "it", "if", "needed", "or", "rolling", "back", "on", "error", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L20-L30
136,832
cloudflare/cfssl_trust
model/certdb/certificate.go
FindCertificateBySKI
func FindCertificateBySKI(db *sql.DB, ski string) ([]*Certificate, error) { tx, err := db.Begin() if err != nil { return nil, err } defer Finalize(&err, tx) var certificates []*Certificate rows, err := tx.Query(` SELECT aki, serial, not_before, not_after, raw FROM certificates WHERE ski=?`, ski) if err !=...
go
func FindCertificateBySKI(db *sql.DB, ski string) ([]*Certificate, error) { tx, err := db.Begin() if err != nil { return nil, err } defer Finalize(&err, tx) var certificates []*Certificate rows, err := tx.Query(` SELECT aki, serial, not_before, not_after, raw FROM certificates WHERE ski=?`, ski) if err !=...
[ "func", "FindCertificateBySKI", "(", "db", "*", "sql", ".", "DB", ",", "ski", "string", ")", "(", "[", "]", "*", "Certificate", ",", "error", ")", "{", "tx", ",", "err", ":=", "db", ".", "Begin", "(", ")", "\n", "if", "err", "!=", "nil", "{", "...
// FindCertificateBySKI returns all the certificates with the given // SKI.
[ "FindCertificateBySKI", "returns", "all", "the", "certificates", "with", "the", "given", "SKI", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L34-L71
136,833
cloudflare/cfssl_trust
model/certdb/certificate.go
AllCertificates
func AllCertificates(tx *sql.Tx) ([]*Certificate, error) { rows, err := tx.Query("SELECT * FROM certificates") if err != nil { return nil, err } var certificates []*Certificate for rows.Next() { cert := &Certificate{} err = rows.Scan(&cert.SKI, &cert.AKI, &cert.Serial, &cert.NotBefore, &cert.NotAfter, &c...
go
func AllCertificates(tx *sql.Tx) ([]*Certificate, error) { rows, err := tx.Query("SELECT * FROM certificates") if err != nil { return nil, err } var certificates []*Certificate for rows.Next() { cert := &Certificate{} err = rows.Scan(&cert.SKI, &cert.AKI, &cert.Serial, &cert.NotBefore, &cert.NotAfter, &c...
[ "func", "AllCertificates", "(", "tx", "*", "sql", ".", "Tx", ")", "(", "[", "]", "*", "Certificate", ",", "error", ")", "{", "rows", ",", "err", ":=", "tx", ".", "Query", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil...
// AllCertificates loads all the certificates in the database.
[ "AllCertificates", "loads", "all", "the", "certificates", "in", "the", "database", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L74-L98
136,834
cloudflare/cfssl_trust
model/certdb/certificate.go
Ensure
func Ensure(table Table, tx *sql.Tx) (bool, error) { var inserted bool err := table.Select(tx) if err == sql.ErrNoRows { err = table.Insert(tx) inserted = true } return inserted, err }
go
func Ensure(table Table, tx *sql.Tx) (bool, error) { var inserted bool err := table.Select(tx) if err == sql.ErrNoRows { err = table.Insert(tx) inserted = true } return inserted, err }
[ "func", "Ensure", "(", "table", "Table", ",", "tx", "*", "sql", ".", "Tx", ")", "(", "bool", ",", "error", ")", "{", "var", "inserted", "bool", "\n", "err", ":=", "table", ".", "Select", "(", "tx", ")", "\n", "if", "err", "==", "sql", ".", "Err...
// Ensure ensures the value is present in the database. It calls // Select, and if no rows are returned, it calls Insert. The boolean // will be true if the value was inserted. This value is meaningless // if err is non-nil.
[ "Ensure", "ensures", "the", "value", "is", "present", "in", "the", "database", ".", "It", "calls", "Select", "and", "if", "no", "rows", "are", "returned", "it", "calls", "Insert", ".", "The", "boolean", "will", "be", "true", "if", "the", "value", "was", ...
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L125-L133
136,835
cloudflare/cfssl_trust
model/certdb/certificate.go
Insert
func (cert *Certificate) Insert(tx *sql.Tx) error { _, err := tx.Exec(`INSERT INTO certificates (ski, aki, serial, not_before, not_after, raw) values (?, ?, ?, ?, ?, ?)`, cert.SKI, cert.AKI, cert.Serial, cert.NotBefore, cert.NotAfter, cert.Raw) return err }
go
func (cert *Certificate) Insert(tx *sql.Tx) error { _, err := tx.Exec(`INSERT INTO certificates (ski, aki, serial, not_before, not_after, raw) values (?, ?, ?, ?, ?, ?)`, cert.SKI, cert.AKI, cert.Serial, cert.NotBefore, cert.NotAfter, cert.Raw) return err }
[ "func", "(", "cert", "*", "Certificate", ")", "Insert", "(", "tx", "*", "sql", ".", "Tx", ")", "error", "{", "_", ",", "err", ":=", "tx", ".", "Exec", "(", "`INSERT INTO certificates (ski, aki, serial, not_before, not_after, raw) values (?, ?, ?, ?, ?, ?)`", ",", ...
// Insert stores the Certificate in the database.
[ "Insert", "stores", "the", "Certificate", "in", "the", "database", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L147-L150
136,836
cloudflare/cfssl_trust
model/certdb/certificate.go
Select
func (cert *Certificate) Select(tx *sql.Tx) error { row := tx.QueryRow(`SELECT aki, not_before, not_after, raw FROM certificates WHERE ski=? and serial=?`, cert.SKI, cert.Serial) err := row.Scan(&cert.AKI, &cert.NotBefore, &cert.NotAfter, &cert.Raw) if err != nil { return err } cert.cert, err = x509.ParseCertif...
go
func (cert *Certificate) Select(tx *sql.Tx) error { row := tx.QueryRow(`SELECT aki, not_before, not_after, raw FROM certificates WHERE ski=? and serial=?`, cert.SKI, cert.Serial) err := row.Scan(&cert.AKI, &cert.NotBefore, &cert.NotAfter, &cert.Raw) if err != nil { return err } cert.cert, err = x509.ParseCertif...
[ "func", "(", "cert", "*", "Certificate", ")", "Select", "(", "tx", "*", "sql", ".", "Tx", ")", "error", "{", "row", ":=", "tx", ".", "QueryRow", "(", "`SELECT aki, not_before, not_after, raw FROM certificates WHERE ski=? and serial=?`", ",", "cert", ".", "SKI", ...
// Select requires the SKI and Serial fields to be filled in.
[ "Select", "requires", "the", "SKI", "and", "Serial", "fields", "to", "be", "filled", "in", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L153-L162
136,837
cloudflare/cfssl_trust
model/certdb/certificate.go
Releases
func (cert *Certificate) Releases(tx *sql.Tx) ([]*Release, error) { var releases []*Release rows, err := tx.Query("SELECT release FROM roots WHERE ski=? AND serial=?", cert.SKI, cert.Serial) if err != nil { return nil, err } for rows.Next() { rel := &Release{ Bundle: "ca", } err = rows.Scan(&rel.Vers...
go
func (cert *Certificate) Releases(tx *sql.Tx) ([]*Release, error) { var releases []*Release rows, err := tx.Query("SELECT release FROM roots WHERE ski=? AND serial=?", cert.SKI, cert.Serial) if err != nil { return nil, err } for rows.Next() { rel := &Release{ Bundle: "ca", } err = rows.Scan(&rel.Vers...
[ "func", "(", "cert", "*", "Certificate", ")", "Releases", "(", "tx", "*", "sql", ".", "Tx", ")", "(", "[", "]", "*", "Release", ",", "error", ")", "{", "var", "releases", "[", "]", "*", "Release", "\n\n", "rows", ",", "err", ":=", "tx", ".", "Q...
// Releases looks up all the releases for a certificate.
[ "Releases", "looks", "up", "all", "the", "releases", "for", "a", "certificate", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L165-L213
136,838
cloudflare/cfssl_trust
model/certdb/certificate.go
Revoked
func (cert *Certificate) Revoked(tx *sql.Tx, when int64) (bool, error) { if err := cert.Select(tx); err != nil { return true, err } var count int row := tx.QueryRow(`SELECT count(*) FROM revocations WHERE ski=? AND revoked_at <= ?`, cert.SKI, when) err := row.Scan(&count) if err != nil { return true, err } ...
go
func (cert *Certificate) Revoked(tx *sql.Tx, when int64) (bool, error) { if err := cert.Select(tx); err != nil { return true, err } var count int row := tx.QueryRow(`SELECT count(*) FROM revocations WHERE ski=? AND revoked_at <= ?`, cert.SKI, when) err := row.Scan(&count) if err != nil { return true, err } ...
[ "func", "(", "cert", "*", "Certificate", ")", "Revoked", "(", "tx", "*", "sql", ".", "Tx", ",", "when", "int64", ")", "(", "bool", ",", "error", ")", "{", "if", "err", ":=", "cert", ".", "Select", "(", "tx", ")", ";", "err", "!=", "nil", "{", ...
// Revoked returns true if the certificate was revoked before the // timestamp passed in.
[ "Revoked", "returns", "true", "if", "the", "certificate", "was", "revoked", "before", "the", "timestamp", "passed", "in", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L217-L230
136,839
cloudflare/cfssl_trust
model/certdb/certificate.go
Revoke
func (cert *Certificate) Revoke(tx *sql.Tx, mechanism, reason string, when int64) error { if err := cert.Select(tx); err != nil { return err } rev := &Revocation{ SKI: cert.SKI, RevokedAt: when, Mechanism: mechanism, Reason: reason, } // We ignore the inserted value because if it returns false...
go
func (cert *Certificate) Revoke(tx *sql.Tx, mechanism, reason string, when int64) error { if err := cert.Select(tx); err != nil { return err } rev := &Revocation{ SKI: cert.SKI, RevokedAt: when, Mechanism: mechanism, Reason: reason, } // We ignore the inserted value because if it returns false...
[ "func", "(", "cert", "*", "Certificate", ")", "Revoke", "(", "tx", "*", "sql", ".", "Tx", ",", "mechanism", ",", "reason", "string", ",", "when", "int64", ")", "error", "{", "if", "err", ":=", "cert", ".", "Select", "(", "tx", ")", ";", "err", "!...
// Revoke marks the certificate as revoked.
[ "Revoke", "marks", "the", "certificate", "as", "revoked", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L233-L249
136,840
cloudflare/cfssl_trust
model/certdb/certificate.go
Insert
func (aia *AIA) Insert(tx *sql.Tx) error { _, err := tx.Exec(`INSERT INTO aia (ski, url) values (?, ?)`, aia.SKI, aia.URL) return err }
go
func (aia *AIA) Insert(tx *sql.Tx) error { _, err := tx.Exec(`INSERT INTO aia (ski, url) values (?, ?)`, aia.SKI, aia.URL) return err }
[ "func", "(", "aia", "*", "AIA", ")", "Insert", "(", "tx", "*", "sql", ".", "Tx", ")", "error", "{", "_", ",", "err", ":=", "tx", ".", "Exec", "(", "`INSERT INTO aia (ski, url) values (?, ?)`", ",", "aia", ".", "SKI", ",", "aia", ".", "URL", ")", "\...
// Insert stores the release in the database.
[ "Insert", "stores", "the", "release", "in", "the", "database", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L299-L302
136,841
cloudflare/cfssl_trust
model/certdb/certificate.go
Select
func (aia *AIA) Select(tx *sql.Tx) error { row := tx.QueryRow(`SELECT url FROM aia WHERE ski=?`, aia.SKI) err := row.Scan(&aia.URL) if err != nil { return err } return nil }
go
func (aia *AIA) Select(tx *sql.Tx) error { row := tx.QueryRow(`SELECT url FROM aia WHERE ski=?`, aia.SKI) err := row.Scan(&aia.URL) if err != nil { return err } return nil }
[ "func", "(", "aia", "*", "AIA", ")", "Select", "(", "tx", "*", "sql", ".", "Tx", ")", "error", "{", "row", ":=", "tx", ".", "QueryRow", "(", "`SELECT url FROM aia WHERE ski=?`", ",", "aia", ".", "SKI", ")", "\n", "err", ":=", "row", ".", "Scan", "(...
// Select requires the SKI field to be filled in.
[ "Select", "requires", "the", "SKI", "field", "to", "be", "filled", "in", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L305-L313
136,842
cloudflare/cfssl_trust
model/certdb/certificate.go
NewAIA
func NewAIA(cert *Certificate) *AIA { if len(cert.cert.IssuingCertificateURL) == 0 { return nil } // Arbitrary choice: store the first HTTP URL. We can always // look up the other URLs later and replace this one if // need be. return &AIA{ SKI: cert.AKI, URL: cert.cert.IssuingCertificateURL[0], } }
go
func NewAIA(cert *Certificate) *AIA { if len(cert.cert.IssuingCertificateURL) == 0 { return nil } // Arbitrary choice: store the first HTTP URL. We can always // look up the other URLs later and replace this one if // need be. return &AIA{ SKI: cert.AKI, URL: cert.cert.IssuingCertificateURL[0], } }
[ "func", "NewAIA", "(", "cert", "*", "Certificate", ")", "*", "AIA", "{", "if", "len", "(", "cert", ".", "cert", ".", "IssuingCertificateURL", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "// Arbitrary choice: store the first HTTP URL. We can always",...
// NewAIA populates an AIA structure from a Certificate.
[ "NewAIA", "populates", "an", "AIA", "structure", "from", "a", "Certificate", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L316-L328
136,843
cloudflare/cfssl_trust
model/certdb/certificate.go
NewRelease
func NewRelease(bundle, version string) (*Release, error) { r := &Release{ Bundle: bundle, Version: version, ReleasedAt: time.Now().Unix(), } if !r.validBundle() { return nil, r.errInvalidBundle() } return r, nil }
go
func NewRelease(bundle, version string) (*Release, error) { r := &Release{ Bundle: bundle, Version: version, ReleasedAt: time.Now().Unix(), } if !r.validBundle() { return nil, r.errInvalidBundle() } return r, nil }
[ "func", "NewRelease", "(", "bundle", ",", "version", "string", ")", "(", "*", "Release", ",", "error", ")", "{", "r", ":=", "&", "Release", "{", "Bundle", ":", "bundle", ",", "Version", ":", "version", ",", "ReleasedAt", ":", "time", ".", "Now", "(",...
// NewRelease verifies the bundle is valid, and creates a new Release // with the current time stamp.
[ "NewRelease", "verifies", "the", "bundle", "is", "valid", "and", "creates", "a", "new", "Release", "with", "the", "current", "time", "stamp", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L374-L386
136,844
cloudflare/cfssl_trust
model/certdb/certificate.go
Insert
func (r *Release) Insert(tx *sql.Tx) error { if !r.validBundle() { return r.errInvalidBundle() } query := fmt.Sprintf("INSERT INTO %s_releases (version, released_at) VALUES (?, ?)", r.table()) _, err := tx.Exec(query, r.Version, r.ReleasedAt) return err }
go
func (r *Release) Insert(tx *sql.Tx) error { if !r.validBundle() { return r.errInvalidBundle() } query := fmt.Sprintf("INSERT INTO %s_releases (version, released_at) VALUES (?, ?)", r.table()) _, err := tx.Exec(query, r.Version, r.ReleasedAt) return err }
[ "func", "(", "r", "*", "Release", ")", "Insert", "(", "tx", "*", "sql", ".", "Tx", ")", "error", "{", "if", "!", "r", ".", "validBundle", "(", ")", "{", "return", "r", ".", "errInvalidBundle", "(", ")", "\n", "}", "\n\n", "query", ":=", "fmt", ...
// Insert stores the Release in the database.
[ "Insert", "stores", "the", "Release", "in", "the", "database", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L389-L398
136,845
cloudflare/cfssl_trust
model/certdb/certificate.go
Select
func (r *Release) Select(tx *sql.Tx) error { if !r.validBundle() { return r.errInvalidBundle() } query := fmt.Sprintf("SELECT released_at FROM %s_releases WHERE version=?", r.table()) row := tx.QueryRow(query, r.Version) return row.Scan(&r.ReleasedAt) }
go
func (r *Release) Select(tx *sql.Tx) error { if !r.validBundle() { return r.errInvalidBundle() } query := fmt.Sprintf("SELECT released_at FROM %s_releases WHERE version=?", r.table()) row := tx.QueryRow(query, r.Version) return row.Scan(&r.ReleasedAt) }
[ "func", "(", "r", "*", "Release", ")", "Select", "(", "tx", "*", "sql", ".", "Tx", ")", "error", "{", "if", "!", "r", ".", "validBundle", "(", ")", "{", "return", "r", ".", "errInvalidBundle", "(", ")", "\n", "}", "\n\n", "query", ":=", "fmt", ...
// Select requires the Version field to have been populated.
[ "Select", "requires", "the", "Version", "field", "to", "have", "been", "populated", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L401-L409
136,846
cloudflare/cfssl_trust
model/certdb/certificate.go
Count
func (r *Release) Count(db *sql.DB) (int, error) { tx, err := db.Begin() if err != nil { return 0, err } defer tx.Rollback() err = r.Select(tx) if err != nil { if err == sql.ErrNoRows { err = errors.New("model/certdb: release doesn't exist") } return 0, err } var count int q := fmt.Sprintf("SELECT...
go
func (r *Release) Count(db *sql.DB) (int, error) { tx, err := db.Begin() if err != nil { return 0, err } defer tx.Rollback() err = r.Select(tx) if err != nil { if err == sql.ErrNoRows { err = errors.New("model/certdb: release doesn't exist") } return 0, err } var count int q := fmt.Sprintf("SELECT...
[ "func", "(", "r", "*", "Release", ")", "Count", "(", "db", "*", "sql", ".", "DB", ")", "(", "int", ",", "error", ")", "{", "tx", ",", "err", ":=", "db", ".", "Begin", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err",...
// Count requires the Release to be Selectable, and will return the // number of certificates in the release.
[ "Count", "requires", "the", "Release", "to", "be", "Selectable", "and", "will", "return", "the", "number", "of", "certificates", "in", "the", "release", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L413-L436
136,847
cloudflare/cfssl_trust
model/certdb/certificate.go
Previous
func (r *Release) Previous(db *sql.DB) (*Release, error) { tx, err := db.Begin() if err != nil { return nil, err } defer tx.Rollback() var prev = &Release{Bundle: r.Bundle} query := fmt.Sprintf(`SELECT version, released_at FROM %s_releases WHERE released_at < ? ORDER BY released_at DESC LIMIT 1`, r.table()) r...
go
func (r *Release) Previous(db *sql.DB) (*Release, error) { tx, err := db.Begin() if err != nil { return nil, err } defer tx.Rollback() var prev = &Release{Bundle: r.Bundle} query := fmt.Sprintf(`SELECT version, released_at FROM %s_releases WHERE released_at < ? ORDER BY released_at DESC LIMIT 1`, r.table()) r...
[ "func", "(", "r", "*", "Release", ")", "Previous", "(", "db", "*", "sql", ".", "DB", ")", "(", "*", "Release", ",", "error", ")", "{", "tx", ",", "err", ":=", "db", ".", "Begin", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil",...
// Previous returns the previous release. The Release must fully filled out.
[ "Previous", "returns", "the", "previous", "release", ".", "The", "Release", "must", "fully", "filled", "out", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L439-L454
136,848
cloudflare/cfssl_trust
model/certdb/certificate.go
AllReleases
func AllReleases(db *sql.DB, bundle string) ([]*Release, error) { if !validBundle(bundle) { return nil, errors.New("model/certdb: invalid bundle " + bundle) } tx, err := db.Begin() if err != nil { return nil, err } defer tx.Rollback() // nop if commit is called. tbl := tableForBundle(bundle) var releases ...
go
func AllReleases(db *sql.DB, bundle string) ([]*Release, error) { if !validBundle(bundle) { return nil, errors.New("model/certdb: invalid bundle " + bundle) } tx, err := db.Begin() if err != nil { return nil, err } defer tx.Rollback() // nop if commit is called. tbl := tableForBundle(bundle) var releases ...
[ "func", "AllReleases", "(", "db", "*", "sql", ".", "DB", ",", "bundle", "string", ")", "(", "[", "]", "*", "Release", ",", "error", ")", "{", "if", "!", "validBundle", "(", "bundle", ")", "{", "return", "nil", ",", "errors", ".", "New", "(", "\""...
// AllReleases returns the list of all releases, sorted in reverse chronological // order.
[ "AllReleases", "returns", "the", "list", "of", "all", "releases", "sorted", "in", "reverse", "chronological", "order", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L458-L491
136,849
cloudflare/cfssl_trust
model/certdb/certificate.go
FetchRelease
func FetchRelease(db *sql.DB, bundle, version string) (*Release, error) { rel, err := NewRelease(bundle, version) if err != nil { return nil, err } tx, err := db.Begin() if err != nil { return nil, err } defer tx.Rollback() // nop if commit is called. err = rel.Select(tx) if err != nil { return nil, er...
go
func FetchRelease(db *sql.DB, bundle, version string) (*Release, error) { rel, err := NewRelease(bundle, version) if err != nil { return nil, err } tx, err := db.Begin() if err != nil { return nil, err } defer tx.Rollback() // nop if commit is called. err = rel.Select(tx) if err != nil { return nil, er...
[ "func", "FetchRelease", "(", "db", "*", "sql", ".", "DB", ",", "bundle", ",", "version", "string", ")", "(", "*", "Release", ",", "error", ")", "{", "rel", ",", "err", ":=", "NewRelease", "(", "bundle", ",", "version", ")", "\n", "if", "err", "!=",...
// FetchRelease looks for the specified release. It does its own // transaction to match the style of the other release fetching // functions.
[ "FetchRelease", "looks", "for", "the", "specified", "release", ".", "It", "does", "its", "own", "transaction", "to", "match", "the", "style", "of", "the", "other", "release", "fetching", "functions", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L521-L544
136,850
cloudflare/cfssl_trust
model/certdb/certificate.go
NewCertificateRelease
func NewCertificateRelease(c *Certificate, r *Release) *CertificateRelease { return &CertificateRelease{ Certificate: c, Release: r, } }
go
func NewCertificateRelease(c *Certificate, r *Release) *CertificateRelease { return &CertificateRelease{ Certificate: c, Release: r, } }
[ "func", "NewCertificateRelease", "(", "c", "*", "Certificate", ",", "r", "*", "Release", ")", "*", "CertificateRelease", "{", "return", "&", "CertificateRelease", "{", "Certificate", ":", "c", ",", "Release", ":", "r", ",", "}", "\n", "}" ]
// NewCertificateRelease is a convenience function for building a // CertificateRelease structure.
[ "NewCertificateRelease", "is", "a", "convenience", "function", "for", "building", "a", "CertificateRelease", "structure", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L555-L560
136,851
cloudflare/cfssl_trust
model/certdb/certificate.go
Select
func (cr *CertificateRelease) Select(tx *sql.Tx) error { var count int query := fmt.Sprintf("SELECT count(*) FROM %ss WHERE ski=? AND serial=? AND release=?", cr.Release.table()) row := tx.QueryRow(query, cr.Certificate.SKI, cr.Certificate.Serial, cr.Release.Version) err := row.Scan(&count) if err == nil && count ...
go
func (cr *CertificateRelease) Select(tx *sql.Tx) error { var count int query := fmt.Sprintf("SELECT count(*) FROM %ss WHERE ski=? AND serial=? AND release=?", cr.Release.table()) row := tx.QueryRow(query, cr.Certificate.SKI, cr.Certificate.Serial, cr.Release.Version) err := row.Scan(&count) if err == nil && count ...
[ "func", "(", "cr", "*", "CertificateRelease", ")", "Select", "(", "tx", "*", "sql", ".", "Tx", ")", "error", "{", "var", "count", "int", "\n", "query", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "cr", ".", "Release", ".", "table", "(", ")...
// Select requires the Certificate field to have the SKI and Serial // filled in, and the Release field to have the Version field filled // in.
[ "Select", "requires", "the", "Certificate", "field", "to", "have", "the", "SKI", "and", "Serial", "filled", "in", "and", "the", "Release", "field", "to", "have", "the", "Version", "field", "filled", "in", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L575-L584
136,852
cloudflare/cfssl_trust
model/certdb/certificate.go
Select
func (rev *Revocation) Select(tx *sql.Tx) error { row := tx.QueryRow(`SELECT revoked_at, mechanism, reason FROM revocations WHERE ski=?`, rev.SKI) err := row.Scan(&rev.RevokedAt, &rev.Mechanism, &rev.Reason) if err != nil { return err } return nil }
go
func (rev *Revocation) Select(tx *sql.Tx) error { row := tx.QueryRow(`SELECT revoked_at, mechanism, reason FROM revocations WHERE ski=?`, rev.SKI) err := row.Scan(&rev.RevokedAt, &rev.Mechanism, &rev.Reason) if err != nil { return err } return nil }
[ "func", "(", "rev", "*", "Revocation", ")", "Select", "(", "tx", "*", "sql", ".", "Tx", ")", "error", "{", "row", ":=", "tx", ".", "QueryRow", "(", "`SELECT revoked_at, mechanism, reason FROM revocations WHERE ski=?`", ",", "rev", ".", "SKI", ")", "\n", "err...
// Select requires the SKI field to be filled in. Note that only one // revocation per SKI should exist.
[ "Select", "requires", "the", "SKI", "field", "to", "be", "filled", "in", ".", "Note", "that", "only", "one", "revocation", "per", "SKI", "should", "exist", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L596-L604
136,853
cloudflare/cfssl_trust
model/certdb/certificate.go
Insert
func (rev *Revocation) Insert(tx *sql.Tx) error { _, err := tx.Exec(`INSERT INTO revocations (ski, revoked_at, mechanism, reason) VALUES (?, ?, ?, ?)`, rev.SKI, rev.RevokedAt, rev.Mechanism, rev.Reason) return err }
go
func (rev *Revocation) Insert(tx *sql.Tx) error { _, err := tx.Exec(`INSERT INTO revocations (ski, revoked_at, mechanism, reason) VALUES (?, ?, ?, ?)`, rev.SKI, rev.RevokedAt, rev.Mechanism, rev.Reason) return err }
[ "func", "(", "rev", "*", "Revocation", ")", "Insert", "(", "tx", "*", "sql", ".", "Tx", ")", "error", "{", "_", ",", "err", ":=", "tx", ".", "Exec", "(", "`INSERT INTO revocations (ski, revoked_at, mechanism, reason) VALUES (?, ?, ?, ?)`", ",", "rev", ".", "SK...
// Insert adds the revocation to the database if no revocation exists // yet.
[ "Insert", "adds", "the", "revocation", "to", "the", "database", "if", "no", "revocation", "exists", "yet", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/model/certdb/certificate.go#L608-L611
136,854
cloudflare/cfssl_trust
config/config.go
GoPath
func GoPath() string { if path := os.Getenv("GOPATH"); path != "" { return path } // https://github.com/golang/go/issues/17262 return filepath.Join(os.Getenv("HOME"), "go") }
go
func GoPath() string { if path := os.Getenv("GOPATH"); path != "" { return path } // https://github.com/golang/go/issues/17262 return filepath.Join(os.Getenv("HOME"), "go") }
[ "func", "GoPath", "(", ")", "string", "{", "if", "path", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", ";", "path", "!=", "\"", "\"", "{", "return", "path", "\n", "}", "\n", "// https://github.com/golang/go/issues/17262", "return", "filepath", ".", "J...
// GoPath returns the current GOPATH.
[ "GoPath", "returns", "the", "current", "GOPATH", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/config/config.go#L11-L17
136,855
cloudflare/cfssl_trust
info/search.go
filterCertificates
func filterCertificates(certs []*CertificateMetadata, filters []CertificateFilter) []*CertificateMetadata { filtered := certs for _, f := range filters { filtered = filter(filtered, f) } return filtered }
go
func filterCertificates(certs []*CertificateMetadata, filters []CertificateFilter) []*CertificateMetadata { filtered := certs for _, f := range filters { filtered = filter(filtered, f) } return filtered }
[ "func", "filterCertificates", "(", "certs", "[", "]", "*", "CertificateMetadata", ",", "filters", "[", "]", "CertificateFilter", ")", "[", "]", "*", "CertificateMetadata", "{", "filtered", ":=", "certs", "\n", "for", "_", ",", "f", ":=", "range", "filters", ...
// filterCertificates applies the filters to the list of certificates, // returning only those certificates that match all the filters.
[ "filterCertificates", "applies", "the", "filters", "to", "the", "list", "of", "certificates", "returning", "only", "those", "certificates", "that", "match", "all", "the", "filters", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/info/search.go#L28-L34
136,856
cloudflare/cfssl_trust
info/search.go
FilterBySKI
func FilterBySKI(ski string) (CertificateFilter, error) { skiFilter, err := regexp.Compile(ski) if err != nil { return nil, err } return func(cm *CertificateMetadata) bool { return skiFilter.MatchString(cm.SKI) }, nil }
go
func FilterBySKI(ski string) (CertificateFilter, error) { skiFilter, err := regexp.Compile(ski) if err != nil { return nil, err } return func(cm *CertificateMetadata) bool { return skiFilter.MatchString(cm.SKI) }, nil }
[ "func", "FilterBySKI", "(", "ski", "string", ")", "(", "CertificateFilter", ",", "error", ")", "{", "skiFilter", ",", "err", ":=", "regexp", ".", "Compile", "(", "ski", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}",...
// FilterBySKI is a CertificateFilter that returns true if the SKI in // a certificate matches the regular expression passed in.
[ "FilterBySKI", "is", "a", "CertificateFilter", "that", "returns", "true", "if", "the", "SKI", "in", "a", "certificate", "matches", "the", "regular", "expression", "passed", "in", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/info/search.go#L38-L47
136,857
cloudflare/cfssl_trust
info/search.go
FilterByAKI
func FilterByAKI(aki string) (CertificateFilter, error) { akiFilter, err := regexp.Compile(aki) if err != nil { return nil, err } return func(cm *CertificateMetadata) bool { return akiFilter.MatchString(cm.AKI) }, nil }
go
func FilterByAKI(aki string) (CertificateFilter, error) { akiFilter, err := regexp.Compile(aki) if err != nil { return nil, err } return func(cm *CertificateMetadata) bool { return akiFilter.MatchString(cm.AKI) }, nil }
[ "func", "FilterByAKI", "(", "aki", "string", ")", "(", "CertificateFilter", ",", "error", ")", "{", "akiFilter", ",", "err", ":=", "regexp", ".", "Compile", "(", "aki", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}",...
// FilterByAKI is a CertificateFilter that returns true if the AKI in // a certificate matches the regular expression passed in.
[ "FilterByAKI", "is", "a", "CertificateFilter", "that", "returns", "true", "if", "the", "AKI", "in", "a", "certificate", "matches", "the", "regular", "expression", "passed", "in", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/info/search.go#L51-L60
136,858
cloudflare/cfssl_trust
info/search.go
FilterBySubject
func FilterBySubject(subj string) (CertificateFilter, error) { subjFilter, err := regexp.Compile(subj) if err != nil { return nil, err } return func(cm *CertificateMetadata) bool { return subjFilter.MatchString(cm.Subject) }, nil }
go
func FilterBySubject(subj string) (CertificateFilter, error) { subjFilter, err := regexp.Compile(subj) if err != nil { return nil, err } return func(cm *CertificateMetadata) bool { return subjFilter.MatchString(cm.Subject) }, nil }
[ "func", "FilterBySubject", "(", "subj", "string", ")", "(", "CertificateFilter", ",", "error", ")", "{", "subjFilter", ",", "err", ":=", "regexp", ".", "Compile", "(", "subj", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n",...
// FilterBySubject is a CertificateFilter that returns true if the // Subject in a certificate matches the regular expression passed in.
[ "FilterBySubject", "is", "a", "CertificateFilter", "that", "returns", "true", "if", "the", "Subject", "in", "a", "certificate", "matches", "the", "regular", "expression", "passed", "in", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/info/search.go#L64-L73
136,859
cloudflare/cfssl_trust
info/search.go
FilterByIssuer
func FilterByIssuer(iss string) (CertificateFilter, error) { issFilter, err := regexp.Compile(iss) if err != nil { return nil, err } return func(cm *CertificateMetadata) bool { return issFilter.MatchString(cm.Issuer) }, nil }
go
func FilterByIssuer(iss string) (CertificateFilter, error) { issFilter, err := regexp.Compile(iss) if err != nil { return nil, err } return func(cm *CertificateMetadata) bool { return issFilter.MatchString(cm.Issuer) }, nil }
[ "func", "FilterByIssuer", "(", "iss", "string", ")", "(", "CertificateFilter", ",", "error", ")", "{", "issFilter", ",", "err", ":=", "regexp", ".", "Compile", "(", "iss", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "...
// FilterByIssuer is a CertificateFilter that returns true if the // Issuer in a certificate matches the regular expression passed in.
[ "FilterByIssuer", "is", "a", "CertificateFilter", "that", "returns", "true", "if", "the", "Issuer", "in", "a", "certificate", "matches", "the", "regular", "expression", "passed", "in", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/info/search.go#L77-L86
136,860
cloudflare/cfssl_trust
info/search.go
FilterByRelease
func FilterByRelease(version string) (CertificateFilter, error) { verFilter, err := regexp.Compile(version) if err != nil { return nil, err } return func(cm *CertificateMetadata) bool { for _, rel := range cm.Releases { if verFilter.MatchString(rel.Version) { return true } } return false }, nil ...
go
func FilterByRelease(version string) (CertificateFilter, error) { verFilter, err := regexp.Compile(version) if err != nil { return nil, err } return func(cm *CertificateMetadata) bool { for _, rel := range cm.Releases { if verFilter.MatchString(rel.Version) { return true } } return false }, nil ...
[ "func", "FilterByRelease", "(", "version", "string", ")", "(", "CertificateFilter", ",", "error", ")", "{", "verFilter", ",", "err", ":=", "regexp", ".", "Compile", "(", "version", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", ...
// FilterByRelease is a CertificateFilter that returns true if the // release version matches the regular expression passed in.
[ "FilterByRelease", "is", "a", "CertificateFilter", "that", "returns", "true", "if", "the", "release", "version", "matches", "the", "regular", "expression", "passed", "in", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/info/search.go#L90-L104
136,861
cloudflare/cfssl_trust
info/search.go
FilterByBundle
func FilterByBundle(bundle string) (CertificateFilter, error) { bundleFilter, err := regexp.Compile(bundle) if err != nil { return nil, err } return func(cm *CertificateMetadata) bool { for _, rel := range cm.Releases { if bundleFilter.MatchString(rel.Bundle) { return true } } return false }, ni...
go
func FilterByBundle(bundle string) (CertificateFilter, error) { bundleFilter, err := regexp.Compile(bundle) if err != nil { return nil, err } return func(cm *CertificateMetadata) bool { for _, rel := range cm.Releases { if bundleFilter.MatchString(rel.Bundle) { return true } } return false }, ni...
[ "func", "FilterByBundle", "(", "bundle", "string", ")", "(", "CertificateFilter", ",", "error", ")", "{", "bundleFilter", ",", "err", ":=", "regexp", ".", "Compile", "(", "bundle", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", ...
// FilterByBundle is a CertificateFilter that returns true if the // release bundle matches the regular expression passed in.
[ "FilterByBundle", "is", "a", "CertificateFilter", "that", "returns", "true", "if", "the", "release", "bundle", "matches", "the", "regular", "expression", "passed", "in", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/info/search.go#L108-L122
136,862
cloudflare/cfssl_trust
info/search.go
Query
func Query(db *sql.DB, terms []string) ([]*CertificateMetadata, error) { tx, err := db.Begin() if err != nil { return nil, err } defer tx.Rollback() certs, err := certdb.AllCertificates(tx) if err != nil { return nil, err } results := make([]*CertificateMetadata, len(certs)) for i := range certs { resu...
go
func Query(db *sql.DB, terms []string) ([]*CertificateMetadata, error) { tx, err := db.Begin() if err != nil { return nil, err } defer tx.Rollback() certs, err := certdb.AllCertificates(tx) if err != nil { return nil, err } results := make([]*CertificateMetadata, len(certs)) for i := range certs { resu...
[ "func", "Query", "(", "db", "*", "sql", ".", "DB", ",", "terms", "[", "]", "string", ")", "(", "[", "]", "*", "CertificateMetadata", ",", "error", ")", "{", "tx", ",", "err", ":=", "db", ".", "Begin", "(", ")", "\n", "if", "err", "!=", "nil", ...
// Query searches the database for all certificates matching the search terms.
[ "Query", "searches", "the", "database", "for", "all", "certificates", "matching", "the", "search", "terms", "." ]
d6196c3eaf941c8269bf4f41882426440401299b
https://github.com/cloudflare/cfssl_trust/blob/d6196c3eaf941c8269bf4f41882426440401299b/info/search.go#L152-L184
136,863
paulbellamy/ratecounter
counter.go
Incr
func (c *Counter) Incr(val int64) { atomic.AddInt64((*int64)(c), val) }
go
func (c *Counter) Incr(val int64) { atomic.AddInt64((*int64)(c), val) }
[ "func", "(", "c", "*", "Counter", ")", "Incr", "(", "val", "int64", ")", "{", "atomic", ".", "AddInt64", "(", "(", "*", "int64", ")", "(", "c", ")", ",", "val", ")", "\n", "}" ]
// Incr method increments the counter by some value
[ "Incr", "method", "increments", "the", "counter", "by", "some", "value" ]
a803f0e4f07116687bb30965e8f7d0c32981b63c
https://github.com/paulbellamy/ratecounter/blob/a803f0e4f07116687bb30965e8f7d0c32981b63c/counter.go#L9-L11
136,864
paulbellamy/ratecounter
avgratecounter.go
NewAvgRateCounter
func NewAvgRateCounter(intrvl time.Duration) *AvgRateCounter { return &AvgRateCounter{ hits: NewRateCounter(intrvl), counter: NewRateCounter(intrvl), interval: intrvl, } }
go
func NewAvgRateCounter(intrvl time.Duration) *AvgRateCounter { return &AvgRateCounter{ hits: NewRateCounter(intrvl), counter: NewRateCounter(intrvl), interval: intrvl, } }
[ "func", "NewAvgRateCounter", "(", "intrvl", "time", ".", "Duration", ")", "*", "AvgRateCounter", "{", "return", "&", "AvgRateCounter", "{", "hits", ":", "NewRateCounter", "(", "intrvl", ")", ",", "counter", ":", "NewRateCounter", "(", "intrvl", ")", ",", "in...
// NewAvgRateCounter constructs a new AvgRateCounter, for the interval provided
[ "NewAvgRateCounter", "constructs", "a", "new", "AvgRateCounter", "for", "the", "interval", "provided" ]
a803f0e4f07116687bb30965e8f7d0c32981b63c
https://github.com/paulbellamy/ratecounter/blob/a803f0e4f07116687bb30965e8f7d0c32981b63c/avgratecounter.go#L17-L23
136,865
paulbellamy/ratecounter
avgratecounter.go
WithResolution
func (a *AvgRateCounter) WithResolution(resolution int) *AvgRateCounter { if resolution < 1 { panic("AvgRateCounter resolution cannot be less than 1") } a.hits = a.hits.WithResolution(resolution) a.counter = a.counter.WithResolution(resolution) return a }
go
func (a *AvgRateCounter) WithResolution(resolution int) *AvgRateCounter { if resolution < 1 { panic("AvgRateCounter resolution cannot be less than 1") } a.hits = a.hits.WithResolution(resolution) a.counter = a.counter.WithResolution(resolution) return a }
[ "func", "(", "a", "*", "AvgRateCounter", ")", "WithResolution", "(", "resolution", "int", ")", "*", "AvgRateCounter", "{", "if", "resolution", "<", "1", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "a", ".", "hits", "=", "a", ".", "hits", ...
// WithResolution determines the minimum resolution of this counter
[ "WithResolution", "determines", "the", "minimum", "resolution", "of", "this", "counter" ]
a803f0e4f07116687bb30965e8f7d0c32981b63c
https://github.com/paulbellamy/ratecounter/blob/a803f0e4f07116687bb30965e8f7d0c32981b63c/avgratecounter.go#L26-L35
136,866
paulbellamy/ratecounter
avgratecounter.go
Incr
func (a *AvgRateCounter) Incr(val int64) { a.hits.Incr(1) a.counter.Incr(val) }
go
func (a *AvgRateCounter) Incr(val int64) { a.hits.Incr(1) a.counter.Incr(val) }
[ "func", "(", "a", "*", "AvgRateCounter", ")", "Incr", "(", "val", "int64", ")", "{", "a", ".", "hits", ".", "Incr", "(", "1", ")", "\n", "a", ".", "counter", ".", "Incr", "(", "val", ")", "\n", "}" ]
// Incr Adds an event into the AvgRateCounter
[ "Incr", "Adds", "an", "event", "into", "the", "AvgRateCounter" ]
a803f0e4f07116687bb30965e8f7d0c32981b63c
https://github.com/paulbellamy/ratecounter/blob/a803f0e4f07116687bb30965e8f7d0c32981b63c/avgratecounter.go#L38-L41
136,867
paulbellamy/ratecounter
avgratecounter.go
Rate
func (a *AvgRateCounter) Rate() float64 { hits, value := a.hits.Rate(), a.counter.Rate() if hits == 0 { return 0 // Avoid division by zero } return float64(value) / float64(hits) }
go
func (a *AvgRateCounter) Rate() float64 { hits, value := a.hits.Rate(), a.counter.Rate() if hits == 0 { return 0 // Avoid division by zero } return float64(value) / float64(hits) }
[ "func", "(", "a", "*", "AvgRateCounter", ")", "Rate", "(", ")", "float64", "{", "hits", ",", "value", ":=", "a", ".", "hits", ".", "Rate", "(", ")", ",", "a", ".", "counter", ".", "Rate", "(", ")", "\n\n", "if", "hits", "==", "0", "{", "return"...
// Rate Returns the current ratio between the events count and its values during the last interval
[ "Rate", "Returns", "the", "current", "ratio", "between", "the", "events", "count", "and", "its", "values", "during", "the", "last", "interval" ]
a803f0e4f07116687bb30965e8f7d0c32981b63c
https://github.com/paulbellamy/ratecounter/blob/a803f0e4f07116687bb30965e8f7d0c32981b63c/avgratecounter.go#L44-L52
136,868
paulbellamy/ratecounter
ratecounter.go
NewRateCounter
func NewRateCounter(intrvl time.Duration) *RateCounter { ratecounter := &RateCounter{ interval: intrvl, running: 0, } return ratecounter.WithResolution(20) }
go
func NewRateCounter(intrvl time.Duration) *RateCounter { ratecounter := &RateCounter{ interval: intrvl, running: 0, } return ratecounter.WithResolution(20) }
[ "func", "NewRateCounter", "(", "intrvl", "time", ".", "Duration", ")", "*", "RateCounter", "{", "ratecounter", ":=", "&", "RateCounter", "{", "interval", ":", "intrvl", ",", "running", ":", "0", ",", "}", "\n\n", "return", "ratecounter", ".", "WithResolution...
// NewRateCounter Constructs a new RateCounter, for the interval provided
[ "NewRateCounter", "Constructs", "a", "new", "RateCounter", "for", "the", "interval", "provided" ]
a803f0e4f07116687bb30965e8f7d0c32981b63c
https://github.com/paulbellamy/ratecounter/blob/a803f0e4f07116687bb30965e8f7d0c32981b63c/ratecounter.go#L21-L28
136,869
paulbellamy/ratecounter
ratecounter.go
WithResolution
func (r *RateCounter) WithResolution(resolution int) *RateCounter { if resolution < 1 { panic("RateCounter resolution cannot be less than 1") } r.resolution = resolution r.partials = make([]Counter, resolution) r.current = 0 return r }
go
func (r *RateCounter) WithResolution(resolution int) *RateCounter { if resolution < 1 { panic("RateCounter resolution cannot be less than 1") } r.resolution = resolution r.partials = make([]Counter, resolution) r.current = 0 return r }
[ "func", "(", "r", "*", "RateCounter", ")", "WithResolution", "(", "resolution", "int", ")", "*", "RateCounter", "{", "if", "resolution", "<", "1", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "r", ".", "resolution", "=", "resolution", "\n", ...
// WithResolution determines the minimum resolution of this counter, default is 20
[ "WithResolution", "determines", "the", "minimum", "resolution", "of", "this", "counter", "default", "is", "20" ]
a803f0e4f07116687bb30965e8f7d0c32981b63c
https://github.com/paulbellamy/ratecounter/blob/a803f0e4f07116687bb30965e8f7d0c32981b63c/ratecounter.go#L31-L41
136,870
paulbellamy/ratecounter
ratecounter.go
Incr
func (r *RateCounter) Incr(val int64) { r.counter.Incr(val) r.partials[atomic.LoadInt32(&r.current)].Incr(val) r.run() }
go
func (r *RateCounter) Incr(val int64) { r.counter.Incr(val) r.partials[atomic.LoadInt32(&r.current)].Incr(val) r.run() }
[ "func", "(", "r", "*", "RateCounter", ")", "Incr", "(", "val", "int64", ")", "{", "r", ".", "counter", ".", "Incr", "(", "val", ")", "\n", "r", ".", "partials", "[", "atomic", ".", "LoadInt32", "(", "&", "r", ".", "current", ")", "]", ".", "Inc...
// Incr Add an event into the RateCounter
[ "Incr", "Add", "an", "event", "into", "the", "RateCounter" ]
a803f0e4f07116687bb30965e8f7d0c32981b63c
https://github.com/paulbellamy/ratecounter/blob/a803f0e4f07116687bb30965e8f7d0c32981b63c/ratecounter.go#L68-L72
136,871
azer/logger
runtime.go
Hook
func Hook(writer OutputWriter) { writer.Init() runtime.Writers = append(runtime.Writers, writer) }
go
func Hook(writer OutputWriter) { writer.Init() runtime.Writers = append(runtime.Writers, writer) }
[ "func", "Hook", "(", "writer", "OutputWriter", ")", "{", "writer", ".", "Init", "(", ")", "\n", "runtime", ".", "Writers", "=", "append", "(", "runtime", ".", "Writers", ",", "writer", ")", "\n", "}" ]
// Add a new writer
[ "Add", "a", "new", "writer" ]
3735dd63006daf526f2bb390a7f9e68077eddde8
https://github.com/azer/logger/blob/3735dd63006daf526f2bb390a7f9e68077eddde8/runtime.go#L56-L59
136,872
azer/logger
logger.go
Info
func (l *Logger) Info(msg string, v ...interface{}) { l.Log("INFO", msg, v) }
go
func (l *Logger) Info(msg string, v ...interface{}) { l.Log("INFO", msg, v) }
[ "func", "(", "l", "*", "Logger", ")", "Info", "(", "msg", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "l", ".", "Log", "(", "\"", "\"", ",", "msg", ",", "v", ")", "\n", "}" ]
// Info prints log information to the screen that is informational in nature.
[ "Info", "prints", "log", "information", "to", "the", "screen", "that", "is", "informational", "in", "nature", "." ]
3735dd63006daf526f2bb390a7f9e68077eddde8
https://github.com/azer/logger/blob/3735dd63006daf526f2bb390a7f9e68077eddde8/logger.go#L34-L36
136,873
azer/logger
logger.go
Timer
func (l *Logger) Timer() *Log { return &Log{ Package: l.Name, Level: "TIMER", Time: Now(), } }
go
func (l *Logger) Timer() *Log { return &Log{ Package: l.Name, Level: "TIMER", Time: Now(), } }
[ "func", "(", "l", "*", "Logger", ")", "Timer", "(", ")", "*", "Log", "{", "return", "&", "Log", "{", "Package", ":", "l", ".", "Name", ",", "Level", ":", "\"", "\"", ",", "Time", ":", "Now", "(", ")", ",", "}", "\n", "}" ]
// Timer returns a timer sub-logger.
[ "Timer", "returns", "a", "timer", "sub", "-", "logger", "." ]
3735dd63006daf526f2bb390a7f9e68077eddde8
https://github.com/azer/logger/blob/3735dd63006daf526f2bb390a7f9e68077eddde8/logger.go#L44-L50
136,874
azer/logger
log.go
SplitAttrs
func SplitAttrs(v []interface{}) ([]interface{}, *Attrs) { if len(v) == 0 { return v, nil } attrs, ok := v[len(v)-1].(Attrs) if !ok { return v, nil } v = v[:len(v)-1] return v, &attrs }
go
func SplitAttrs(v []interface{}) ([]interface{}, *Attrs) { if len(v) == 0 { return v, nil } attrs, ok := v[len(v)-1].(Attrs) if !ok { return v, nil } v = v[:len(v)-1] return v, &attrs }
[ "func", "SplitAttrs", "(", "v", "[", "]", "interface", "{", "}", ")", "(", "[", "]", "interface", "{", "}", ",", "*", "Attrs", ")", "{", "if", "len", "(", "v", ")", "==", "0", "{", "return", "v", ",", "nil", "\n", "}", "\n\n", "attrs", ",", ...
// SplitAttrs checks if the last item passed in v is an Attrs instance, // if so it returns it separately. If not, v is returned as-is with a nil Attrs.
[ "SplitAttrs", "checks", "if", "the", "last", "item", "passed", "in", "v", "is", "an", "Attrs", "instance", "if", "so", "it", "returns", "it", "separately", ".", "If", "not", "v", "is", "returned", "as", "-", "is", "with", "a", "nil", "Attrs", "." ]
3735dd63006daf526f2bb390a7f9e68077eddde8
https://github.com/azer/logger/blob/3735dd63006daf526f2bb390a7f9e68077eddde8/log.go#L34-L47
136,875
temoto/robotstxt
scanner.go
nextChar
func (s *byteScanner) nextChar() error { //println("--- nextChar(). Offset / len(s.buf): ", s.pos.Offset, len(s.buf)) if s.pos.Offset >= len(s.buf) { s.ch = -1 return io.EOF } s.pos.Column++ if s.ch == '\n' { s.pos.Line++ s.pos.Column = 1 } r, w := rune(s.buf[s.pos.Offset]), 1 if r >= 0x80 { r, w = u...
go
func (s *byteScanner) nextChar() error { //println("--- nextChar(). Offset / len(s.buf): ", s.pos.Offset, len(s.buf)) if s.pos.Offset >= len(s.buf) { s.ch = -1 return io.EOF } s.pos.Column++ if s.ch == '\n' { s.pos.Line++ s.pos.Column = 1 } r, w := rune(s.buf[s.pos.Offset]), 1 if r >= 0x80 { r, w = u...
[ "func", "(", "s", "*", "byteScanner", ")", "nextChar", "(", ")", "error", "{", "//println(\"--- nextChar(). Offset / len(s.buf): \", s.pos.Offset, len(s.buf))", "if", "s", ".", "pos", ".", "Offset", ">=", "len", "(", "s", ".", "buf", ")", "{", "s", ".", "ch", ...
// Reads next Unicode char.
[ "Reads", "next", "Unicode", "char", "." ]
97ee4a9ee6ea01ed0bbf0325dd789f74cac6cb94
https://github.com/temoto/robotstxt/blob/97ee4a9ee6ea01ed0bbf0325dd789f74cac6cb94/scanner.go#L182-L205
136,876
segmentio/fasthash
fasthash32.go
HashString32
func HashString32(f func() hash.Hash32) func(string) uint32 { return func(s string) uint32 { h := f() h.Write([]byte(s)) return h.Sum32() } }
go
func HashString32(f func() hash.Hash32) func(string) uint32 { return func(s string) uint32 { h := f() h.Write([]byte(s)) return h.Sum32() } }
[ "func", "HashString32", "(", "f", "func", "(", ")", "hash", ".", "Hash32", ")", "func", "(", "string", ")", "uint32", "{", "return", "func", "(", "s", "string", ")", "uint32", "{", "h", ":=", "f", "(", ")", "\n", "h", ".", "Write", "(", "[", "]...
// HashString32 makes a hashing function from the hashing algorithm returned by f.
[ "HashString32", "makes", "a", "hashing", "function", "from", "the", "hashing", "algorithm", "returned", "by", "f", "." ]
a72b379d632eab4b49e4f4b2c765cfebf0a74796
https://github.com/segmentio/fasthash/blob/a72b379d632eab4b49e4f4b2c765cfebf0a74796/fasthash32.go#L9-L15
136,877
segmentio/fasthash
fasthash32.go
HashUint32
func HashUint32(f func() hash.Hash32) func(uint32) uint32 { return func(u uint32) uint32 { b := [4]byte{} binary.BigEndian.PutUint32(b[:], u) h := f() h.Write(b[:]) return h.Sum32() } }
go
func HashUint32(f func() hash.Hash32) func(uint32) uint32 { return func(u uint32) uint32 { b := [4]byte{} binary.BigEndian.PutUint32(b[:], u) h := f() h.Write(b[:]) return h.Sum32() } }
[ "func", "HashUint32", "(", "f", "func", "(", ")", "hash", ".", "Hash32", ")", "func", "(", "uint32", ")", "uint32", "{", "return", "func", "(", "u", "uint32", ")", "uint32", "{", "b", ":=", "[", "4", "]", "byte", "{", "}", "\n", "binary", ".", ...
// HashUint32 makes a hashing function from the hashing algorithm return by f.
[ "HashUint32", "makes", "a", "hashing", "function", "from", "the", "hashing", "algorithm", "return", "by", "f", "." ]
a72b379d632eab4b49e4f4b2c765cfebf0a74796
https://github.com/segmentio/fasthash/blob/a72b379d632eab4b49e4f4b2c765cfebf0a74796/fasthash32.go#L18-L26
136,878
segmentio/fasthash
fnv1a/hash32.go
AddString32
func AddString32(h uint32, s string) uint32 { i := 0 n := (len(s) / 8) * 8 for i != n { h = (h ^ uint32(s[i])) * prime32 h = (h ^ uint32(s[i+1])) * prime32 h = (h ^ uint32(s[i+2])) * prime32 h = (h ^ uint32(s[i+3])) * prime32 h = (h ^ uint32(s[i+4])) * prime32 h = (h ^ uint32(s[i+5])) * prime32 h = (h...
go
func AddString32(h uint32, s string) uint32 { i := 0 n := (len(s) / 8) * 8 for i != n { h = (h ^ uint32(s[i])) * prime32 h = (h ^ uint32(s[i+1])) * prime32 h = (h ^ uint32(s[i+2])) * prime32 h = (h ^ uint32(s[i+3])) * prime32 h = (h ^ uint32(s[i+4])) * prime32 h = (h ^ uint32(s[i+5])) * prime32 h = (h...
[ "func", "AddString32", "(", "h", "uint32", ",", "s", "string", ")", "uint32", "{", "i", ":=", "0", "\n", "n", ":=", "(", "len", "(", "s", ")", "/", "8", ")", "*", "8", "\n\n", "for", "i", "!=", "n", "{", "h", "=", "(", "h", "^", "uint32", ...
// AddString32 adds the hash of s to the precomputed hash value h.
[ "AddString32", "adds", "the", "hash", "of", "s", "to", "the", "precomputed", "hash", "value", "h", "." ]
a72b379d632eab4b49e4f4b2c765cfebf0a74796
https://github.com/segmentio/fasthash/blob/a72b379d632eab4b49e4f4b2c765cfebf0a74796/fnv1a/hash32.go#L23-L44
136,879
segmentio/fasthash
fnv1a/hash32.go
AddUint32
func AddUint32(h, u uint32) uint32 { h = (h ^ ((u >> 24) & 0xFF)) * prime32 h = (h ^ ((u >> 16) & 0xFF)) * prime32 h = (h ^ ((u >> 8) & 0xFF)) * prime32 h = (h ^ ((u >> 0) & 0xFF)) * prime32 return h }
go
func AddUint32(h, u uint32) uint32 { h = (h ^ ((u >> 24) & 0xFF)) * prime32 h = (h ^ ((u >> 16) & 0xFF)) * prime32 h = (h ^ ((u >> 8) & 0xFF)) * prime32 h = (h ^ ((u >> 0) & 0xFF)) * prime32 return h }
[ "func", "AddUint32", "(", "h", ",", "u", "uint32", ")", "uint32", "{", "h", "=", "(", "h", "^", "(", "(", "u", ">>", "24", ")", "&", "0xFF", ")", ")", "*", "prime32", "\n", "h", "=", "(", "h", "^", "(", "(", "u", ">>", "16", ")", "&", "...
// AddUint32 adds the hash value of the 8 bytes of u to h.
[ "AddUint32", "adds", "the", "hash", "value", "of", "the", "8", "bytes", "of", "u", "to", "h", "." ]
a72b379d632eab4b49e4f4b2c765cfebf0a74796
https://github.com/segmentio/fasthash/blob/a72b379d632eab4b49e4f4b2c765cfebf0a74796/fnv1a/hash32.go#L47-L53
136,880
segmentio/fasthash
fasthash.go
HashString64
func HashString64(f func() hash.Hash64) func(string) uint64 { return func(s string) uint64 { h := f() h.Write([]byte(s)) return h.Sum64() } }
go
func HashString64(f func() hash.Hash64) func(string) uint64 { return func(s string) uint64 { h := f() h.Write([]byte(s)) return h.Sum64() } }
[ "func", "HashString64", "(", "f", "func", "(", ")", "hash", ".", "Hash64", ")", "func", "(", "string", ")", "uint64", "{", "return", "func", "(", "s", "string", ")", "uint64", "{", "h", ":=", "f", "(", ")", "\n", "h", ".", "Write", "(", "[", "]...
// HashString64 makes a hashing function from the hashing algorithm returned by f.
[ "HashString64", "makes", "a", "hashing", "function", "from", "the", "hashing", "algorithm", "returned", "by", "f", "." ]
a72b379d632eab4b49e4f4b2c765cfebf0a74796
https://github.com/segmentio/fasthash/blob/a72b379d632eab4b49e4f4b2c765cfebf0a74796/fasthash.go#L9-L15
136,881
segmentio/fasthash
fasthash.go
HashUint64
func HashUint64(f func() hash.Hash64) func(uint64) uint64 { return func(u uint64) uint64 { b := [8]byte{} binary.BigEndian.PutUint64(b[:], u) h := f() h.Write(b[:]) return h.Sum64() } }
go
func HashUint64(f func() hash.Hash64) func(uint64) uint64 { return func(u uint64) uint64 { b := [8]byte{} binary.BigEndian.PutUint64(b[:], u) h := f() h.Write(b[:]) return h.Sum64() } }
[ "func", "HashUint64", "(", "f", "func", "(", ")", "hash", ".", "Hash64", ")", "func", "(", "uint64", ")", "uint64", "{", "return", "func", "(", "u", "uint64", ")", "uint64", "{", "b", ":=", "[", "8", "]", "byte", "{", "}", "\n", "binary", ".", ...
// HashUint64 makes a hashing function from the hashing algorithm return by f.
[ "HashUint64", "makes", "a", "hashing", "function", "from", "the", "hashing", "algorithm", "return", "by", "f", "." ]
a72b379d632eab4b49e4f4b2c765cfebf0a74796
https://github.com/segmentio/fasthash/blob/a72b379d632eab4b49e4f4b2c765cfebf0a74796/fasthash.go#L18-L26
136,882
gauntface/web-push-go
webpush/push.go
headerField
func headerField(headerType string, value []byte) string { return fmt.Sprintf(`%s=%s`, headerType, base64.URLEncoding.EncodeToString(value)) }
go
func headerField(headerType string, value []byte) string { return fmt.Sprintf(`%s=%s`, headerType, base64.URLEncoding.EncodeToString(value)) }
[ "func", "headerField", "(", "headerType", "string", ",", "value", "[", "]", "byte", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "`%s=%s`", ",", "headerType", ",", "base64", ".", "URLEncoding", ".", "EncodeToString", "(", "value", ")", ")", ...
// A helper for creating the value part of the HTTP encryption headers
[ "A", "helper", "for", "creating", "the", "value", "part", "of", "the", "HTTP", "encryption", "headers" ]
450e1dc947e62d3deca2694c8d06068be8e05a0c
https://github.com/gauntface/web-push-go/blob/450e1dc947e62d3deca2694c8d06068be8e05a0c/webpush/push.go#L91-L93
136,883
gauntface/web-push-go
webpush/encrypt.go
SubscriptionFromJSON
func SubscriptionFromJSON(b []byte) (*Subscription, error) { var sub struct { Endpoint string Keys struct { P256dh string Auth string } } if err := json.Unmarshal(b, &sub); err != nil { return nil, err } b64 := base64.URLEncoding.WithPadding(base64.NoPadding) // Chrome < 52 incorrectly adds ...
go
func SubscriptionFromJSON(b []byte) (*Subscription, error) { var sub struct { Endpoint string Keys struct { P256dh string Auth string } } if err := json.Unmarshal(b, &sub); err != nil { return nil, err } b64 := base64.URLEncoding.WithPadding(base64.NoPadding) // Chrome < 52 incorrectly adds ...
[ "func", "SubscriptionFromJSON", "(", "b", "[", "]", "byte", ")", "(", "*", "Subscription", ",", "error", ")", "{", "var", "sub", "struct", "{", "Endpoint", "string", "\n", "Keys", "struct", "{", "P256dh", "string", "\n", "Auth", "string", "\n", "}", "\...
// SubscriptionFromJSON is a convenience function that takes a JSON encoded // PushSubscription object acquired from the browser and returns a pointer to a // Subscription
[ "SubscriptionFromJSON", "is", "a", "convenience", "function", "that", "takes", "a", "JSON", "encoded", "PushSubscription", "object", "acquired", "from", "the", "browser", "and", "returns", "a", "pointer", "to", "a", "Subscription" ]
450e1dc947e62d3deca2694c8d06068be8e05a0c
https://github.com/gauntface/web-push-go/blob/450e1dc947e62d3deca2694c8d06068be8e05a0c/webpush/encrypt.go#L134-L161
136,884
gauntface/web-push-go
webpush/encrypt.go
sharedSecret
func sharedSecret(curve elliptic.Curve, pub, priv []byte) ([]byte, error) { publicX, publicY := elliptic.Unmarshal(curve, pub) if publicX == nil { return nil, errors.New("Couldn't unmarshal public key. Not a valid point on the curve") } x, _ := curve.ScalarMult(publicX, publicY, priv) return x.Bytes(), nil }
go
func sharedSecret(curve elliptic.Curve, pub, priv []byte) ([]byte, error) { publicX, publicY := elliptic.Unmarshal(curve, pub) if publicX == nil { return nil, errors.New("Couldn't unmarshal public key. Not a valid point on the curve") } x, _ := curve.ScalarMult(publicX, publicY, priv) return x.Bytes(), nil }
[ "func", "sharedSecret", "(", "curve", "elliptic", ".", "Curve", ",", "pub", ",", "priv", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "publicX", ",", "publicY", ":=", "elliptic", ".", "Unmarshal", "(", "curve", ",", "pub", ...
// Given the coordinates of a party A's public key and the bytes of party B's // private key, compute a shared secret.
[ "Given", "the", "coordinates", "of", "a", "party", "A", "s", "public", "key", "and", "the", "bytes", "of", "party", "B", "s", "private", "key", "compute", "a", "shared", "secret", "." ]
450e1dc947e62d3deca2694c8d06068be8e05a0c
https://github.com/gauntface/web-push-go/blob/450e1dc947e62d3deca2694c8d06068be8e05a0c/webpush/encrypt.go#L400-L407
136,885
tj/go-dropbox
users.go
GetAccount
func (c *Users) GetAccount(in *GetAccountInput) (out *GetAccountOutput, err error) { body, err := c.call("/users/get_account", in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
go
func (c *Users) GetAccount(in *GetAccountInput) (out *GetAccountOutput, err error) { body, err := c.call("/users/get_account", in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
[ "func", "(", "c", "*", "Users", ")", "GetAccount", "(", "in", "*", "GetAccountInput", ")", "(", "out", "*", "GetAccountOutput", ",", "err", "error", ")", "{", "body", ",", "err", ":=", "c", ".", "call", "(", "\"", "\"", ",", "in", ")", "\n", "if"...
// GetAccount returns information about a user's account.
[ "GetAccount", "returns", "information", "about", "a", "user", "s", "account", "." ]
42dd2be3662d084396bbc756e04116fb30ba7ced
https://github.com/tj/go-dropbox/blob/42dd2be3662d084396bbc756e04116fb30ba7ced/users.go#L38-L47
136,886
tj/go-dropbox
users.go
GetCurrentAccount
func (c *Users) GetCurrentAccount() (out *GetCurrentAccountOutput, err error) { body, err := c.call("/users/get_current_account", nil) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
go
func (c *Users) GetCurrentAccount() (out *GetCurrentAccountOutput, err error) { body, err := c.call("/users/get_current_account", nil) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
[ "func", "(", "c", "*", "Users", ")", "GetCurrentAccount", "(", ")", "(", "out", "*", "GetCurrentAccountOutput", ",", "err", "error", ")", "{", "body", ",", "err", ":=", "c", ".", "call", "(", "\"", "\"", ",", "nil", ")", "\n", "if", "err", "!=", ...
// GetCurrentAccount returns information about the current user's account.
[ "GetCurrentAccount", "returns", "information", "about", "the", "current", "user", "s", "account", "." ]
42dd2be3662d084396bbc756e04116fb30ba7ced
https://github.com/tj/go-dropbox/blob/42dd2be3662d084396bbc756e04116fb30ba7ced/users.go#L69-L78
136,887
tj/go-dropbox
users.go
GetSpaceUsage
func (c *Users) GetSpaceUsage() (out *GetSpaceUsageOutput, err error) { body, err := c.call("/users/get_space_usage", nil) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
go
func (c *Users) GetSpaceUsage() (out *GetSpaceUsageOutput, err error) { body, err := c.call("/users/get_space_usage", nil) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
[ "func", "(", "c", "*", "Users", ")", "GetSpaceUsage", "(", ")", "(", "out", "*", "GetSpaceUsageOutput", ",", "err", "error", ")", "{", "body", ",", "err", ":=", "c", ".", "call", "(", "\"", "\"", ",", "nil", ")", "\n", "if", "err", "!=", "nil", ...
// GetSpaceUsage returns space usage information for the current user's account.
[ "GetSpaceUsage", "returns", "space", "usage", "information", "for", "the", "current", "user", "s", "account", "." ]
42dd2be3662d084396bbc756e04116fb30ba7ced
https://github.com/tj/go-dropbox/blob/42dd2be3662d084396bbc756e04116fb30ba7ced/users.go#L90-L99
136,888
tj/go-dropbox
sharing.go
CreateSharedLink
func (c *Sharing) CreateSharedLink(in *CreateSharedLinkInput) (out *CreateSharedLinkOutput, err error) { body, err := c.call("/sharing/create_shared_link_with_settings", in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
go
func (c *Sharing) CreateSharedLink(in *CreateSharedLinkInput) (out *CreateSharedLinkOutput, err error) { body, err := c.call("/sharing/create_shared_link_with_settings", in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
[ "func", "(", "c", "*", "Sharing", ")", "CreateSharedLink", "(", "in", "*", "CreateSharedLinkInput", ")", "(", "out", "*", "CreateSharedLinkOutput", ",", "err", "error", ")", "{", "body", ",", "err", ":=", "c", ".", "call", "(", "\"", "\"", ",", "in", ...
// CreateSharedLink returns a shared link.
[ "CreateSharedLink", "returns", "a", "shared", "link", "." ]
42dd2be3662d084396bbc756e04116fb30ba7ced
https://github.com/tj/go-dropbox/blob/42dd2be3662d084396bbc756e04116fb30ba7ced/sharing.go#L50-L59
136,889
tj/go-dropbox
sharing.go
ListSharedLinks
func (c *Sharing) ListSharedLinks(in *ListShareLinksInput) (out *ListShareLinksOutput, err error) { endpoint := "/sharing/list_shared_links" body, err := c.call(endpoint, in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
go
func (c *Sharing) ListSharedLinks(in *ListShareLinksInput) (out *ListShareLinksOutput, err error) { endpoint := "/sharing/list_shared_links" body, err := c.call(endpoint, in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
[ "func", "(", "c", "*", "Sharing", ")", "ListSharedLinks", "(", "in", "*", "ListShareLinksInput", ")", "(", "out", "*", "ListShareLinksOutput", ",", "err", "error", ")", "{", "endpoint", ":=", "\"", "\"", "\n", "body", ",", "err", ":=", "c", ".", "call"...
// ListSharedLinks gets shared links of input.
[ "ListSharedLinks", "gets", "shared", "links", "of", "input", "." ]
42dd2be3662d084396bbc756e04116fb30ba7ced
https://github.com/tj/go-dropbox/blob/42dd2be3662d084396bbc756e04116fb30ba7ced/sharing.go#L82-L92
136,890
tj/go-dropbox
sharing.go
ListSharedFolders
func (c *Sharing) ListSharedFolders(in *ListSharedFolderInput) (out *ListSharedFolderOutput, err error) { body, err := c.call("/sharing/list_folders", in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
go
func (c *Sharing) ListSharedFolders(in *ListSharedFolderInput) (out *ListSharedFolderOutput, err error) { body, err := c.call("/sharing/list_folders", in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
[ "func", "(", "c", "*", "Sharing", ")", "ListSharedFolders", "(", "in", "*", "ListSharedFolderInput", ")", "(", "out", "*", "ListSharedFolderOutput", ",", "err", "error", ")", "{", "body", ",", "err", ":=", "c", ".", "call", "(", "\"", "\"", ",", "in", ...
// ListSharedFolders returns the list of all shared folders the current user has access to.
[ "ListSharedFolders", "returns", "the", "list", "of", "all", "shared", "folders", "the", "current", "user", "has", "access", "to", "." ]
42dd2be3662d084396bbc756e04116fb30ba7ced
https://github.com/tj/go-dropbox/blob/42dd2be3662d084396bbc756e04116fb30ba7ced/sharing.go#L112-L121
136,891
tj/go-dropbox
sharing.go
ListSharedFoldersContinue
func (c *Sharing) ListSharedFoldersContinue(in *ListSharedFolderContinueInput) (out *ListSharedFolderOutput, err error) { body, err := c.call("/sharing/list_folders/continue", in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
go
func (c *Sharing) ListSharedFoldersContinue(in *ListSharedFolderContinueInput) (out *ListSharedFolderOutput, err error) { body, err := c.call("/sharing/list_folders/continue", in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
[ "func", "(", "c", "*", "Sharing", ")", "ListSharedFoldersContinue", "(", "in", "*", "ListSharedFolderContinueInput", ")", "(", "out", "*", "ListSharedFolderOutput", ",", "err", "error", ")", "{", "body", ",", "err", ":=", "c", ".", "call", "(", "\"", "\"",...
// ListSharedFoldersContinue returns the list of all shared folders the current user has access to.
[ "ListSharedFoldersContinue", "returns", "the", "list", "of", "all", "shared", "folders", "the", "current", "user", "has", "access", "to", "." ]
42dd2be3662d084396bbc756e04116fb30ba7ced
https://github.com/tj/go-dropbox/blob/42dd2be3662d084396bbc756e04116fb30ba7ced/sharing.go#L129-L138
136,892
tj/go-dropbox
client.go
call
func (c *Client) call(path string, in interface{}) (io.ReadCloser, error) { url := "https://api.dropboxapi.com/2" + path body, err := json.Marshal(in) if err != nil { return nil, err } req, err := http.NewRequest("POST", url, bytes.NewReader(body)) if err != nil { return nil, err } req.Header.Set("Authori...
go
func (c *Client) call(path string, in interface{}) (io.ReadCloser, error) { url := "https://api.dropboxapi.com/2" + path body, err := json.Marshal(in) if err != nil { return nil, err } req, err := http.NewRequest("POST", url, bytes.NewReader(body)) if err != nil { return nil, err } req.Header.Set("Authori...
[ "func", "(", "c", "*", "Client", ")", "call", "(", "path", "string", ",", "in", "interface", "{", "}", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "url", ":=", "\"", "\"", "+", "path", "\n\n", "body", ",", "err", ":=", "json", "....
// call rpc style endpoint.
[ "call", "rpc", "style", "endpoint", "." ]
42dd2be3662d084396bbc756e04116fb30ba7ced
https://github.com/tj/go-dropbox/blob/42dd2be3662d084396bbc756e04116fb30ba7ced/client.go#L31-L48
136,893
tj/go-dropbox
client.go
download
func (c *Client) download(path string, in interface{}, r io.Reader) (io.ReadCloser, int64, error) { url := "https://content.dropboxapi.com/2" + path body, err := json.Marshal(in) if err != nil { return nil, 0, err } req, err := http.NewRequest("POST", url, r) if err != nil { return nil, 0, err } req.Heade...
go
func (c *Client) download(path string, in interface{}, r io.Reader) (io.ReadCloser, int64, error) { url := "https://content.dropboxapi.com/2" + path body, err := json.Marshal(in) if err != nil { return nil, 0, err } req, err := http.NewRequest("POST", url, r) if err != nil { return nil, 0, err } req.Heade...
[ "func", "(", "c", "*", "Client", ")", "download", "(", "path", "string", ",", "in", "interface", "{", "}", ",", "r", "io", ".", "Reader", ")", "(", "io", ".", "ReadCloser", ",", "int64", ",", "error", ")", "{", "url", ":=", "\"", "\"", "+", "pa...
// download style endpoint.
[ "download", "style", "endpoint", "." ]
42dd2be3662d084396bbc756e04116fb30ba7ced
https://github.com/tj/go-dropbox/blob/42dd2be3662d084396bbc756e04116fb30ba7ced/client.go#L51-L71
136,894
tj/go-dropbox
client.go
do
func (c *Client) do(req *http.Request) (io.ReadCloser, int64, error) { res, err := c.HTTPClient.Do(req) if err != nil { return nil, 0, err } if res.StatusCode < 400 { return res.Body, res.ContentLength, err } defer res.Body.Close() e := &Error{ Status: http.StatusText(res.StatusCode), StatusCode: ...
go
func (c *Client) do(req *http.Request) (io.ReadCloser, int64, error) { res, err := c.HTTPClient.Do(req) if err != nil { return nil, 0, err } if res.StatusCode < 400 { return res.Body, res.ContentLength, err } defer res.Body.Close() e := &Error{ Status: http.StatusText(res.StatusCode), StatusCode: ...
[ "func", "(", "c", "*", "Client", ")", "do", "(", "req", "*", "http", ".", "Request", ")", "(", "io", ".", "ReadCloser", ",", "int64", ",", "error", ")", "{", "res", ",", "err", ":=", "c", ".", "HTTPClient", ".", "Do", "(", "req", ")", "\n", "...
// perform the request.
[ "perform", "the", "request", "." ]
42dd2be3662d084396bbc756e04116fb30ba7ced
https://github.com/tj/go-dropbox/blob/42dd2be3662d084396bbc756e04116fb30ba7ced/client.go#L74-L106
136,895
tj/go-dropbox
config.go
NewConfig
func NewConfig(accessToken string) *Config { return &Config{ HTTPClient: http.DefaultClient, AccessToken: accessToken, } }
go
func NewConfig(accessToken string) *Config { return &Config{ HTTPClient: http.DefaultClient, AccessToken: accessToken, } }
[ "func", "NewConfig", "(", "accessToken", "string", ")", "*", "Config", "{", "return", "&", "Config", "{", "HTTPClient", ":", "http", ".", "DefaultClient", ",", "AccessToken", ":", "accessToken", ",", "}", "\n", "}" ]
// NewConfig with the given access token.
[ "NewConfig", "with", "the", "given", "access", "token", "." ]
42dd2be3662d084396bbc756e04116fb30ba7ced
https://github.com/tj/go-dropbox/blob/42dd2be3662d084396bbc756e04116fb30ba7ced/config.go#L14-L19
136,896
tj/go-dropbox
files.go
GetMetadata
func (c *Files) GetMetadata(in *GetMetadataInput) (out *GetMetadataOutput, err error) { body, err := c.call("/files/get_metadata", in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
go
func (c *Files) GetMetadata(in *GetMetadataInput) (out *GetMetadataOutput, err error) { body, err := c.call("/files/get_metadata", in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
[ "func", "(", "c", "*", "Files", ")", "GetMetadata", "(", "in", "*", "GetMetadataInput", ")", "(", "out", "*", "GetMetadataOutput", ",", "err", "error", ")", "{", "body", ",", "err", ":=", "c", ".", "call", "(", "\"", "\"", ",", "in", ")", "\n", "...
// GetMetadata returns the metadata for a file or folder.
[ "GetMetadata", "returns", "the", "metadata", "for", "a", "file", "or", "folder", "." ]
42dd2be3662d084396bbc756e04116fb30ba7ced
https://github.com/tj/go-dropbox/blob/42dd2be3662d084396bbc756e04116fb30ba7ced/files.go#L109-L118
136,897
tj/go-dropbox
files.go
CreateFolder
func (c *Files) CreateFolder(in *CreateFolderInput) (out *CreateFolderOutput, err error) { body, err := c.call("/files/create_folder", in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
go
func (c *Files) CreateFolder(in *CreateFolderInput) (out *CreateFolderOutput, err error) { body, err := c.call("/files/create_folder", in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
[ "func", "(", "c", "*", "Files", ")", "CreateFolder", "(", "in", "*", "CreateFolderInput", ")", "(", "out", "*", "CreateFolderOutput", ",", "err", "error", ")", "{", "body", ",", "err", ":=", "c", ".", "call", "(", "\"", "\"", ",", "in", ")", "\n", ...
// CreateFolder creates a folder.
[ "CreateFolder", "creates", "a", "folder", "." ]
42dd2be3662d084396bbc756e04116fb30ba7ced
https://github.com/tj/go-dropbox/blob/42dd2be3662d084396bbc756e04116fb30ba7ced/files.go#L133-L142
136,898
tj/go-dropbox
files.go
Delete
func (c *Files) Delete(in *DeleteInput) (out *DeleteOutput, err error) { body, err := c.call("/files/delete", in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
go
func (c *Files) Delete(in *DeleteInput) (out *DeleteOutput, err error) { body, err := c.call("/files/delete", in) if err != nil { return } defer body.Close() err = json.NewDecoder(body).Decode(&out) return }
[ "func", "(", "c", "*", "Files", ")", "Delete", "(", "in", "*", "DeleteInput", ")", "(", "out", "*", "DeleteOutput", ",", "err", "error", ")", "{", "body", ",", "err", ":=", "c", ".", "call", "(", "\"", "\"", ",", "in", ")", "\n", "if", "err", ...
// Delete a file or folder and its contents.
[ "Delete", "a", "file", "or", "folder", "and", "its", "contents", "." ]
42dd2be3662d084396bbc756e04116fb30ba7ced
https://github.com/tj/go-dropbox/blob/42dd2be3662d084396bbc756e04116fb30ba7ced/files.go#L155-L164
136,899
tj/go-dropbox
files.go
PermanentlyDelete
func (c *Files) PermanentlyDelete(in *PermanentlyDeleteInput) (err error) { body, err := c.call("/files/delete", in) if err != nil { return } defer body.Close() return }
go
func (c *Files) PermanentlyDelete(in *PermanentlyDeleteInput) (err error) { body, err := c.call("/files/delete", in) if err != nil { return } defer body.Close() return }
[ "func", "(", "c", "*", "Files", ")", "PermanentlyDelete", "(", "in", "*", "PermanentlyDeleteInput", ")", "(", "err", "error", ")", "{", "body", ",", "err", ":=", "c", ".", "call", "(", "\"", "\"", ",", "in", ")", "\n", "if", "err", "!=", "nil", "...
// PermanentlyDelete a file or folder and its contents.
[ "PermanentlyDelete", "a", "file", "or", "folder", "and", "its", "contents", "." ]
42dd2be3662d084396bbc756e04116fb30ba7ced
https://github.com/tj/go-dropbox/blob/42dd2be3662d084396bbc756e04116fb30ba7ced/files.go#L172-L180