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
150,500
mattn/go-oci8
cHelpers.go
freeBuffer
func freeBuffer(buffer unsafe.Pointer, dataType C.ub2) { switch dataType { case C.SQLT_CLOB, C.SQLT_BLOB: C.OCIDescriptorFree(*(*unsafe.Pointer)(buffer), C.OCI_DTYPE_LOB) case C.SQLT_TIMESTAMP: C.OCIDescriptorFree(*(*unsafe.Pointer)(buffer), C.OCI_DTYPE_TIMESTAMP) case C.SQLT_TIMESTAMP_TZ: C.OCIDescriptorFree...
go
func freeBuffer(buffer unsafe.Pointer, dataType C.ub2) { switch dataType { case C.SQLT_CLOB, C.SQLT_BLOB: C.OCIDescriptorFree(*(*unsafe.Pointer)(buffer), C.OCI_DTYPE_LOB) case C.SQLT_TIMESTAMP: C.OCIDescriptorFree(*(*unsafe.Pointer)(buffer), C.OCI_DTYPE_TIMESTAMP) case C.SQLT_TIMESTAMP_TZ: C.OCIDescriptorFree...
[ "func", "freeBuffer", "(", "buffer", "unsafe", ".", "Pointer", ",", "dataType", "C", ".", "ub2", ")", "{", "switch", "dataType", "{", "case", "C", ".", "SQLT_CLOB", ",", "C", ".", "SQLT_BLOB", ":", "C", ".", "OCIDescriptorFree", "(", "*", "(", "*", "...
// freeBuffer calles OCIDescriptorFree to free double pointer to buffer // or calles C free to free pointer to buffer
[ "freeBuffer", "calles", "OCIDescriptorFree", "to", "free", "double", "pointer", "to", "buffer", "or", "calles", "C", "free", "to", "free", "pointer", "to", "buffer" ]
b4ff95311f59786a15c0688c8beff047414c098f
https://github.com/mattn/go-oci8/blob/b4ff95311f59786a15c0688c8beff047414c098f/cHelpers.go#L113-L130
150,501
mattn/go-oci8
rows.go
Close
func (rows *OCI8Rows) Close() error { if rows.closed { return nil } rows.closed = true close(rows.done) if rows.cls { rows.stmt.Close() } freeDefines(rows.defines) return nil }
go
func (rows *OCI8Rows) Close() error { if rows.closed { return nil } rows.closed = true close(rows.done) if rows.cls { rows.stmt.Close() } freeDefines(rows.defines) return nil }
[ "func", "(", "rows", "*", "OCI8Rows", ")", "Close", "(", ")", "error", "{", "if", "rows", ".", "closed", "{", "return", "nil", "\n", "}", "\n\n", "rows", ".", "closed", "=", "true", "\n", "close", "(", "rows", ".", "done", ")", "\n\n", "if", "row...
// Close closes rows
[ "Close", "closes", "rows" ]
b4ff95311f59786a15c0688c8beff047414c098f
https://github.com/mattn/go-oci8/blob/b4ff95311f59786a15c0688c8beff047414c098f/rows.go#L18-L33
150,502
mattn/go-oci8
rows.go
Columns
func (rows *OCI8Rows) Columns() []string { names := make([]string, len(rows.defines)) for i, define := range rows.defines { names[i] = define.name } return names }
go
func (rows *OCI8Rows) Columns() []string { names := make([]string, len(rows.defines)) for i, define := range rows.defines { names[i] = define.name } return names }
[ "func", "(", "rows", "*", "OCI8Rows", ")", "Columns", "(", ")", "[", "]", "string", "{", "names", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "rows", ".", "defines", ")", ")", "\n", "for", "i", ",", "define", ":=", "range", "rows", ...
// Columns returns column names
[ "Columns", "returns", "column", "names" ]
b4ff95311f59786a15c0688c8beff047414c098f
https://github.com/mattn/go-oci8/blob/b4ff95311f59786a15c0688c8beff047414c098f/rows.go#L36-L42
150,503
mattn/go-oci8
rows.go
ColumnTypeLength
func (rows *OCI8Rows) ColumnTypeLength(i int) (length int64, ok bool) { param, err := rows.stmt.ociParamGet(C.ub4(i + 1)) if err != nil { return 0, false } defer C.OCIDescriptorFree(unsafe.Pointer(param), C.OCI_DTYPE_PARAM) var dataSize C.ub4 // Maximum size in bytes of the external data for the column. This ca...
go
func (rows *OCI8Rows) ColumnTypeLength(i int) (length int64, ok bool) { param, err := rows.stmt.ociParamGet(C.ub4(i + 1)) if err != nil { return 0, false } defer C.OCIDescriptorFree(unsafe.Pointer(param), C.OCI_DTYPE_PARAM) var dataSize C.ub4 // Maximum size in bytes of the external data for the column. This ca...
[ "func", "(", "rows", "*", "OCI8Rows", ")", "ColumnTypeLength", "(", "i", "int", ")", "(", "length", "int64", ",", "ok", "bool", ")", "{", "param", ",", "err", ":=", "rows", ".", "stmt", ".", "ociParamGet", "(", "C", ".", "ub4", "(", "i", "+", "1"...
// ColumnTypeLength returns column length
[ "ColumnTypeLength", "returns", "column", "length" ]
b4ff95311f59786a15c0688c8beff047414c098f
https://github.com/mattn/go-oci8/blob/b4ff95311f59786a15c0688c8beff047414c098f/rows.go#L350-L364
150,504
mattn/go-oci8
dsn.go
ParseQuery
func ParseQuery(query string) (m Values, err error) { m = make(Values) err = parseQuery(m, query) return }
go
func ParseQuery(query string) (m Values, err error) { m = make(Values) err = parseQuery(m, query) return }
[ "func", "ParseQuery", "(", "query", "string", ")", "(", "m", "Values", ",", "err", "error", ")", "{", "m", "=", "make", "(", "Values", ")", "\n", "err", "=", "parseQuery", "(", "m", ",", "query", ")", "\n", "return", "\n", "}" ]
// ParseQuery parses the URL-encoded query string and returns // a map listing the values specified for each key. // ParseQuery always returns a non-nil map containing all the // valid query parameters found; err describes the first decoding error // encountered, if any.
[ "ParseQuery", "parses", "the", "URL", "-", "encoded", "query", "string", "and", "returns", "a", "map", "listing", "the", "values", "specified", "for", "each", "key", ".", "ParseQuery", "always", "returns", "a", "non", "-", "nil", "map", "containing", "all", ...
b4ff95311f59786a15c0688c8beff047414c098f
https://github.com/mattn/go-oci8/blob/b4ff95311f59786a15c0688c8beff047414c098f/dsn.go#L296-L300
150,505
gin-contrib/sessions
redis/redis.go
SetKeyPrefix
func SetKeyPrefix(s Store, prefix string) error { err, rediStore := GetRedisStore(s) if err != nil { return err } rediStore.SetKeyPrefix(prefix) return nil }
go
func SetKeyPrefix(s Store, prefix string) error { err, rediStore := GetRedisStore(s) if err != nil { return err } rediStore.SetKeyPrefix(prefix) return nil }
[ "func", "SetKeyPrefix", "(", "s", "Store", ",", "prefix", "string", ")", "error", "{", "err", ",", "rediStore", ":=", "GetRedisStore", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "rediStore", ".", "SetKeyPref...
// SetKeyPrefix sets the key prefix in the redis database.
[ "SetKeyPrefix", "sets", "the", "key", "prefix", "in", "the", "redis", "database", "." ]
1532893d996f0fedbac1162ea1311ebfb57a3da5
https://github.com/gin-contrib/sessions/blob/1532893d996f0fedbac1162ea1311ebfb57a3da5/redis/redis.go#L78-L86
150,506
bamzi/jobrunner
runjob.go
Every
func Every(duration time.Duration, job cron.Job) { MainCron.Schedule(cron.Every(duration), New(job)) }
go
func Every(duration time.Duration, job cron.Job) { MainCron.Schedule(cron.Every(duration), New(job)) }
[ "func", "Every", "(", "duration", "time", ".", "Duration", ",", "job", "cron", ".", "Job", ")", "{", "MainCron", ".", "Schedule", "(", "cron", ".", "Every", "(", "duration", ")", ",", "New", "(", "job", ")", ")", "\n", "}" ]
// Run the given job at a fixed interval. // The interval provided is the time between the job ending and the job being run again. // The time that the job takes to run is not included in the interval.
[ "Run", "the", "given", "job", "at", "a", "fixed", "interval", ".", "The", "interval", "provided", "is", "the", "time", "between", "the", "job", "ending", "and", "the", "job", "being", "run", "again", ".", "The", "time", "that", "the", "job", "takes", "...
273175f8b6ebabab8a639a4e6260a5c50fbf016a
https://github.com/bamzi/jobrunner/blob/273175f8b6ebabab8a639a4e6260a5c50fbf016a/runjob.go#L40-L43
150,507
bamzi/jobrunner
runjob.go
In
func In(duration time.Duration, job cron.Job) { go func() { time.Sleep(duration) New(job).Run() }() }
go
func In(duration time.Duration, job cron.Job) { go func() { time.Sleep(duration) New(job).Run() }() }
[ "func", "In", "(", "duration", "time", ".", "Duration", ",", "job", "cron", ".", "Job", ")", "{", "go", "func", "(", ")", "{", "time", ".", "Sleep", "(", "duration", ")", "\n", "New", "(", "job", ")", ".", "Run", "(", ")", "\n", "}", "(", ")"...
// Run the given job once, after the given delay.
[ "Run", "the", "given", "job", "once", "after", "the", "given", "delay", "." ]
273175f8b6ebabab8a639a4e6260a5c50fbf016a
https://github.com/bamzi/jobrunner/blob/273175f8b6ebabab8a639a4e6260a5c50fbf016a/runjob.go#L51-L56
150,508
klauspost/reedsolomon
streaming.go
NewStream
func NewStream(dataShards, parityShards int, o ...Option) (StreamEncoder, error) { enc, err := New(dataShards, parityShards, o...) if err != nil { return nil, err } rs := enc.(*reedSolomon) r := rsStream{r: rs, bs: 4 << 20} r.readShards = readShards r.writeShards = writeShards return &r, err }
go
func NewStream(dataShards, parityShards int, o ...Option) (StreamEncoder, error) { enc, err := New(dataShards, parityShards, o...) if err != nil { return nil, err } rs := enc.(*reedSolomon) r := rsStream{r: rs, bs: 4 << 20} r.readShards = readShards r.writeShards = writeShards return &r, err }
[ "func", "NewStream", "(", "dataShards", ",", "parityShards", "int", ",", "o", "...", "Option", ")", "(", "StreamEncoder", ",", "error", ")", "{", "enc", ",", "err", ":=", "New", "(", "dataShards", ",", "parityShards", ",", "o", "...", ")", "\n", "if", ...
// NewStream creates a new encoder and initializes it to // the number of data shards and parity shards that // you want to use. You can reuse this encoder. // Note that the maximum number of data shards is 256.
[ "NewStream", "creates", "a", "new", "encoder", "and", "initializes", "it", "to", "the", "number", "of", "data", "shards", "and", "parity", "shards", "that", "you", "want", "to", "use", ".", "You", "can", "reuse", "this", "encoder", ".", "Note", "that", "...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/streaming.go#L148-L158
150,509
klauspost/reedsolomon
streaming.go
NewStreamC
func NewStreamC(dataShards, parityShards int, conReads, conWrites bool, o ...Option) (StreamEncoder, error) { enc, err := New(dataShards, parityShards, o...) if err != nil { return nil, err } rs := enc.(*reedSolomon) r := rsStream{r: rs, bs: 4 << 20} r.readShards = readShards r.writeShards = writeShards if co...
go
func NewStreamC(dataShards, parityShards int, conReads, conWrites bool, o ...Option) (StreamEncoder, error) { enc, err := New(dataShards, parityShards, o...) if err != nil { return nil, err } rs := enc.(*reedSolomon) r := rsStream{r: rs, bs: 4 << 20} r.readShards = readShards r.writeShards = writeShards if co...
[ "func", "NewStreamC", "(", "dataShards", ",", "parityShards", "int", ",", "conReads", ",", "conWrites", "bool", ",", "o", "...", "Option", ")", "(", "StreamEncoder", ",", "error", ")", "{", "enc", ",", "err", ":=", "New", "(", "dataShards", ",", "parityS...
// NewStreamC creates a new encoder and initializes it to // the number of data shards and parity shards given. // // This functions as 'NewStream', but allows you to enable CONCURRENT reads and writes.
[ "NewStreamC", "creates", "a", "new", "encoder", "and", "initializes", "it", "to", "the", "number", "of", "data", "shards", "and", "parity", "shards", "given", ".", "This", "functions", "as", "NewStream", "but", "allows", "you", "to", "enable", "CONCURRENT", ...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/streaming.go#L164-L180
150,510
klauspost/reedsolomon
streaming.go
trimShards
func trimShards(in [][]byte, size int) [][]byte { for i := range in { if in[i] != nil { in[i] = in[i][0:size] } if len(in[i]) < size { in[i] = nil } } return in }
go
func trimShards(in [][]byte, size int) [][]byte { for i := range in { if in[i] != nil { in[i] = in[i][0:size] } if len(in[i]) < size { in[i] = nil } } return in }
[ "func", "trimShards", "(", "in", "[", "]", "[", "]", "byte", ",", "size", "int", ")", "[", "]", "[", "]", "byte", "{", "for", "i", ":=", "range", "in", "{", "if", "in", "[", "i", "]", "!=", "nil", "{", "in", "[", "i", "]", "=", "in", "[",...
// Trim the shards so they are all the same size
[ "Trim", "the", "shards", "so", "they", "are", "all", "the", "same", "size" ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/streaming.go#L245-L255
150,511
klauspost/reedsolomon
streaming.go
cReadShards
func cReadShards(dst [][]byte, in []io.Reader) error { if len(in) != len(dst) { panic("internal error: in and dst size do not match") } var wg sync.WaitGroup wg.Add(len(in)) res := make(chan readResult, len(in)) for i := range in { if in[i] == nil { dst[i] = nil wg.Done() continue } go func(i int...
go
func cReadShards(dst [][]byte, in []io.Reader) error { if len(in) != len(dst) { panic("internal error: in and dst size do not match") } var wg sync.WaitGroup wg.Add(len(in)) res := make(chan readResult, len(in)) for i := range in { if in[i] == nil { dst[i] = nil wg.Done() continue } go func(i int...
[ "func", "cReadShards", "(", "dst", "[", "]", "[", "]", "byte", ",", "in", "[", "]", "io", ".", "Reader", ")", "error", "{", "if", "len", "(", "in", ")", "!=", "len", "(", "dst", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "var...
// cReadShards reads shards concurrently
[ "cReadShards", "reads", "shards", "concurrently" ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/streaming.go#L319-L364
150,512
klauspost/reedsolomon
streaming.go
cWriteShards
func cWriteShards(out []io.Writer, in [][]byte) error { if len(out) != len(in) { panic("internal error: in and out size do not match") } var errs = make(chan error, len(out)) var wg sync.WaitGroup wg.Add(len(out)) for i := range in { go func(i int) { defer wg.Done() if out[i] == nil { errs <- nil ...
go
func cWriteShards(out []io.Writer, in [][]byte) error { if len(out) != len(in) { panic("internal error: in and out size do not match") } var errs = make(chan error, len(out)) var wg sync.WaitGroup wg.Add(len(out)) for i := range in { go func(i int) { defer wg.Done() if out[i] == nil { errs <- nil ...
[ "func", "cWriteShards", "(", "out", "[", "]", "io", ".", "Writer", ",", "in", "[", "]", "[", "]", "byte", ")", "error", "{", "if", "len", "(", "out", ")", "!=", "len", "(", "in", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "va...
// cWriteShards writes shards concurrently
[ "cWriteShards", "writes", "shards", "concurrently" ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/streaming.go#L367-L400
150,513
klauspost/reedsolomon
streaming.go
Join
func (r rsStream) Join(dst io.Writer, shards []io.Reader, outSize int64) error { // Do we have enough shards? if len(shards) < r.r.DataShards { return ErrTooFewShards } // Trim off parity shards if any shards = shards[:r.r.DataShards] for i := range shards { if shards[i] == nil { return StreamReadError{Er...
go
func (r rsStream) Join(dst io.Writer, shards []io.Reader, outSize int64) error { // Do we have enough shards? if len(shards) < r.r.DataShards { return ErrTooFewShards } // Trim off parity shards if any shards = shards[:r.r.DataShards] for i := range shards { if shards[i] == nil { return StreamReadError{Er...
[ "func", "(", "r", "rsStream", ")", "Join", "(", "dst", "io", ".", "Writer", ",", "shards", "[", "]", "io", ".", "Reader", ",", "outSize", "int64", ")", "error", "{", "// Do we have enough shards?", "if", "len", "(", "shards", ")", "<", "r", ".", "r",...
// Join the shards and write the data segment to dst. // // Only the data shards are considered. // // You must supply the exact output size you want. // If there are to few shards given, ErrTooFewShards will be returned. // If the total data size is less than outSize, ErrShortData will be returned.
[ "Join", "the", "shards", "and", "write", "the", "data", "segment", "to", "dst", ".", "Only", "the", "data", "shards", "are", "considered", ".", "You", "must", "supply", "the", "exact", "output", "size", "you", "want", ".", "If", "there", "are", "to", "...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/streaming.go#L512-L540
150,514
klauspost/reedsolomon
streaming.go
Split
func (r rsStream) Split(data io.Reader, dst []io.Writer, size int64) error { if size == 0 { return ErrShortData } if len(dst) != r.r.DataShards { return ErrInvShardNum } for i := range dst { if dst[i] == nil { return StreamWriteError{Err: ErrShardNoData, Stream: i} } } // Calculate number of bytes p...
go
func (r rsStream) Split(data io.Reader, dst []io.Writer, size int64) error { if size == 0 { return ErrShortData } if len(dst) != r.r.DataShards { return ErrInvShardNum } for i := range dst { if dst[i] == nil { return StreamWriteError{Err: ErrShardNoData, Stream: i} } } // Calculate number of bytes p...
[ "func", "(", "r", "rsStream", ")", "Split", "(", "data", "io", ".", "Reader", ",", "dst", "[", "]", "io", ".", "Writer", ",", "size", "int64", ")", "error", "{", "if", "size", "==", "0", "{", "return", "ErrShortData", "\n", "}", "\n", "if", "len"...
// Split a an input stream into the number of shards given to the encoder. // // The data will be split into equally sized shards. // If the data size isn't dividable by the number of shards, // the last shard will contain extra zeros. // // You must supply the total size of your input. // 'ErrShortData' will be return...
[ "Split", "a", "an", "input", "stream", "into", "the", "number", "of", "shards", "given", "to", "the", "encoder", ".", "The", "data", "will", "be", "split", "into", "equally", "sized", "shards", ".", "If", "the", "data", "size", "isn", "t", "dividable", ...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/streaming.go#L551-L584
150,515
klauspost/reedsolomon
options.go
WithMinSplitSize
func WithMinSplitSize(n int) Option { return func(o *options) { if n > 0 { o.minSplitSize = n } } }
go
func WithMinSplitSize(n int) Option { return func(o *options) { if n > 0 { o.minSplitSize = n } } }
[ "func", "WithMinSplitSize", "(", "n", "int", ")", "Option", "{", "return", "func", "(", "o", "*", "options", ")", "{", "if", "n", ">", "0", "{", "o", ".", "minSplitSize", "=", "n", "\n", "}", "\n", "}", "\n", "}" ]
// WithMinSplitSize is the minimum encoding size in bytes per goroutine. // See WithMaxGoroutines on how jobs are split. // If n <= 0, it is ignored.
[ "WithMinSplitSize", "is", "the", "minimum", "encoding", "size", "in", "bytes", "per", "goroutine", ".", "See", "WithMaxGoroutines", "on", "how", "jobs", "are", "split", ".", "If", "n", "<", "=", "0", "it", "is", "ignored", "." ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/options.go#L66-L72
150,516
klauspost/reedsolomon
options.go
WithPAR1Matrix
func WithPAR1Matrix() Option { return func(o *options) { o.usePAR1Matrix = true o.useCauchy = false } }
go
func WithPAR1Matrix() Option { return func(o *options) { o.usePAR1Matrix = true o.useCauchy = false } }
[ "func", "WithPAR1Matrix", "(", ")", "Option", "{", "return", "func", "(", "o", "*", "options", ")", "{", "o", ".", "usePAR1Matrix", "=", "true", "\n", "o", ".", "useCauchy", "=", "false", "\n", "}", "\n", "}" ]
// WithPAR1Matrix causes the encoder to build the matrix how PARv1 // does. Note that the method they use is buggy, and may lead to cases // where recovery is impossible, even if there are enough parity // shards.
[ "WithPAR1Matrix", "causes", "the", "encoder", "to", "build", "the", "matrix", "how", "PARv1", "does", ".", "Note", "that", "the", "method", "they", "use", "is", "buggy", "and", "may", "lead", "to", "cases", "where", "recovery", "is", "impossible", "even", ...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/options.go#L102-L107
150,517
klauspost/reedsolomon
options.go
WithCauchyMatrix
func WithCauchyMatrix() Option { return func(o *options) { o.useCauchy = true o.usePAR1Matrix = false } }
go
func WithCauchyMatrix() Option { return func(o *options) { o.useCauchy = true o.usePAR1Matrix = false } }
[ "func", "WithCauchyMatrix", "(", ")", "Option", "{", "return", "func", "(", "o", "*", "options", ")", "{", "o", ".", "useCauchy", "=", "true", "\n", "o", ".", "usePAR1Matrix", "=", "false", "\n", "}", "\n", "}" ]
// WithCauchyMatrix will make the encoder build a Cauchy style matrix. // The output of this is not compatible with the standard output. // A Cauchy matrix is faster to generate. This does not affect data throughput, // but will result in slightly faster start-up time.
[ "WithCauchyMatrix", "will", "make", "the", "encoder", "build", "a", "Cauchy", "style", "matrix", ".", "The", "output", "of", "this", "is", "not", "compatible", "with", "the", "standard", "output", ".", "A", "Cauchy", "matrix", "is", "faster", "to", "generate...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/options.go#L113-L118
150,518
klauspost/reedsolomon
reedsolomon.go
buildMatrix
func buildMatrix(dataShards, totalShards int) (matrix, error) { // Start with a Vandermonde matrix. This matrix would work, // in theory, but doesn't have the property that the data // shards are unchanged after encoding. vm, err := vandermonde(totalShards, dataShards) if err != nil { return nil, err } // Mu...
go
func buildMatrix(dataShards, totalShards int) (matrix, error) { // Start with a Vandermonde matrix. This matrix would work, // in theory, but doesn't have the property that the data // shards are unchanged after encoding. vm, err := vandermonde(totalShards, dataShards) if err != nil { return nil, err } // Mu...
[ "func", "buildMatrix", "(", "dataShards", ",", "totalShards", "int", ")", "(", "matrix", ",", "error", ")", "{", "// Start with a Vandermonde matrix. This matrix would work,", "// in theory, but doesn't have the property that the data", "// shards are unchanged after encoding.", "...
// buildMatrix creates the matrix to use for encoding, given the // number of data shards and the number of total shards. // // The top square of the matrix is guaranteed to be an identity // matrix, which means that the data shards are unchanged after // encoding.
[ "buildMatrix", "creates", "the", "matrix", "to", "use", "for", "encoding", "given", "the", "number", "of", "data", "shards", "and", "the", "number", "of", "total", "shards", ".", "The", "top", "square", "of", "the", "matrix", "is", "guaranteed", "to", "be"...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/reedsolomon.go#L133-L157
150,519
klauspost/reedsolomon
reedsolomon.go
buildMatrixPAR1
func buildMatrixPAR1(dataShards, totalShards int) (matrix, error) { result, err := newMatrix(totalShards, dataShards) if err != nil { return nil, err } for r, row := range result { // The top portion of the matrix is the identity // matrix, and the bottom is a transposed Vandermonde // matrix starting at 1...
go
func buildMatrixPAR1(dataShards, totalShards int) (matrix, error) { result, err := newMatrix(totalShards, dataShards) if err != nil { return nil, err } for r, row := range result { // The top portion of the matrix is the identity // matrix, and the bottom is a transposed Vandermonde // matrix starting at 1...
[ "func", "buildMatrixPAR1", "(", "dataShards", ",", "totalShards", "int", ")", "(", "matrix", ",", "error", ")", "{", "result", ",", "err", ":=", "newMatrix", "(", "totalShards", ",", "dataShards", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil"...
// buildMatrixPAR1 creates the matrix to use for encoding according to // the PARv1 spec, given the number of data shards and the number of // total shards. Note that the method they use is buggy, and may lead // to cases where recovery is impossible, even if there are enough // parity shards. // // The top square of t...
[ "buildMatrixPAR1", "creates", "the", "matrix", "to", "use", "for", "encoding", "according", "to", "the", "PARv1", "spec", "given", "the", "number", "of", "data", "shards", "and", "the", "number", "of", "total", "shards", ".", "Note", "that", "the", "method",...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/reedsolomon.go#L168-L187
150,520
klauspost/reedsolomon
reedsolomon.go
New
func New(dataShards, parityShards int, opts ...Option) (Encoder, error) { r := reedSolomon{ DataShards: dataShards, ParityShards: parityShards, Shards: dataShards + parityShards, o: defaultOptions, } for _, opt := range opts { opt(&r.o) } if dataShards <= 0 || parityShards <= 0 { re...
go
func New(dataShards, parityShards int, opts ...Option) (Encoder, error) { r := reedSolomon{ DataShards: dataShards, ParityShards: parityShards, Shards: dataShards + parityShards, o: defaultOptions, } for _, opt := range opts { opt(&r.o) } if dataShards <= 0 || parityShards <= 0 { re...
[ "func", "New", "(", "dataShards", ",", "parityShards", "int", ",", "opts", "...", "Option", ")", "(", "Encoder", ",", "error", ")", "{", "r", ":=", "reedSolomon", "{", "DataShards", ":", "dataShards", ",", "ParityShards", ":", "parityShards", ",", "Shards"...
// New creates a new encoder and initializes it to // the number of data shards and parity shards that // you want to use. You can reuse this encoder. // Note that the maximum number of total shards is 256. // If no options are supplied, default options are used.
[ "New", "creates", "a", "new", "encoder", "and", "initializes", "it", "to", "the", "number", "of", "data", "shards", "and", "parity", "shards", "that", "you", "want", "to", "use", ".", "You", "can", "reuse", "this", "encoder", ".", "Note", "that", "the", ...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/reedsolomon.go#L214-L286
150,521
klauspost/reedsolomon
reedsolomon.go
Encode
func (r reedSolomon) Encode(shards [][]byte) error { if len(shards) != r.Shards { return ErrTooFewShards } err := checkShards(shards, false) if err != nil { return err } // Get the slice of output buffers. output := shards[r.DataShards:] // Do the coding. r.codeSomeShards(r.parity, shards[0:r.DataShards...
go
func (r reedSolomon) Encode(shards [][]byte) error { if len(shards) != r.Shards { return ErrTooFewShards } err := checkShards(shards, false) if err != nil { return err } // Get the slice of output buffers. output := shards[r.DataShards:] // Do the coding. r.codeSomeShards(r.parity, shards[0:r.DataShards...
[ "func", "(", "r", "reedSolomon", ")", "Encode", "(", "shards", "[", "]", "[", "]", "byte", ")", "error", "{", "if", "len", "(", "shards", ")", "!=", "r", ".", "Shards", "{", "return", "ErrTooFewShards", "\n", "}", "\n\n", "err", ":=", "checkShards", ...
// Encodes parity for a set of data shards. // An array 'shards' containing data shards followed by parity shards. // The number of shards must match the number given to New. // Each shard is a byte array, and they must all be the same size. // The parity shards will always be overwritten and the data shards // will re...
[ "Encodes", "parity", "for", "a", "set", "of", "data", "shards", ".", "An", "array", "shards", "containing", "data", "shards", "followed", "by", "parity", "shards", ".", "The", "number", "of", "shards", "must", "match", "the", "number", "given", "to", "New"...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/reedsolomon.go#L299-L315
150,522
klauspost/reedsolomon
reedsolomon.go
Verify
func (r reedSolomon) Verify(shards [][]byte) (bool, error) { if len(shards) != r.Shards { return false, ErrTooFewShards } err := checkShards(shards, false) if err != nil { return false, err } // Slice of buffers being checked. toCheck := shards[r.DataShards:] // Do the checking. return r.checkSomeShards(...
go
func (r reedSolomon) Verify(shards [][]byte) (bool, error) { if len(shards) != r.Shards { return false, ErrTooFewShards } err := checkShards(shards, false) if err != nil { return false, err } // Slice of buffers being checked. toCheck := shards[r.DataShards:] // Do the checking. return r.checkSomeShards(...
[ "func", "(", "r", "reedSolomon", ")", "Verify", "(", "shards", "[", "]", "[", "]", "byte", ")", "(", "bool", ",", "error", ")", "{", "if", "len", "(", "shards", ")", "!=", "r", ".", "Shards", "{", "return", "false", ",", "ErrTooFewShards", "\n", ...
// Verify returns true if the parity shards contain the right data. // The data is the same format as Encode. No data is modified.
[ "Verify", "returns", "true", "if", "the", "parity", "shards", "contain", "the", "right", "data", ".", "The", "data", "is", "the", "same", "format", "as", "Encode", ".", "No", "data", "is", "modified", "." ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/reedsolomon.go#L414-L428
150,523
klauspost/reedsolomon
reedsolomon.go
codeSomeShards
func (r reedSolomon) codeSomeShards(matrixRows, inputs, outputs [][]byte, outputCount, byteCount int) { if r.o.useAVX512 && len(inputs) >= 4 && len(outputs) >= 2 { r.codeSomeShardsAvx512(matrixRows, inputs, outputs, outputCount, byteCount) return } else if r.o.maxGoroutines > 1 && byteCount > r.o.minSplitSize { ...
go
func (r reedSolomon) codeSomeShards(matrixRows, inputs, outputs [][]byte, outputCount, byteCount int) { if r.o.useAVX512 && len(inputs) >= 4 && len(outputs) >= 2 { r.codeSomeShardsAvx512(matrixRows, inputs, outputs, outputCount, byteCount) return } else if r.o.maxGoroutines > 1 && byteCount > r.o.minSplitSize { ...
[ "func", "(", "r", "reedSolomon", ")", "codeSomeShards", "(", "matrixRows", ",", "inputs", ",", "outputs", "[", "]", "[", "]", "byte", ",", "outputCount", ",", "byteCount", "int", ")", "{", "if", "r", ".", "o", ".", "useAVX512", "&&", "len", "(", "inp...
// Multiplies a subset of rows from a coding matrix by a full set of // input shards to produce some output shards. // 'matrixRows' is The rows from the matrix to use. // 'inputs' An array of byte arrays, each of which is one input shard. // The number of inputs used is determined by the length of each matrix row. // o...
[ "Multiplies", "a", "subset", "of", "rows", "from", "a", "coding", "matrix", "by", "a", "full", "set", "of", "input", "shards", "to", "produce", "some", "output", "shards", ".", "matrixRows", "is", "The", "rows", "from", "the", "matrix", "to", "use", ".",...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/reedsolomon.go#L439-L457
150,524
klauspost/reedsolomon
reedsolomon.go
codeSomeShardsP
func (r reedSolomon) codeSomeShardsP(matrixRows, inputs, outputs [][]byte, outputCount, byteCount int) { var wg sync.WaitGroup do := byteCount / r.o.maxGoroutines if do < r.o.minSplitSize { do = r.o.minSplitSize } // Make sizes divisible by 32 do = (do + 31) & (^31) start := 0 for start < byteCount { if sta...
go
func (r reedSolomon) codeSomeShardsP(matrixRows, inputs, outputs [][]byte, outputCount, byteCount int) { var wg sync.WaitGroup do := byteCount / r.o.maxGoroutines if do < r.o.minSplitSize { do = r.o.minSplitSize } // Make sizes divisible by 32 do = (do + 31) & (^31) start := 0 for start < byteCount { if sta...
[ "func", "(", "r", "reedSolomon", ")", "codeSomeShardsP", "(", "matrixRows", ",", "inputs", ",", "outputs", "[", "]", "[", "]", "byte", ",", "outputCount", ",", "byteCount", "int", ")", "{", "var", "wg", "sync", ".", "WaitGroup", "\n", "do", ":=", "byte...
// Perform the same as codeSomeShards, but split the workload into // several goroutines.
[ "Perform", "the", "same", "as", "codeSomeShards", "but", "split", "the", "workload", "into", "several", "goroutines", "." ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/reedsolomon.go#L461-L491
150,525
klauspost/reedsolomon
reedsolomon.go
checkSomeShards
func (r reedSolomon) checkSomeShards(matrixRows, inputs, toCheck [][]byte, outputCount, byteCount int) bool { if r.o.maxGoroutines > 1 && byteCount > r.o.minSplitSize { return r.checkSomeShardsP(matrixRows, inputs, toCheck, outputCount, byteCount) } outputs := make([][]byte, len(toCheck)) for i := range outputs {...
go
func (r reedSolomon) checkSomeShards(matrixRows, inputs, toCheck [][]byte, outputCount, byteCount int) bool { if r.o.maxGoroutines > 1 && byteCount > r.o.minSplitSize { return r.checkSomeShardsP(matrixRows, inputs, toCheck, outputCount, byteCount) } outputs := make([][]byte, len(toCheck)) for i := range outputs {...
[ "func", "(", "r", "reedSolomon", ")", "checkSomeShards", "(", "matrixRows", ",", "inputs", ",", "toCheck", "[", "]", "[", "]", "byte", ",", "outputCount", ",", "byteCount", "int", ")", "bool", "{", "if", "r", ".", "o", ".", "maxGoroutines", ">", "1", ...
// checkSomeShards is mostly the same as codeSomeShards, // except this will check values and return // as soon as a difference is found.
[ "checkSomeShards", "is", "mostly", "the", "same", "as", "codeSomeShards", "except", "this", "will", "check", "values", "and", "return", "as", "soon", "as", "a", "difference", "is", "found", "." ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/reedsolomon.go#L496-L517
150,526
klauspost/reedsolomon
reedsolomon.go
checkShards
func checkShards(shards [][]byte, nilok bool) error { size := shardSize(shards) if size == 0 { return ErrShardNoData } for _, shard := range shards { if len(shard) != size { if len(shard) != 0 || !nilok { return ErrShardSize } } } return nil }
go
func checkShards(shards [][]byte, nilok bool) error { size := shardSize(shards) if size == 0 { return ErrShardNoData } for _, shard := range shards { if len(shard) != size { if len(shard) != 0 || !nilok { return ErrShardSize } } } return nil }
[ "func", "checkShards", "(", "shards", "[", "]", "[", "]", "byte", ",", "nilok", "bool", ")", "error", "{", "size", ":=", "shardSize", "(", "shards", ")", "\n", "if", "size", "==", "0", "{", "return", "ErrShardNoData", "\n", "}", "\n", "for", "_", "...
// checkShards will check if shards are the same size // or 0, if allowed. An error is returned if this fails. // An error is also returned if all shards are size 0.
[ "checkShards", "will", "check", "if", "shards", "are", "the", "same", "size", "or", "0", "if", "allowed", ".", "An", "error", "is", "returned", "if", "this", "fails", ".", "An", "error", "is", "also", "returned", "if", "all", "shards", "are", "size", "...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/reedsolomon.go#L581-L594
150,527
klauspost/reedsolomon
reedsolomon.go
shardSize
func shardSize(shards [][]byte) int { for _, shard := range shards { if len(shard) != 0 { return len(shard) } } return 0 }
go
func shardSize(shards [][]byte) int { for _, shard := range shards { if len(shard) != 0 { return len(shard) } } return 0 }
[ "func", "shardSize", "(", "shards", "[", "]", "[", "]", "byte", ")", "int", "{", "for", "_", ",", "shard", ":=", "range", "shards", "{", "if", "len", "(", "shard", ")", "!=", "0", "{", "return", "len", "(", "shard", ")", "\n", "}", "\n", "}", ...
// shardSize return the size of a single shard. // The first non-zero size is returned, // or 0 if all shards are size 0.
[ "shardSize", "return", "the", "size", "of", "a", "single", "shard", ".", "The", "first", "non", "-", "zero", "size", "is", "returned", "or", "0", "if", "all", "shards", "are", "size", "0", "." ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/reedsolomon.go#L599-L606
150,528
klauspost/reedsolomon
reedsolomon.go
Split
func (r reedSolomon) Split(data []byte) ([][]byte, error) { if len(data) == 0 { return nil, ErrShortData } // Calculate number of bytes per data shard. perShard := (len(data) + r.DataShards - 1) / r.DataShards if cap(data) > len(data) { data = data[:cap(data)] } // Only allocate memory if necessary if len...
go
func (r reedSolomon) Split(data []byte) ([][]byte, error) { if len(data) == 0 { return nil, ErrShortData } // Calculate number of bytes per data shard. perShard := (len(data) + r.DataShards - 1) / r.DataShards if cap(data) > len(data) { data = data[:cap(data)] } // Only allocate memory if necessary if len...
[ "func", "(", "r", "reedSolomon", ")", "Split", "(", "data", "[", "]", "byte", ")", "(", "[", "]", "[", "]", "byte", ",", "error", ")", "{", "if", "len", "(", "data", ")", "==", "0", "{", "return", "nil", ",", "ErrShortData", "\n", "}", "\n", ...
// Split a data slice into the number of shards given to the encoder, // and create empty parity shards if necessary. // // The data will be split into equally sized shards. // If the data size isn't divisible by the number of shards, // the last shard will contain extra zeros. // // There must be at least 1 byte other...
[ "Split", "a", "data", "slice", "into", "the", "number", "of", "shards", "given", "to", "the", "encoder", "and", "create", "empty", "parity", "shards", "if", "necessary", ".", "The", "data", "will", "be", "split", "into", "equally", "sized", "shards", ".", ...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/reedsolomon.go#L809-L835
150,529
klauspost/reedsolomon
reedsolomon.go
Join
func (r reedSolomon) Join(dst io.Writer, shards [][]byte, outSize int) error { // Do we have enough shards? if len(shards) < r.DataShards { return ErrTooFewShards } shards = shards[:r.DataShards] // Do we have enough data? size := 0 for _, shard := range shards { if shard == nil { return ErrReconstructRe...
go
func (r reedSolomon) Join(dst io.Writer, shards [][]byte, outSize int) error { // Do we have enough shards? if len(shards) < r.DataShards { return ErrTooFewShards } shards = shards[:r.DataShards] // Do we have enough data? size := 0 for _, shard := range shards { if shard == nil { return ErrReconstructRe...
[ "func", "(", "r", "reedSolomon", ")", "Join", "(", "dst", "io", ".", "Writer", ",", "shards", "[", "]", "[", "]", "byte", ",", "outSize", "int", ")", "error", "{", "// Do we have enough shards?", "if", "len", "(", "shards", ")", "<", "r", ".", "DataS...
// Join the shards and write the data segment to dst. // // Only the data shards are considered. // You must supply the exact output size you want. // // If there are to few shards given, ErrTooFewShards will be returned. // If the total data size is less than outSize, ErrShortData will be returned. // If one or more r...
[ "Join", "the", "shards", "and", "write", "the", "data", "segment", "to", "dst", ".", "Only", "the", "data", "shards", "are", "considered", ".", "You", "must", "supply", "the", "exact", "output", "size", "you", "want", ".", "If", "there", "are", "to", "...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/reedsolomon.go#L849-L887
150,530
klauspost/reedsolomon
gentables.go
generateExpTable
func generateExpTable() []byte { result := make([]byte, fieldSize*2-2) for i := 1; i < fieldSize; i++ { log := logTable[i] result[log] = byte(i) result[log+fieldSize-1] = byte(i) } return result }
go
func generateExpTable() []byte { result := make([]byte, fieldSize*2-2) for i := 1; i < fieldSize; i++ { log := logTable[i] result[log] = byte(i) result[log+fieldSize-1] = byte(i) } return result }
[ "func", "generateExpTable", "(", ")", "[", "]", "byte", "{", "result", ":=", "make", "(", "[", "]", "byte", ",", "fieldSize", "*", "2", "-", "2", ")", "\n", "for", "i", ":=", "1", ";", "i", "<", "fieldSize", ";", "i", "++", "{", "log", ":=", ...
/** * Generates the inverse log table. */
[ "Generates", "the", "inverse", "log", "table", "." ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/gentables.go#L72-L80
150,531
klauspost/reedsolomon
matrix.go
newMatrix
func newMatrix(rows, cols int) (matrix, error) { if rows <= 0 { return nil, errInvalidRowSize } if cols <= 0 { return nil, errInvalidColSize } m := matrix(make([][]byte, rows)) for i := range m { m[i] = make([]byte, cols) } return m, nil }
go
func newMatrix(rows, cols int) (matrix, error) { if rows <= 0 { return nil, errInvalidRowSize } if cols <= 0 { return nil, errInvalidColSize } m := matrix(make([][]byte, rows)) for i := range m { m[i] = make([]byte, cols) } return m, nil }
[ "func", "newMatrix", "(", "rows", ",", "cols", "int", ")", "(", "matrix", ",", "error", ")", "{", "if", "rows", "<=", "0", "{", "return", "nil", ",", "errInvalidRowSize", "\n", "}", "\n", "if", "cols", "<=", "0", "{", "return", "nil", ",", "errInva...
// newMatrix returns a matrix of zeros.
[ "newMatrix", "returns", "a", "matrix", "of", "zeros", "." ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/matrix.go#L21-L34
150,532
klauspost/reedsolomon
matrix.go
newMatrixData
func newMatrixData(data [][]byte) (matrix, error) { m := matrix(data) err := m.Check() if err != nil { return nil, err } return m, nil }
go
func newMatrixData(data [][]byte) (matrix, error) { m := matrix(data) err := m.Check() if err != nil { return nil, err } return m, nil }
[ "func", "newMatrixData", "(", "data", "[", "]", "[", "]", "byte", ")", "(", "matrix", ",", "error", ")", "{", "m", ":=", "matrix", "(", "data", ")", "\n", "err", ":=", "m", ".", "Check", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// NewMatrixData initializes a matrix with the given row-major data. // Note that data is not copied from input.
[ "NewMatrixData", "initializes", "a", "matrix", "with", "the", "given", "row", "-", "major", "data", ".", "Note", "that", "data", "is", "not", "copied", "from", "input", "." ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/matrix.go#L38-L45
150,533
klauspost/reedsolomon
matrix.go
identityMatrix
func identityMatrix(size int) (matrix, error) { m, err := newMatrix(size, size) if err != nil { return nil, err } for i := range m { m[i][i] = 1 } return m, nil }
go
func identityMatrix(size int) (matrix, error) { m, err := newMatrix(size, size) if err != nil { return nil, err } for i := range m { m[i][i] = 1 } return m, nil }
[ "func", "identityMatrix", "(", "size", "int", ")", "(", "matrix", ",", "error", ")", "{", "m", ",", "err", ":=", "newMatrix", "(", "size", ",", "size", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "for",...
// IdentityMatrix returns an identity matrix of the given size.
[ "IdentityMatrix", "returns", "an", "identity", "matrix", "of", "the", "given", "size", "." ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/matrix.go#L48-L57
150,534
klauspost/reedsolomon
matrix.go
Augment
func (m matrix) Augment(right matrix) (matrix, error) { if len(m) != len(right) { return nil, errMatrixSize } result, _ := newMatrix(len(m), len(m[0])+len(right[0])) for r, row := range m { for c := range row { result[r][c] = m[r][c] } cols := len(m[0]) for c := range right[0] { result[r][cols+c] =...
go
func (m matrix) Augment(right matrix) (matrix, error) { if len(m) != len(right) { return nil, errMatrixSize } result, _ := newMatrix(len(m), len(m[0])+len(right[0])) for r, row := range m { for c := range row { result[r][c] = m[r][c] } cols := len(m[0]) for c := range right[0] { result[r][cols+c] =...
[ "func", "(", "m", "matrix", ")", "Augment", "(", "right", "matrix", ")", "(", "matrix", ",", "error", ")", "{", "if", "len", "(", "m", ")", "!=", "len", "(", "right", ")", "{", "return", "nil", ",", "errMatrixSize", "\n", "}", "\n\n", "result", "...
// Augment returns the concatenation of this matrix and the matrix on the right.
[ "Augment", "returns", "the", "concatenation", "of", "this", "matrix", "and", "the", "matrix", "on", "the", "right", "." ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/matrix.go#L121-L137
150,535
klauspost/reedsolomon
matrix.go
SubMatrix
func (m matrix) SubMatrix(rmin, cmin, rmax, cmax int) (matrix, error) { result, err := newMatrix(rmax-rmin, cmax-cmin) if err != nil { return nil, err } // OPTME: If used heavily, use copy function to copy slice for r := rmin; r < rmax; r++ { for c := cmin; c < cmax; c++ { result[r-rmin][c-cmin] = m[r][c] ...
go
func (m matrix) SubMatrix(rmin, cmin, rmax, cmax int) (matrix, error) { result, err := newMatrix(rmax-rmin, cmax-cmin) if err != nil { return nil, err } // OPTME: If used heavily, use copy function to copy slice for r := rmin; r < rmax; r++ { for c := cmin; c < cmax; c++ { result[r-rmin][c-cmin] = m[r][c] ...
[ "func", "(", "m", "matrix", ")", "SubMatrix", "(", "rmin", ",", "cmin", ",", "rmax", ",", "cmax", "int", ")", "(", "matrix", ",", "error", ")", "{", "result", ",", "err", ":=", "newMatrix", "(", "rmax", "-", "rmin", ",", "cmax", "-", "cmin", ")",...
// SubMatrix returns a part of this matrix. Data is copied.
[ "SubMatrix", "returns", "a", "part", "of", "this", "matrix", ".", "Data", "is", "copied", "." ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/matrix.go#L155-L167
150,536
klauspost/reedsolomon
matrix.go
SwapRows
func (m matrix) SwapRows(r1, r2 int) error { if r1 < 0 || len(m) <= r1 || r2 < 0 || len(m) <= r2 { return errInvalidRowSize } m[r2], m[r1] = m[r1], m[r2] return nil }
go
func (m matrix) SwapRows(r1, r2 int) error { if r1 < 0 || len(m) <= r1 || r2 < 0 || len(m) <= r2 { return errInvalidRowSize } m[r2], m[r1] = m[r1], m[r2] return nil }
[ "func", "(", "m", "matrix", ")", "SwapRows", "(", "r1", ",", "r2", "int", ")", "error", "{", "if", "r1", "<", "0", "||", "len", "(", "m", ")", "<=", "r1", "||", "r2", "<", "0", "||", "len", "(", "m", ")", "<=", "r2", "{", "return", "errInva...
// SwapRows Exchanges two rows in the matrix.
[ "SwapRows", "Exchanges", "two", "rows", "in", "the", "matrix", "." ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/matrix.go#L170-L176
150,537
klauspost/reedsolomon
matrix.go
Invert
func (m matrix) Invert() (matrix, error) { if !m.IsSquare() { return nil, errNotSquare } size := len(m) work, _ := identityMatrix(size) work, _ = m.Augment(work) err := work.gaussianElimination() if err != nil { return nil, err } return work.SubMatrix(0, size, size, size*2) }
go
func (m matrix) Invert() (matrix, error) { if !m.IsSquare() { return nil, errNotSquare } size := len(m) work, _ := identityMatrix(size) work, _ = m.Augment(work) err := work.gaussianElimination() if err != nil { return nil, err } return work.SubMatrix(0, size, size, size*2) }
[ "func", "(", "m", "matrix", ")", "Invert", "(", ")", "(", "matrix", ",", "error", ")", "{", "if", "!", "m", ".", "IsSquare", "(", ")", "{", "return", "nil", ",", "errNotSquare", "\n", "}", "\n\n", "size", ":=", "len", "(", "m", ")", "\n", "work...
// Invert returns the inverse of this matrix. // Returns ErrSingular when the matrix is singular and doesn't have an inverse. // The matrix must be square, otherwise ErrNotSquare is returned.
[ "Invert", "returns", "the", "inverse", "of", "this", "matrix", ".", "Returns", "ErrSingular", "when", "the", "matrix", "is", "singular", "and", "doesn", "t", "have", "an", "inverse", ".", "The", "matrix", "must", "be", "square", "otherwise", "ErrNotSquare", ...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/matrix.go#L193-L208
150,538
klauspost/reedsolomon
matrix.go
vandermonde
func vandermonde(rows, cols int) (matrix, error) { result, err := newMatrix(rows, cols) if err != nil { return nil, err } for r, row := range result { for c := range row { result[r][c] = galExp(byte(r), c) } } return result, nil }
go
func vandermonde(rows, cols int) (matrix, error) { result, err := newMatrix(rows, cols) if err != nil { return nil, err } for r, row := range result { for c := range row { result[r][c] = galExp(byte(r), c) } } return result, nil }
[ "func", "vandermonde", "(", "rows", ",", "cols", "int", ")", "(", "matrix", ",", "error", ")", "{", "result", ",", "err", ":=", "newMatrix", "(", "rows", ",", "cols", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}...
// Create a Vandermonde matrix, which is guaranteed to have the // property that any subset of rows that forms a square matrix // is invertible.
[ "Create", "a", "Vandermonde", "matrix", "which", "is", "guaranteed", "to", "have", "the", "property", "that", "any", "subset", "of", "rows", "that", "forms", "a", "square", "matrix", "is", "invertible", "." ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/matrix.go#L268-L279
150,539
klauspost/reedsolomon
inversion_tree.go
newInversionTree
func newInversionTree(dataShards, parityShards int) inversionTree { identity, _ := identityMatrix(dataShards) root := inversionNode{ matrix: identity, children: make([]*inversionNode, dataShards+parityShards), } return inversionTree{ mutex: &sync.RWMutex{}, root: root, } }
go
func newInversionTree(dataShards, parityShards int) inversionTree { identity, _ := identityMatrix(dataShards) root := inversionNode{ matrix: identity, children: make([]*inversionNode, dataShards+parityShards), } return inversionTree{ mutex: &sync.RWMutex{}, root: root, } }
[ "func", "newInversionTree", "(", "dataShards", ",", "parityShards", "int", ")", "inversionTree", "{", "identity", ",", "_", ":=", "identityMatrix", "(", "dataShards", ")", "\n", "root", ":=", "inversionNode", "{", "matrix", ":", "identity", ",", "children", ":...
// newInversionTree initializes a tree for storing inverted matrices. // Note that the root node is the identity matrix as it implies // there were no errors with the original data.
[ "newInversionTree", "initializes", "a", "tree", "for", "storing", "inverted", "matrices", ".", "Note", "that", "the", "root", "node", "is", "the", "identity", "matrix", "as", "it", "implies", "there", "were", "no", "errors", "with", "the", "original", "data", ...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/inversion_tree.go#L29-L39
150,540
klauspost/reedsolomon
inversion_tree.go
GetInvertedMatrix
func (t inversionTree) GetInvertedMatrix(invalidIndices []int) matrix { // Lock the tree for reading before accessing the tree. t.mutex.RLock() defer t.mutex.RUnlock() // If no invalid indices were give we should return the root // identity matrix. if len(invalidIndices) == 0 { return t.root.matrix } // Rec...
go
func (t inversionTree) GetInvertedMatrix(invalidIndices []int) matrix { // Lock the tree for reading before accessing the tree. t.mutex.RLock() defer t.mutex.RUnlock() // If no invalid indices were give we should return the root // identity matrix. if len(invalidIndices) == 0 { return t.root.matrix } // Rec...
[ "func", "(", "t", "inversionTree", ")", "GetInvertedMatrix", "(", "invalidIndices", "[", "]", "int", ")", "matrix", "{", "// Lock the tree for reading before accessing the tree.", "t", ".", "mutex", ".", "RLock", "(", ")", "\n", "defer", "t", ".", "mutex", ".", ...
// GetInvertedMatrix returns the cached inverted matrix or nil if it // is not found in the tree keyed on the indices of invalid rows.
[ "GetInvertedMatrix", "returns", "the", "cached", "inverted", "matrix", "or", "nil", "if", "it", "is", "not", "found", "in", "the", "tree", "keyed", "on", "the", "indices", "of", "invalid", "rows", "." ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/inversion_tree.go#L43-L57
150,541
klauspost/reedsolomon
inversion_tree.go
InsertInvertedMatrix
func (t inversionTree) InsertInvertedMatrix(invalidIndices []int, matrix matrix, shards int) error { // If no invalid indices were given then we are done because the // root node is already set with the identity matrix. if len(invalidIndices) == 0 { return errAlreadySet } if !matrix.IsSquare() { return errNot...
go
func (t inversionTree) InsertInvertedMatrix(invalidIndices []int, matrix matrix, shards int) error { // If no invalid indices were given then we are done because the // root node is already set with the identity matrix. if len(invalidIndices) == 0 { return errAlreadySet } if !matrix.IsSquare() { return errNot...
[ "func", "(", "t", "inversionTree", ")", "InsertInvertedMatrix", "(", "invalidIndices", "[", "]", "int", ",", "matrix", "matrix", ",", "shards", "int", ")", "error", "{", "// If no invalid indices were given then we are done because the", "// root node is already set with th...
// InsertInvertedMatrix inserts a new inverted matrix into the tree // keyed by the indices of invalid rows. The total number of shards // is required for creating the proper length lists of child nodes for // each node.
[ "InsertInvertedMatrix", "inserts", "a", "new", "inverted", "matrix", "into", "the", "tree", "keyed", "by", "the", "indices", "of", "invalid", "rows", ".", "The", "total", "number", "of", "shards", "is", "required", "for", "creating", "the", "proper", "length",...
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/inversion_tree.go#L66-L87
150,542
klauspost/reedsolomon
galoisAvx512_amd64.go
setupMatrix82
func setupMatrix82(matrixRows [][]byte, inputOffset, outputOffset int, matrix *[matrixSize82]byte) { offset := 0 for c := inputOffset; c < inputOffset+dimIn; c++ { for iRow := outputOffset; iRow < outputOffset+dimOut82; iRow++ { if c < len(matrixRows[iRow]) { coeff := matrixRows[iRow][c] copy(matrix[offs...
go
func setupMatrix82(matrixRows [][]byte, inputOffset, outputOffset int, matrix *[matrixSize82]byte) { offset := 0 for c := inputOffset; c < inputOffset+dimIn; c++ { for iRow := outputOffset; iRow < outputOffset+dimOut82; iRow++ { if c < len(matrixRows[iRow]) { coeff := matrixRows[iRow][c] copy(matrix[offs...
[ "func", "setupMatrix82", "(", "matrixRows", "[", "]", "[", "]", "byte", ",", "inputOffset", ",", "outputOffset", "int", ",", "matrix", "*", "[", "matrixSize82", "]", "byte", ")", "{", "offset", ":=", "0", "\n", "for", "c", ":=", "inputOffset", ";", "c"...
// Construct block of matrix coefficients for 2 outputs rows in parallel
[ "Construct", "block", "of", "matrix", "coefficients", "for", "2", "outputs", "rows", "in", "parallel" ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/galoisAvx512_amd64.go#L25-L46
150,543
klauspost/reedsolomon
galoisAvx512_amd64.go
setupMatrix84
func setupMatrix84(matrixRows [][]byte, inputOffset, outputOffset int, matrix *[matrixSize84]byte) { offset := 0 for c := inputOffset; c < inputOffset+dimIn; c++ { for iRow := outputOffset; iRow < outputOffset+dimOut84; iRow++ { if c < len(matrixRows[iRow]) { coeff := matrixRows[iRow][c] copy(matrix[offs...
go
func setupMatrix84(matrixRows [][]byte, inputOffset, outputOffset int, matrix *[matrixSize84]byte) { offset := 0 for c := inputOffset; c < inputOffset+dimIn; c++ { for iRow := outputOffset; iRow < outputOffset+dimOut84; iRow++ { if c < len(matrixRows[iRow]) { coeff := matrixRows[iRow][c] copy(matrix[offs...
[ "func", "setupMatrix84", "(", "matrixRows", "[", "]", "[", "]", "byte", ",", "inputOffset", ",", "outputOffset", "int", ",", "matrix", "*", "[", "matrixSize84", "]", "byte", ")", "{", "offset", ":=", "0", "\n", "for", "c", ":=", "inputOffset", ";", "c"...
// Construct block of matrix coefficients for 4 outputs rows in parallel
[ "Construct", "block", "of", "matrix", "coefficients", "for", "4", "outputs", "rows", "in", "parallel" ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/galoisAvx512_amd64.go#L49-L70
150,544
klauspost/reedsolomon
galoisAvx512_amd64.go
galMulAVX512Parallel82
func galMulAVX512Parallel82(in, out [][]byte, matrixRows [][]byte, inputOffset, outputOffset int) { done := len(in[0]) if done == 0 { return } inputEnd := inputOffset + dimIn if inputEnd > len(in) { inputEnd = len(in) } outputEnd := outputOffset + dimOut82 if outputEnd > len(out) { outputEnd = len(out) ...
go
func galMulAVX512Parallel82(in, out [][]byte, matrixRows [][]byte, inputOffset, outputOffset int) { done := len(in[0]) if done == 0 { return } inputEnd := inputOffset + dimIn if inputEnd > len(in) { inputEnd = len(in) } outputEnd := outputOffset + dimOut82 if outputEnd > len(out) { outputEnd = len(out) ...
[ "func", "galMulAVX512Parallel82", "(", "in", ",", "out", "[", "]", "[", "]", "byte", ",", "matrixRows", "[", "]", "[", "]", "byte", ",", "inputOffset", ",", "outputOffset", "int", ")", "{", "done", ":=", "len", "(", "in", "[", "0", "]", ")", "\n", ...
// Invoke AVX512 routine for 2 output rows in parallel
[ "Invoke", "AVX512", "routine", "for", "2", "output", "rows", "in", "parallel" ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/galoisAvx512_amd64.go#L73-L112
150,545
klauspost/reedsolomon
galoisAvx512_amd64.go
galMulAVX512Parallel84
func galMulAVX512Parallel84(in, out [][]byte, matrixRows [][]byte, inputOffset, outputOffset int) { done := len(in[0]) if done == 0 { return } inputEnd := inputOffset + dimIn if inputEnd > len(in) { inputEnd = len(in) } outputEnd := outputOffset + dimOut84 if outputEnd > len(out) { outputEnd = len(out) ...
go
func galMulAVX512Parallel84(in, out [][]byte, matrixRows [][]byte, inputOffset, outputOffset int) { done := len(in[0]) if done == 0 { return } inputEnd := inputOffset + dimIn if inputEnd > len(in) { inputEnd = len(in) } outputEnd := outputOffset + dimOut84 if outputEnd > len(out) { outputEnd = len(out) ...
[ "func", "galMulAVX512Parallel84", "(", "in", ",", "out", "[", "]", "[", "]", "byte", ",", "matrixRows", "[", "]", "[", "]", "byte", ",", "inputOffset", ",", "outputOffset", "int", ")", "{", "done", ":=", "len", "(", "in", "[", "0", "]", ")", "\n", ...
// Invoke AVX512 routine for 4 output rows in parallel
[ "Invoke", "AVX512", "routine", "for", "4", "output", "rows", "in", "parallel" ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/galoisAvx512_amd64.go#L115-L154
150,546
klauspost/reedsolomon
galoisAvx512_amd64.go
codeSomeShardsAvx512
func (r reedSolomon) codeSomeShardsAvx512(matrixRows, inputs, outputs [][]byte, outputCount, byteCount int) { outputRow := 0 // First process (multiple) batches of 4 output rows in parallel for ; outputRow+dimOut84 <= len(outputs); outputRow += dimOut84 { for inputRow := 0; inputRow < len(inputs); inputRow += dimI...
go
func (r reedSolomon) codeSomeShardsAvx512(matrixRows, inputs, outputs [][]byte, outputCount, byteCount int) { outputRow := 0 // First process (multiple) batches of 4 output rows in parallel for ; outputRow+dimOut84 <= len(outputs); outputRow += dimOut84 { for inputRow := 0; inputRow < len(inputs); inputRow += dimI...
[ "func", "(", "r", "reedSolomon", ")", "codeSomeShardsAvx512", "(", "matrixRows", ",", "inputs", ",", "outputs", "[", "]", "[", "]", "byte", ",", "outputCount", ",", "byteCount", "int", ")", "{", "outputRow", ":=", "0", "\n", "// First process (multiple) batche...
// Perform the same as codeSomeShards, but taking advantage of // AVX512 parallelism for up to 4x faster execution as compared to AVX2
[ "Perform", "the", "same", "as", "codeSomeShards", "but", "taking", "advantage", "of", "AVX512", "parallelism", "for", "up", "to", "4x", "faster", "execution", "as", "compared", "to", "AVX2" ]
a373324398e4d088b67d6dd6157285b5d4e29642
https://github.com/klauspost/reedsolomon/blob/a373324398e4d088b67d6dd6157285b5d4e29642/galoisAvx512_amd64.go#L158-L184
150,547
gocraft/dbr
union.go
Union
func Union(builder ...Builder) interface { Builder As(string) Builder } { return &union{ builder: builder, } }
go
func Union(builder ...Builder) interface { Builder As(string) Builder } { return &union{ builder: builder, } }
[ "func", "Union", "(", "builder", "...", "Builder", ")", "interface", "{", "Builder", "\n", "As", "(", "string", ")", "Builder", "\n", "}", "{", "return", "&", "union", "{", "builder", ":", "builder", ",", "}", "\n", "}" ]
// Union builds `... UNION ...`.
[ "Union", "builds", "...", "UNION", "...", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/union.go#L9-L16
150,548
gocraft/dbr
union.go
UnionAll
func UnionAll(builder ...Builder) interface { Builder As(string) Builder } { return &union{ builder: builder, all: true, } }
go
func UnionAll(builder ...Builder) interface { Builder As(string) Builder } { return &union{ builder: builder, all: true, } }
[ "func", "UnionAll", "(", "builder", "...", "Builder", ")", "interface", "{", "Builder", "\n", "As", "(", "string", ")", "Builder", "\n", "}", "{", "return", "&", "union", "{", "builder", ":", "builder", ",", "all", ":", "true", ",", "}", "\n", "}" ]
// UnionAll builds `... UNION ALL ...`.
[ "UnionAll", "builds", "...", "UNION", "ALL", "...", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/union.go#L19-L27
150,549
gocraft/dbr
select.go
Where
func (b *SelectStmt) Where(query interface{}, value ...interface{}) *SelectStmt { switch query := query.(type) { case string: b.WhereCond = append(b.WhereCond, Expr(query, value...)) case Builder: b.WhereCond = append(b.WhereCond, query) } return b }
go
func (b *SelectStmt) Where(query interface{}, value ...interface{}) *SelectStmt { switch query := query.(type) { case string: b.WhereCond = append(b.WhereCond, Expr(query, value...)) case Builder: b.WhereCond = append(b.WhereCond, query) } return b }
[ "func", "(", "b", "*", "SelectStmt", ")", "Where", "(", "query", "interface", "{", "}", ",", "value", "...", "interface", "{", "}", ")", "*", "SelectStmt", "{", "switch", "query", ":=", "query", ".", "(", "type", ")", "{", "case", "string", ":", "b...
// Where adds a where condition. // query can be Builder or string. value is used only if query type is string.
[ "Where", "adds", "a", "where", "condition", ".", "query", "can", "be", "Builder", "or", "string", ".", "value", "is", "used", "only", "if", "query", "type", "is", "string", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select.go#L216-L224
150,550
gocraft/dbr
select.go
Having
func (b *SelectStmt) Having(query interface{}, value ...interface{}) *SelectStmt { switch query := query.(type) { case string: b.HavingCond = append(b.HavingCond, Expr(query, value...)) case Builder: b.HavingCond = append(b.HavingCond, query) } return b }
go
func (b *SelectStmt) Having(query interface{}, value ...interface{}) *SelectStmt { switch query := query.(type) { case string: b.HavingCond = append(b.HavingCond, Expr(query, value...)) case Builder: b.HavingCond = append(b.HavingCond, query) } return b }
[ "func", "(", "b", "*", "SelectStmt", ")", "Having", "(", "query", "interface", "{", "}", ",", "value", "...", "interface", "{", "}", ")", "*", "SelectStmt", "{", "switch", "query", ":=", "query", ".", "(", "type", ")", "{", "case", "string", ":", "...
// Having adds a having condition. // query can be Builder or string. value is used only if query type is string.
[ "Having", "adds", "a", "having", "condition", ".", "query", "can", "be", "Builder", "or", "string", ".", "value", "is", "used", "only", "if", "query", "type", "is", "string", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select.go#L228-L236
150,551
gocraft/dbr
select.go
GroupBy
func (b *SelectStmt) GroupBy(col ...string) *SelectStmt { for _, group := range col { b.Group = append(b.Group, Expr(group)) } return b }
go
func (b *SelectStmt) GroupBy(col ...string) *SelectStmt { for _, group := range col { b.Group = append(b.Group, Expr(group)) } return b }
[ "func", "(", "b", "*", "SelectStmt", ")", "GroupBy", "(", "col", "...", "string", ")", "*", "SelectStmt", "{", "for", "_", ",", "group", ":=", "range", "col", "{", "b", ".", "Group", "=", "append", "(", "b", ".", "Group", ",", "Expr", "(", "group...
// GroupBy specifies columns for grouping.
[ "GroupBy", "specifies", "columns", "for", "grouping", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select.go#L239-L244
150,552
gocraft/dbr
select.go
OrderBy
func (b *SelectStmt) OrderBy(col string) *SelectStmt { b.Order = append(b.Order, Expr(col)) return b }
go
func (b *SelectStmt) OrderBy(col string) *SelectStmt { b.Order = append(b.Order, Expr(col)) return b }
[ "func", "(", "b", "*", "SelectStmt", ")", "OrderBy", "(", "col", "string", ")", "*", "SelectStmt", "{", "b", ".", "Order", "=", "append", "(", "b", ".", "Order", ",", "Expr", "(", "col", ")", ")", "\n", "return", "b", "\n", "}" ]
// OrderBy specifies columns for ordering.
[ "OrderBy", "specifies", "columns", "for", "ordering", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select.go#L257-L260
150,553
gocraft/dbr
select.go
Paginate
func (b *SelectStmt) Paginate(page, perPage uint64) *SelectStmt { b.Limit(perPage) b.Offset((page - 1) * perPage) return b }
go
func (b *SelectStmt) Paginate(page, perPage uint64) *SelectStmt { b.Limit(perPage) b.Offset((page - 1) * perPage) return b }
[ "func", "(", "b", "*", "SelectStmt", ")", "Paginate", "(", "page", ",", "perPage", "uint64", ")", "*", "SelectStmt", "{", "b", ".", "Limit", "(", "perPage", ")", "\n", "b", ".", "Offset", "(", "(", "page", "-", "1", ")", "*", "perPage", ")", "\n"...
// Paginate fetches a page in a naive way for a small set of data.
[ "Paginate", "fetches", "a", "page", "in", "a", "naive", "way", "for", "a", "small", "set", "of", "data", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select.go#L273-L277
150,554
gocraft/dbr
select.go
OrderDir
func (b *SelectStmt) OrderDir(col string, isAsc bool) *SelectStmt { if isAsc { b.OrderAsc(col) } else { b.OrderDesc(col) } return b }
go
func (b *SelectStmt) OrderDir(col string, isAsc bool) *SelectStmt { if isAsc { b.OrderAsc(col) } else { b.OrderDesc(col) } return b }
[ "func", "(", "b", "*", "SelectStmt", ")", "OrderDir", "(", "col", "string", ",", "isAsc", "bool", ")", "*", "SelectStmt", "{", "if", "isAsc", "{", "b", ".", "OrderAsc", "(", "col", ")", "\n", "}", "else", "{", "b", ".", "OrderDesc", "(", "col", "...
// OrderDir is a helper for OrderAsc and OrderDesc.
[ "OrderDir", "is", "a", "helper", "for", "OrderAsc", "and", "OrderDesc", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select.go#L280-L287
150,555
gocraft/dbr
select.go
Join
func (b *SelectStmt) Join(table, on interface{}) *SelectStmt { b.JoinTable = append(b.JoinTable, join(inner, table, on)) return b }
go
func (b *SelectStmt) Join(table, on interface{}) *SelectStmt { b.JoinTable = append(b.JoinTable, join(inner, table, on)) return b }
[ "func", "(", "b", "*", "SelectStmt", ")", "Join", "(", "table", ",", "on", "interface", "{", "}", ")", "*", "SelectStmt", "{", "b", ".", "JoinTable", "=", "append", "(", "b", ".", "JoinTable", ",", "join", "(", "inner", ",", "table", ",", "on", "...
// Join add inner-join. // on can be Builder or string.
[ "Join", "add", "inner", "-", "join", ".", "on", "can", "be", "Builder", "or", "string", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select.go#L291-L294
150,556
gocraft/dbr
select.go
LeftJoin
func (b *SelectStmt) LeftJoin(table, on interface{}) *SelectStmt { b.JoinTable = append(b.JoinTable, join(left, table, on)) return b }
go
func (b *SelectStmt) LeftJoin(table, on interface{}) *SelectStmt { b.JoinTable = append(b.JoinTable, join(left, table, on)) return b }
[ "func", "(", "b", "*", "SelectStmt", ")", "LeftJoin", "(", "table", ",", "on", "interface", "{", "}", ")", "*", "SelectStmt", "{", "b", ".", "JoinTable", "=", "append", "(", "b", ".", "JoinTable", ",", "join", "(", "left", ",", "table", ",", "on", ...
// LeftJoin add left-join. // on can be Builder or string.
[ "LeftJoin", "add", "left", "-", "join", ".", "on", "can", "be", "Builder", "or", "string", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select.go#L298-L301
150,557
gocraft/dbr
select.go
RightJoin
func (b *SelectStmt) RightJoin(table, on interface{}) *SelectStmt { b.JoinTable = append(b.JoinTable, join(right, table, on)) return b }
go
func (b *SelectStmt) RightJoin(table, on interface{}) *SelectStmt { b.JoinTable = append(b.JoinTable, join(right, table, on)) return b }
[ "func", "(", "b", "*", "SelectStmt", ")", "RightJoin", "(", "table", ",", "on", "interface", "{", "}", ")", "*", "SelectStmt", "{", "b", ".", "JoinTable", "=", "append", "(", "b", ".", "JoinTable", ",", "join", "(", "right", ",", "table", ",", "on"...
// RightJoin add right-join. // on can be Builder or string.
[ "RightJoin", "add", "right", "-", "join", ".", "on", "can", "be", "Builder", "or", "string", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select.go#L305-L308
150,558
gocraft/dbr
select.go
FullJoin
func (b *SelectStmt) FullJoin(table, on interface{}) *SelectStmt { b.JoinTable = append(b.JoinTable, join(full, table, on)) return b }
go
func (b *SelectStmt) FullJoin(table, on interface{}) *SelectStmt { b.JoinTable = append(b.JoinTable, join(full, table, on)) return b }
[ "func", "(", "b", "*", "SelectStmt", ")", "FullJoin", "(", "table", ",", "on", "interface", "{", "}", ")", "*", "SelectStmt", "{", "b", ".", "JoinTable", "=", "append", "(", "b", ".", "JoinTable", ",", "join", "(", "full", ",", "table", ",", "on", ...
// FullJoin add full-join. // on can be Builder or string.
[ "FullJoin", "add", "full", "-", "join", ".", "on", "can", "be", "Builder", "or", "string", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select.go#L312-L315
150,559
gocraft/dbr
select.go
Rows
func (b *SelectStmt) Rows() (*sql.Rows, error) { return b.RowsContext(context.Background()) }
go
func (b *SelectStmt) Rows() (*sql.Rows, error) { return b.RowsContext(context.Background()) }
[ "func", "(", "b", "*", "SelectStmt", ")", "Rows", "(", ")", "(", "*", "sql", ".", "Rows", ",", "error", ")", "{", "return", "b", ".", "RowsContext", "(", "context", ".", "Background", "(", ")", ")", "\n", "}" ]
// Rows executes the query and returns the rows returned, or any error encountered.
[ "Rows", "executes", "the", "query", "and", "returns", "the", "rows", "returned", "or", "any", "error", "encountered", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select.go#L323-L325
150,560
gocraft/dbr
builder.go
Build
func (b BuildFunc) Build(d Dialect, buf Buffer) error { return b(d, buf) }
go
func (b BuildFunc) Build(d Dialect, buf Buffer) error { return b(d, buf) }
[ "func", "(", "b", "BuildFunc", ")", "Build", "(", "d", "Dialect", ",", "buf", "Buffer", ")", "error", "{", "return", "b", "(", "d", ",", "buf", ")", "\n", "}" ]
// Build calls itself to build SQL.
[ "Build", "calls", "itself", "to", "build", "SQL", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/builder.go#L20-L22
150,561
gocraft/dbr
condition.go
And
func And(cond ...Builder) Builder { return BuildFunc(func(d Dialect, buf Buffer) error { return buildCond(d, buf, "AND", cond...) }) }
go
func And(cond ...Builder) Builder { return BuildFunc(func(d Dialect, buf Buffer) error { return buildCond(d, buf, "AND", cond...) }) }
[ "func", "And", "(", "cond", "...", "Builder", ")", "Builder", "{", "return", "BuildFunc", "(", "func", "(", "d", "Dialect", ",", "buf", "Buffer", ")", "error", "{", "return", "buildCond", "(", "d", ",", "buf", ",", "\"", "\"", ",", "cond", "...", "...
// And creates AND from a list of conditions.
[ "And", "creates", "AND", "from", "a", "list", "of", "conditions", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/condition.go#L25-L29
150,562
gocraft/dbr
condition.go
Eq
func Eq(column string, value interface{}) Builder { return BuildFunc(func(d Dialect, buf Buffer) error { if value == nil { buf.WriteString(d.QuoteIdent(column)) buf.WriteString(" IS NULL") return nil } v := reflect.ValueOf(value) if v.Kind() == reflect.Slice { if v.Len() == 0 { buf.WriteString(...
go
func Eq(column string, value interface{}) Builder { return BuildFunc(func(d Dialect, buf Buffer) error { if value == nil { buf.WriteString(d.QuoteIdent(column)) buf.WriteString(" IS NULL") return nil } v := reflect.ValueOf(value) if v.Kind() == reflect.Slice { if v.Len() == 0 { buf.WriteString(...
[ "func", "Eq", "(", "column", "string", ",", "value", "interface", "{", "}", ")", "Builder", "{", "return", "BuildFunc", "(", "func", "(", "d", "Dialect", ",", "buf", "Buffer", ")", "error", "{", "if", "value", "==", "nil", "{", "buf", ".", "WriteStri...
// Eq is `=`. // When value is nil, it will be translated to `IS NULL`. // When value is a slice, it will be translated to `IN`. // Otherwise it will be translated to `=`.
[ "Eq", "is", "=", ".", "When", "value", "is", "nil", "it", "will", "be", "translated", "to", "IS", "NULL", ".", "When", "value", "is", "a", "slice", "it", "will", "be", "translated", "to", "IN", ".", "Otherwise", "it", "will", "be", "translated", "to"...
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/condition.go#L53-L70
150,563
gocraft/dbr
condition.go
Gt
func Gt(column string, value interface{}) Builder { return BuildFunc(func(d Dialect, buf Buffer) error { return buildCmp(d, buf, ">", column, value) }) }
go
func Gt(column string, value interface{}) Builder { return BuildFunc(func(d Dialect, buf Buffer) error { return buildCmp(d, buf, ">", column, value) }) }
[ "func", "Gt", "(", "column", "string", ",", "value", "interface", "{", "}", ")", "Builder", "{", "return", "BuildFunc", "(", "func", "(", "d", "Dialect", ",", "buf", "Buffer", ")", "error", "{", "return", "buildCmp", "(", "d", ",", "buf", ",", "\"", ...
// Gt is `>`.
[ "Gt", "is", ">", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/condition.go#L96-L100
150,564
gocraft/dbr
condition.go
Like
func Like(column, value string, escape ...string) Builder { return BuildFunc(func(d Dialect, buf Buffer) error { return buildLike(d, buf, column, value, false, escape) }) }
go
func Like(column, value string, escape ...string) Builder { return BuildFunc(func(d Dialect, buf Buffer) error { return buildLike(d, buf, column, value, false, escape) }) }
[ "func", "Like", "(", "column", ",", "value", "string", ",", "escape", "...", "string", ")", "Builder", "{", "return", "BuildFunc", "(", "func", "(", "d", "Dialect", ",", "buf", "Buffer", ")", "error", "{", "return", "buildLike", "(", "d", ",", "buf", ...
// Like is `LIKE`, with an optional `ESCAPE` clause
[ "Like", "is", "LIKE", "with", "an", "optional", "ESCAPE", "clause" ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/condition.go#L139-L143
150,565
gocraft/dbr
condition.go
NotLike
func NotLike(column, value string, escape ...string) Builder { return BuildFunc(func(d Dialect, buf Buffer) error { return buildLike(d, buf, column, value, true, escape) }) }
go
func NotLike(column, value string, escape ...string) Builder { return BuildFunc(func(d Dialect, buf Buffer) error { return buildLike(d, buf, column, value, true, escape) }) }
[ "func", "NotLike", "(", "column", ",", "value", "string", ",", "escape", "...", "string", ")", "Builder", "{", "return", "BuildFunc", "(", "func", "(", "d", "Dialect", ",", "buf", "Buffer", ")", "error", "{", "return", "buildLike", "(", "d", ",", "buf"...
// NotLike is `NOT LIKE`, with an optional `ESCAPE` clause
[ "NotLike", "is", "NOT", "LIKE", "with", "an", "optional", "ESCAPE", "clause" ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/condition.go#L146-L150
150,566
gocraft/dbr
ident.go
Build
func (i I) Build(d Dialect, buf Buffer) error { buf.WriteString(d.QuoteIdent(string(i))) return nil }
go
func (i I) Build(d Dialect, buf Buffer) error { buf.WriteString(d.QuoteIdent(string(i))) return nil }
[ "func", "(", "i", "I", ")", "Build", "(", "d", "Dialect", ",", "buf", "Buffer", ")", "error", "{", "buf", ".", "WriteString", "(", "d", ".", "QuoteIdent", "(", "string", "(", "i", ")", ")", ")", "\n", "return", "nil", "\n", "}" ]
// Build quotes string with dialect.
[ "Build", "quotes", "string", "with", "dialect", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/ident.go#L7-L10
150,567
gocraft/dbr
opentracing/event_receiver.go
SpanStart
func (EventReceiver) SpanStart(ctx context.Context, eventName, query string) context.Context { span, ctx := ot.StartSpanFromContext(ctx, eventName) otext.DBStatement.Set(span, query) otext.DBType.Set(span, "sql") return ctx }
go
func (EventReceiver) SpanStart(ctx context.Context, eventName, query string) context.Context { span, ctx := ot.StartSpanFromContext(ctx, eventName) otext.DBStatement.Set(span, query) otext.DBType.Set(span, "sql") return ctx }
[ "func", "(", "EventReceiver", ")", "SpanStart", "(", "ctx", "context", ".", "Context", ",", "eventName", ",", "query", "string", ")", "context", ".", "Context", "{", "span", ",", "ctx", ":=", "ot", ".", "StartSpanFromContext", "(", "ctx", ",", "eventName",...
// SpanStart starts a new query span from ctx, then returns a new context with the new span.
[ "SpanStart", "starts", "a", "new", "query", "span", "from", "ctx", "then", "returns", "a", "new", "context", "with", "the", "new", "span", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/opentracing/event_receiver.go#L16-L21
150,568
gocraft/dbr
opentracing/event_receiver.go
SpanFinish
func (EventReceiver) SpanFinish(ctx context.Context) { if span := ot.SpanFromContext(ctx); span != nil { span.Finish() } }
go
func (EventReceiver) SpanFinish(ctx context.Context) { if span := ot.SpanFromContext(ctx); span != nil { span.Finish() } }
[ "func", "(", "EventReceiver", ")", "SpanFinish", "(", "ctx", "context", ".", "Context", ")", "{", "if", "span", ":=", "ot", ".", "SpanFromContext", "(", "ctx", ")", ";", "span", "!=", "nil", "{", "span", ".", "Finish", "(", ")", "\n", "}", "\n", "}...
// SpanFinish finishes the span associated with ctx.
[ "SpanFinish", "finishes", "the", "span", "associated", "with", "ctx", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/opentracing/event_receiver.go#L24-L28
150,569
gocraft/dbr
opentracing/event_receiver.go
SpanError
func (EventReceiver) SpanError(ctx context.Context, err error) { if span := ot.SpanFromContext(ctx); span != nil { otext.Error.Set(span, true) span.LogFields(otlog.String("event", "error"), otlog.Error(err)) } }
go
func (EventReceiver) SpanError(ctx context.Context, err error) { if span := ot.SpanFromContext(ctx); span != nil { otext.Error.Set(span, true) span.LogFields(otlog.String("event", "error"), otlog.Error(err)) } }
[ "func", "(", "EventReceiver", ")", "SpanError", "(", "ctx", "context", ".", "Context", ",", "err", "error", ")", "{", "if", "span", ":=", "ot", ".", "SpanFromContext", "(", "ctx", ")", ";", "span", "!=", "nil", "{", "otext", ".", "Error", ".", "Set",...
// SpanError adds an error to the span associated with ctx.
[ "SpanError", "adds", "an", "error", "to", "the", "span", "associated", "with", "ctx", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/opentracing/event_receiver.go#L31-L36
150,570
gocraft/dbr
types.go
MarshalJSON
func (n NullString) MarshalJSON() ([]byte, error) { if n.Valid { return json.Marshal(n.String) } return nullString, nil }
go
func (n NullString) MarshalJSON() ([]byte, error) { if n.Valid { return json.Marshal(n.String) } return nullString, nil }
[ "func", "(", "n", "NullString", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "n", ".", "Valid", "{", "return", "json", ".", "Marshal", "(", "n", ".", "String", ")", "\n", "}", "\n", "return", "nullString", ",...
// MarshalJSON correctly serializes a NullString to JSON.
[ "MarshalJSON", "correctly", "serializes", "a", "NullString", "to", "JSON", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/types.go#L52-L57
150,571
gocraft/dbr
types.go
MarshalJSON
func (n NullInt64) MarshalJSON() ([]byte, error) { if n.Valid { return json.Marshal(n.Int64) } return nullString, nil }
go
func (n NullInt64) MarshalJSON() ([]byte, error) { if n.Valid { return json.Marshal(n.Int64) } return nullString, nil }
[ "func", "(", "n", "NullInt64", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "n", ".", "Valid", "{", "return", "json", ".", "Marshal", "(", "n", ".", "Int64", ")", "\n", "}", "\n", "return", "nullString", ",",...
// MarshalJSON correctly serializes a NullInt64 to JSON.
[ "MarshalJSON", "correctly", "serializes", "a", "NullInt64", "to", "JSON", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/types.go#L60-L65
150,572
gocraft/dbr
types.go
MarshalJSON
func (n NullBool) MarshalJSON() ([]byte, error) { if n.Valid { return json.Marshal(n.Bool) } return nullString, nil }
go
func (n NullBool) MarshalJSON() ([]byte, error) { if n.Valid { return json.Marshal(n.Bool) } return nullString, nil }
[ "func", "(", "n", "NullBool", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "n", ".", "Valid", "{", "return", "json", ".", "Marshal", "(", "n", ".", "Bool", ")", "\n", "}", "\n", "return", "nullString", ",", ...
// MarshalJSON correctly serializes a NullBool to JSON.
[ "MarshalJSON", "correctly", "serializes", "a", "NullBool", "to", "JSON", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/types.go#L84-L89
150,573
gocraft/dbr
types.go
UnmarshalJSON
func (n *NullString) UnmarshalJSON(b []byte) error { var s interface{} if err := json.Unmarshal(b, &s); err != nil { return err } return n.Scan(s) }
go
func (n *NullString) UnmarshalJSON(b []byte) error { var s interface{} if err := json.Unmarshal(b, &s); err != nil { return err } return n.Scan(s) }
[ "func", "(", "n", "*", "NullString", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "var", "s", "interface", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "b", ",", "&", "s", ")", ";", "err", "!=", "nil...
// UnmarshalJSON correctly deserializes a NullString from JSON.
[ "UnmarshalJSON", "correctly", "deserializes", "a", "NullString", "from", "JSON", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/types.go#L92-L98
150,574
gocraft/dbr
types.go
UnmarshalJSON
func (n *NullInt64) UnmarshalJSON(b []byte) error { var s json.Number if err := json.Unmarshal(b, &s); err != nil { return err } if s == "" { return n.Scan(nil) } return n.Scan(s) }
go
func (n *NullInt64) UnmarshalJSON(b []byte) error { var s json.Number if err := json.Unmarshal(b, &s); err != nil { return err } if s == "" { return n.Scan(nil) } return n.Scan(s) }
[ "func", "(", "n", "*", "NullInt64", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "var", "s", "json", ".", "Number", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "b", ",", "&", "s", ")", ";", "err", "!=", "nil"...
// UnmarshalJSON correctly deserializes a NullInt64 from JSON.
[ "UnmarshalJSON", "correctly", "deserializes", "a", "NullInt64", "from", "JSON", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/types.go#L101-L110
150,575
gocraft/dbr
types.go
UnmarshalJSON
func (n *NullTime) UnmarshalJSON(b []byte) error { // scan for null if bytes.Equal(b, nullString) { return n.Scan(nil) } // scan for JSON timestamp var t time.Time if err := json.Unmarshal(b, &t); err != nil { return err } return n.Scan(t) }
go
func (n *NullTime) UnmarshalJSON(b []byte) error { // scan for null if bytes.Equal(b, nullString) { return n.Scan(nil) } // scan for JSON timestamp var t time.Time if err := json.Unmarshal(b, &t); err != nil { return err } return n.Scan(t) }
[ "func", "(", "n", "*", "NullTime", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "// scan for null", "if", "bytes", ".", "Equal", "(", "b", ",", "nullString", ")", "{", "return", "n", ".", "Scan", "(", "nil", ")", "\n", "}", ...
// UnmarshalJSON correctly deserializes a NullTime from JSON.
[ "UnmarshalJSON", "correctly", "deserializes", "a", "NullTime", "from", "JSON", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/types.go#L122-L133
150,576
gocraft/dbr
insert.go
Values
func (b *InsertStmt) Values(value ...interface{}) *InsertStmt { b.Value = append(b.Value, value) return b }
go
func (b *InsertStmt) Values(value ...interface{}) *InsertStmt { b.Value = append(b.Value, value) return b }
[ "func", "(", "b", "*", "InsertStmt", ")", "Values", "(", "value", "...", "interface", "{", "}", ")", "*", "InsertStmt", "{", "b", ".", "Value", "=", "append", "(", "b", ".", "Value", ",", "value", ")", "\n", "return", "b", "\n", "}" ]
// Values adds a tuple to be inserted. // The order of the tuple should match Columns.
[ "Values", "adds", "a", "tuple", "to", "be", "inserted", ".", "The", "order", "of", "the", "tuple", "should", "match", "Columns", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/insert.go#L140-L143
150,577
gocraft/dbr
insert.go
Record
func (b *InsertStmt) Record(structValue interface{}) *InsertStmt { v := reflect.Indirect(reflect.ValueOf(structValue)) if v.Kind() == reflect.Struct { found := make([]interface{}, len(b.Column)+1) // ID is recommended by golint here s := newTagStore() s.findValueByName(v, append(b.Column, "id"), found, false...
go
func (b *InsertStmt) Record(structValue interface{}) *InsertStmt { v := reflect.Indirect(reflect.ValueOf(structValue)) if v.Kind() == reflect.Struct { found := make([]interface{}, len(b.Column)+1) // ID is recommended by golint here s := newTagStore() s.findValueByName(v, append(b.Column, "id"), found, false...
[ "func", "(", "b", "*", "InsertStmt", ")", "Record", "(", "structValue", "interface", "{", "}", ")", "*", "InsertStmt", "{", "v", ":=", "reflect", ".", "Indirect", "(", "reflect", ".", "ValueOf", "(", "structValue", ")", ")", "\n\n", "if", "v", ".", "...
// Record adds a tuple for columns from a struct. // // If there is a field called "Id" or "ID" in the struct, // it will be set to LastInsertId.
[ "Record", "adds", "a", "tuple", "for", "columns", "from", "a", "struct", ".", "If", "there", "is", "a", "field", "called", "Id", "or", "ID", "in", "the", "struct", "it", "will", "be", "set", "to", "LastInsertId", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/insert.go#L149-L176
150,578
gocraft/dbr
dbr.go
Open
func Open(driver, dsn string, log EventReceiver) (*Connection, error) { if log == nil { log = nullReceiver } conn, err := sql.Open(driver, dsn) if err != nil { return nil, err } var d Dialect switch driver { case "mysql": d = dialect.MySQL case "postgres": d = dialect.PostgreSQL case "sqlite3": d = ...
go
func Open(driver, dsn string, log EventReceiver) (*Connection, error) { if log == nil { log = nullReceiver } conn, err := sql.Open(driver, dsn) if err != nil { return nil, err } var d Dialect switch driver { case "mysql": d = dialect.MySQL case "postgres": d = dialect.PostgreSQL case "sqlite3": d = ...
[ "func", "Open", "(", "driver", ",", "dsn", "string", ",", "log", "EventReceiver", ")", "(", "*", "Connection", ",", "error", ")", "{", "if", "log", "==", "nil", "{", "log", "=", "nullReceiver", "\n", "}", "\n", "conn", ",", "err", ":=", "sql", ".",...
// Open creates a Connection. // log can be nil to ignore logging.
[ "Open", "creates", "a", "Connection", ".", "log", "can", "be", "nil", "to", "ignore", "logging", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/dbr.go#L15-L35
150,579
gocraft/dbr
dbr.go
NewSession
func (conn *Connection) NewSession(log EventReceiver) *Session { if log == nil { log = conn.EventReceiver // Use parent instrumentation } return &Session{Connection: conn, EventReceiver: log} }
go
func (conn *Connection) NewSession(log EventReceiver) *Session { if log == nil { log = conn.EventReceiver // Use parent instrumentation } return &Session{Connection: conn, EventReceiver: log} }
[ "func", "(", "conn", "*", "Connection", ")", "NewSession", "(", "log", "EventReceiver", ")", "*", "Session", "{", "if", "log", "==", "nil", "{", "log", "=", "conn", ".", "EventReceiver", "// Use parent instrumentation", "\n", "}", "\n", "return", "&", "Ses...
// NewSession instantiates a Session from Connection. // If log is nil, Connection EventReceiver is used.
[ "NewSession", "instantiates", "a", "Session", "from", "Connection", ".", "If", "log", "is", "nil", "Connection", "EventReceiver", "is", "used", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/dbr.go#L71-L76
150,580
gocraft/dbr
now.go
Value
func (n nowSentinel) Value() (driver.Value, error) { now := time.Now().UTC().Format(timeFormat) return now, nil }
go
func (n nowSentinel) Value() (driver.Value, error) { now := time.Now().UTC().Format(timeFormat) return now, nil }
[ "func", "(", "n", "nowSentinel", ")", "Value", "(", ")", "(", "driver", ".", "Value", ",", "error", ")", "{", "now", ":=", "time", ".", "Now", "(", ")", ".", "UTC", "(", ")", ".", "Format", "(", "timeFormat", ")", "\n", "return", "now", ",", "n...
// Value implements a valuer for compatibility
[ "Value", "implements", "a", "valuer", "for", "compatibility" ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/now.go#L16-L19
150,581
gocraft/dbr
update.go
Set
func (b *UpdateStmt) Set(column string, value interface{}) *UpdateStmt { b.Value[column] = value return b }
go
func (b *UpdateStmt) Set(column string, value interface{}) *UpdateStmt { b.Value[column] = value return b }
[ "func", "(", "b", "*", "UpdateStmt", ")", "Set", "(", "column", "string", ",", "value", "interface", "{", "}", ")", "*", "UpdateStmt", "{", "b", ".", "Value", "[", "column", "]", "=", "value", "\n", "return", "b", "\n", "}" ]
// Set updates column with value.
[ "Set", "updates", "column", "with", "value", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/update.go#L158-L161
150,582
gocraft/dbr
select_return.go
ReturnInt64
func (b *SelectStmt) ReturnInt64() (int64, error) { var v int64 err := b.LoadOne(&v) return v, err }
go
func (b *SelectStmt) ReturnInt64() (int64, error) { var v int64 err := b.LoadOne(&v) return v, err }
[ "func", "(", "b", "*", "SelectStmt", ")", "ReturnInt64", "(", ")", "(", "int64", ",", "error", ")", "{", "var", "v", "int64", "\n", "err", ":=", "b", ".", "LoadOne", "(", "&", "v", ")", "\n", "return", "v", ",", "err", "\n", "}" ]
// ReturnInt64 executes the SelectStmt and returns the value as an int64.
[ "ReturnInt64", "executes", "the", "SelectStmt", "and", "returns", "the", "value", "as", "an", "int64", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select_return.go#L4-L8
150,583
gocraft/dbr
select_return.go
ReturnInt64s
func (b *SelectStmt) ReturnInt64s() ([]int64, error) { var v []int64 _, err := b.Load(&v) return v, err }
go
func (b *SelectStmt) ReturnInt64s() ([]int64, error) { var v []int64 _, err := b.Load(&v) return v, err }
[ "func", "(", "b", "*", "SelectStmt", ")", "ReturnInt64s", "(", ")", "(", "[", "]", "int64", ",", "error", ")", "{", "var", "v", "[", "]", "int64", "\n", "_", ",", "err", ":=", "b", ".", "Load", "(", "&", "v", ")", "\n", "return", "v", ",", ...
// ReturnInt64s executes the SelectStmt and returns the value as a slice of int64s.
[ "ReturnInt64s", "executes", "the", "SelectStmt", "and", "returns", "the", "value", "as", "a", "slice", "of", "int64s", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select_return.go#L11-L15
150,584
gocraft/dbr
select_return.go
ReturnUint64
func (b *SelectStmt) ReturnUint64() (uint64, error) { var v uint64 err := b.LoadOne(&v) return v, err }
go
func (b *SelectStmt) ReturnUint64() (uint64, error) { var v uint64 err := b.LoadOne(&v) return v, err }
[ "func", "(", "b", "*", "SelectStmt", ")", "ReturnUint64", "(", ")", "(", "uint64", ",", "error", ")", "{", "var", "v", "uint64", "\n", "err", ":=", "b", ".", "LoadOne", "(", "&", "v", ")", "\n", "return", "v", ",", "err", "\n", "}" ]
// ReturnUint64 executes the SelectStmt and returns the value as an uint64.
[ "ReturnUint64", "executes", "the", "SelectStmt", "and", "returns", "the", "value", "as", "an", "uint64", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select_return.go#L18-L22
150,585
gocraft/dbr
select_return.go
ReturnUint64s
func (b *SelectStmt) ReturnUint64s() ([]uint64, error) { var v []uint64 _, err := b.Load(&v) return v, err }
go
func (b *SelectStmt) ReturnUint64s() ([]uint64, error) { var v []uint64 _, err := b.Load(&v) return v, err }
[ "func", "(", "b", "*", "SelectStmt", ")", "ReturnUint64s", "(", ")", "(", "[", "]", "uint64", ",", "error", ")", "{", "var", "v", "[", "]", "uint64", "\n", "_", ",", "err", ":=", "b", ".", "Load", "(", "&", "v", ")", "\n", "return", "v", ",",...
// ReturnUint64s executes the SelectStmt and returns the value as a slice of uint64s.
[ "ReturnUint64s", "executes", "the", "SelectStmt", "and", "returns", "the", "value", "as", "a", "slice", "of", "uint64s", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select_return.go#L25-L29
150,586
gocraft/dbr
select_return.go
ReturnString
func (b *SelectStmt) ReturnString() (string, error) { var v string err := b.LoadOne(&v) return v, err }
go
func (b *SelectStmt) ReturnString() (string, error) { var v string err := b.LoadOne(&v) return v, err }
[ "func", "(", "b", "*", "SelectStmt", ")", "ReturnString", "(", ")", "(", "string", ",", "error", ")", "{", "var", "v", "string", "\n", "err", ":=", "b", ".", "LoadOne", "(", "&", "v", ")", "\n", "return", "v", ",", "err", "\n", "}" ]
// ReturnString executes the SelectStmt and returns the value as a string.
[ "ReturnString", "executes", "the", "SelectStmt", "and", "returns", "the", "value", "as", "a", "string", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select_return.go#L32-L36
150,587
gocraft/dbr
select_return.go
ReturnStrings
func (b *SelectStmt) ReturnStrings() ([]string, error) { var v []string _, err := b.Load(&v) return v, err }
go
func (b *SelectStmt) ReturnStrings() ([]string, error) { var v []string _, err := b.Load(&v) return v, err }
[ "func", "(", "b", "*", "SelectStmt", ")", "ReturnStrings", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "v", "[", "]", "string", "\n", "_", ",", "err", ":=", "b", ".", "Load", "(", "&", "v", ")", "\n", "return", "v", ",",...
// ReturnStrings executes the SelectStmt and returns the value as a slice of strings.
[ "ReturnStrings", "executes", "the", "SelectStmt", "and", "returns", "the", "value", "as", "a", "slice", "of", "strings", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/select_return.go#L39-L43
150,588
gocraft/dbr
transaction.go
BeginTx
func (sess *Session) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) { tx, err := sess.Connection.BeginTx(ctx, opts) if err != nil { return nil, sess.EventErr("dbr.begin.error", err) } sess.Event("dbr.begin") return &Tx{ EventReceiver: sess.EventReceiver, Dialect: sess.Dialect, Tx: ...
go
func (sess *Session) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) { tx, err := sess.Connection.BeginTx(ctx, opts) if err != nil { return nil, sess.EventErr("dbr.begin.error", err) } sess.Event("dbr.begin") return &Tx{ EventReceiver: sess.EventReceiver, Dialect: sess.Dialect, Tx: ...
[ "func", "(", "sess", "*", "Session", ")", "BeginTx", "(", "ctx", "context", ".", "Context", ",", "opts", "*", "sql", ".", "TxOptions", ")", "(", "*", "Tx", ",", "error", ")", "{", "tx", ",", "err", ":=", "sess", ".", "Connection", ".", "BeginTx", ...
// BeginTx creates a transaction with TxOptions.
[ "BeginTx", "creates", "a", "transaction", "with", "TxOptions", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/transaction.go#L23-L36
150,589
gocraft/dbr
transaction.go
Begin
func (sess *Session) Begin() (*Tx, error) { return sess.BeginTx(context.Background(), nil) }
go
func (sess *Session) Begin() (*Tx, error) { return sess.BeginTx(context.Background(), nil) }
[ "func", "(", "sess", "*", "Session", ")", "Begin", "(", ")", "(", "*", "Tx", ",", "error", ")", "{", "return", "sess", ".", "BeginTx", "(", "context", ".", "Background", "(", ")", ",", "nil", ")", "\n", "}" ]
// Begin creates a transaction for the given session.
[ "Begin", "creates", "a", "transaction", "for", "the", "given", "session", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/transaction.go#L39-L41
150,590
gocraft/dbr
transaction.go
Commit
func (tx *Tx) Commit() error { err := tx.Tx.Commit() if err != nil { return tx.EventErr("dbr.commit.error", err) } tx.Event("dbr.commit") return nil }
go
func (tx *Tx) Commit() error { err := tx.Tx.Commit() if err != nil { return tx.EventErr("dbr.commit.error", err) } tx.Event("dbr.commit") return nil }
[ "func", "(", "tx", "*", "Tx", ")", "Commit", "(", ")", "error", "{", "err", ":=", "tx", ".", "Tx", ".", "Commit", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "tx", ".", "EventErr", "(", "\"", "\"", ",", "err", ")", "\n", "}", "...
// Commit finishes the transaction.
[ "Commit", "finishes", "the", "transaction", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/transaction.go#L44-L51
150,591
gocraft/dbr
transaction.go
Rollback
func (tx *Tx) Rollback() error { err := tx.Tx.Rollback() if err != nil { return tx.EventErr("dbr.rollback", err) } tx.Event("dbr.rollback") return nil }
go
func (tx *Tx) Rollback() error { err := tx.Tx.Rollback() if err != nil { return tx.EventErr("dbr.rollback", err) } tx.Event("dbr.rollback") return nil }
[ "func", "(", "tx", "*", "Tx", ")", "Rollback", "(", ")", "error", "{", "err", ":=", "tx", ".", "Tx", ".", "Rollback", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "tx", ".", "EventErr", "(", "\"", "\"", ",", "err", ")", "\n", "}",...
// Rollback cancels the transaction.
[ "Rollback", "cancels", "the", "transaction", "." ]
48a049970bd235145507f94604005bb7eb9c8bb4
https://github.com/gocraft/dbr/blob/48a049970bd235145507f94604005bb7eb9c8bb4/transaction.go#L54-L61
150,592
ceph/go-ceph
rados/ioctx.go
Stat
func (ioctx *IOContext) Stat(object string) (stat ObjectStat, err error) { var c_psize C.uint64_t var c_pmtime C.time_t c_object := C.CString(object) defer C.free(unsafe.Pointer(c_object)) ret := C.rados_stat( ioctx.ioctx, c_object, &c_psize, &c_pmtime) if ret < 0 { return ObjectStat{}, GetRadosError(...
go
func (ioctx *IOContext) Stat(object string) (stat ObjectStat, err error) { var c_psize C.uint64_t var c_pmtime C.time_t c_object := C.CString(object) defer C.free(unsafe.Pointer(c_object)) ret := C.rados_stat( ioctx.ioctx, c_object, &c_psize, &c_pmtime) if ret < 0 { return ObjectStat{}, GetRadosError(...
[ "func", "(", "ioctx", "*", "IOContext", ")", "Stat", "(", "object", "string", ")", "(", "stat", "ObjectStat", ",", "err", "error", ")", "{", "var", "c_psize", "C", ".", "uint64_t", "\n", "var", "c_pmtime", "C", ".", "time_t", "\n", "c_object", ":=", ...
// Stat returns the size of the object and its last modification time
[ "Stat", "returns", "the", "size", "of", "the", "object", "and", "its", "last", "modification", "time" ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rados/ioctx.go#L264-L284
150,593
ceph/go-ceph
rados/ioctx.go
GetXattr
func (ioctx *IOContext) GetXattr(object string, name string, data []byte) (int, error) { c_object := C.CString(object) c_name := C.CString(name) defer C.free(unsafe.Pointer(c_object)) defer C.free(unsafe.Pointer(c_name)) ret := C.rados_getxattr( ioctx.ioctx, c_object, c_name, (*C.char)(unsafe.Pointer(&dat...
go
func (ioctx *IOContext) GetXattr(object string, name string, data []byte) (int, error) { c_object := C.CString(object) c_name := C.CString(name) defer C.free(unsafe.Pointer(c_object)) defer C.free(unsafe.Pointer(c_name)) ret := C.rados_getxattr( ioctx.ioctx, c_object, c_name, (*C.char)(unsafe.Pointer(&dat...
[ "func", "(", "ioctx", "*", "IOContext", ")", "GetXattr", "(", "object", "string", ",", "name", "string", ",", "data", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "c_object", ":=", "C", ".", "CString", "(", "object", ")", "\n", "c_nam...
// GetXattr gets an xattr with key `name`, it returns the length of // the key read or an error if not successful
[ "GetXattr", "gets", "an", "xattr", "with", "key", "name", "it", "returns", "the", "length", "of", "the", "key", "read", "or", "an", "error", "if", "not", "successful" ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rados/ioctx.go#L288-L306
150,594
ceph/go-ceph
rados/ioctx.go
RmOmapKeys
func (ioctx *IOContext) RmOmapKeys(oid string, keys []string) error { c_oid := C.CString(oid) defer C.free(unsafe.Pointer(c_oid)) var c *C.char ptrSize := unsafe.Sizeof(c) c_keys := C.malloc(C.size_t(len(keys)) * C.size_t(ptrSize)) defer C.free(unsafe.Pointer(c_keys)) i := 0 for _, key := range keys { c_ke...
go
func (ioctx *IOContext) RmOmapKeys(oid string, keys []string) error { c_oid := C.CString(oid) defer C.free(unsafe.Pointer(c_oid)) var c *C.char ptrSize := unsafe.Sizeof(c) c_keys := C.malloc(C.size_t(len(keys)) * C.size_t(ptrSize)) defer C.free(unsafe.Pointer(c_keys)) i := 0 for _, key := range keys { c_ke...
[ "func", "(", "ioctx", "*", "IOContext", ")", "RmOmapKeys", "(", "oid", "string", ",", "keys", "[", "]", "string", ")", "error", "{", "c_oid", ":=", "C", ".", "CString", "(", "oid", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer"...
// Remove the specified `keys` from the omap `oid`
[ "Remove", "the", "specified", "keys", "from", "the", "omap", "oid" ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rados/ioctx.go#L545-L573
150,595
ceph/go-ceph
rados/ioctx.go
CleanOmap
func (ioctx *IOContext) CleanOmap(oid string) error { c_oid := C.CString(oid) defer C.free(unsafe.Pointer(c_oid)) op := C.rados_create_write_op() C.rados_write_op_omap_clear(op) ret := C.rados_write_op_operate(op, ioctx.ioctx, c_oid, nil, 0) C.rados_release_write_op(op) return GetRadosError(int(ret)) }
go
func (ioctx *IOContext) CleanOmap(oid string) error { c_oid := C.CString(oid) defer C.free(unsafe.Pointer(c_oid)) op := C.rados_create_write_op() C.rados_write_op_omap_clear(op) ret := C.rados_write_op_operate(op, ioctx.ioctx, c_oid, nil, 0) C.rados_release_write_op(op) return GetRadosError(int(ret)) }
[ "func", "(", "ioctx", "*", "IOContext", ")", "CleanOmap", "(", "oid", "string", ")", "error", "{", "c_oid", ":=", "C", ".", "CString", "(", "oid", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "c_oid", ")", ")", "\n\n", ...
// Clear the omap `oid`
[ "Clear", "the", "omap", "oid" ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rados/ioctx.go#L576-L587
150,596
ceph/go-ceph
rados/ioctx.go
Iter
func (ioctx *IOContext) Iter() (*Iter, error) { iter := Iter{} if cerr := C.rados_nobjects_list_open(ioctx.ioctx, &iter.ctx); cerr < 0 { return nil, GetRadosError(int(cerr)) } return &iter, nil }
go
func (ioctx *IOContext) Iter() (*Iter, error) { iter := Iter{} if cerr := C.rados_nobjects_list_open(ioctx.ioctx, &iter.ctx); cerr < 0 { return nil, GetRadosError(int(cerr)) } return &iter, nil }
[ "func", "(", "ioctx", "*", "IOContext", ")", "Iter", "(", ")", "(", "*", "Iter", ",", "error", ")", "{", "iter", ":=", "Iter", "{", "}", "\n", "if", "cerr", ":=", "C", ".", "rados_nobjects_list_open", "(", "ioctx", ".", "ioctx", ",", "&", "iter", ...
// Return a Iterator object that can be used to list the object names in the current pool
[ "Return", "a", "Iterator", "object", "that", "can", "be", "used", "to", "list", "the", "object", "names", "in", "the", "current", "pool" ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rados/ioctx.go#L599-L605
150,597
ceph/go-ceph
rados/ioctx.go
Err
func (iter *Iter) Err() error { if iter.err == RadosErrorNotFound { return nil } return iter.err }
go
func (iter *Iter) Err() error { if iter.err == RadosErrorNotFound { return nil } return iter.err }
[ "func", "(", "iter", "*", "Iter", ")", "Err", "(", ")", "error", "{", "if", "iter", ".", "err", "==", "RadosErrorNotFound", "{", "return", "nil", "\n", "}", "\n", "return", "iter", ".", "err", "\n", "}" ]
// Checks whether the iterator has encountered an error.
[ "Checks", "whether", "the", "iterator", "has", "encountered", "an", "error", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rados/ioctx.go#L659-L664
150,598
ceph/go-ceph
rados/ioctx.go
LockExclusive
func (ioctx *IOContext) LockExclusive(oid, name, cookie, desc string, duration time.Duration, flags *byte) (int, error) { c_oid := C.CString(oid) c_name := C.CString(name) c_cookie := C.CString(cookie) c_desc := C.CString(desc) var c_duration C.struct_timeval if duration != 0 { tv := syscall.NsecToTimeval(dura...
go
func (ioctx *IOContext) LockExclusive(oid, name, cookie, desc string, duration time.Duration, flags *byte) (int, error) { c_oid := C.CString(oid) c_name := C.CString(name) c_cookie := C.CString(cookie) c_desc := C.CString(desc) var c_duration C.struct_timeval if duration != 0 { tv := syscall.NsecToTimeval(dura...
[ "func", "(", "ioctx", "*", "IOContext", ")", "LockExclusive", "(", "oid", ",", "name", ",", "cookie", ",", "desc", "string", ",", "duration", "time", ".", "Duration", ",", "flags", "*", "byte", ")", "(", "int", ",", "error", ")", "{", "c_oid", ":=", ...
// Take an exclusive lock on an object.
[ "Take", "an", "exclusive", "lock", "on", "an", "object", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rados/ioctx.go#L673-L718
150,599
ceph/go-ceph
rados/ioctx.go
Unlock
func (ioctx *IOContext) Unlock(oid, name, cookie string) (int, error) { c_oid := C.CString(oid) c_name := C.CString(name) c_cookie := C.CString(cookie) defer C.free(unsafe.Pointer(c_oid)) defer C.free(unsafe.Pointer(c_name)) defer C.free(unsafe.Pointer(c_cookie)) // 0 on success, negative error code on failure...
go
func (ioctx *IOContext) Unlock(oid, name, cookie string) (int, error) { c_oid := C.CString(oid) c_name := C.CString(name) c_cookie := C.CString(cookie) defer C.free(unsafe.Pointer(c_oid)) defer C.free(unsafe.Pointer(c_name)) defer C.free(unsafe.Pointer(c_cookie)) // 0 on success, negative error code on failure...
[ "func", "(", "ioctx", "*", "IOContext", ")", "Unlock", "(", "oid", ",", "name", ",", "cookie", "string", ")", "(", "int", ",", "error", ")", "{", "c_oid", ":=", "C", ".", "CString", "(", "oid", ")", "\n", "c_name", ":=", "C", ".", "CString", "(",...
// Release a shared or exclusive lock on an object.
[ "Release", "a", "shared", "or", "exclusive", "lock", "on", "an", "object", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rados/ioctx.go#L772-L798