id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
28,500
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
28,501
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
28,502
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
28,503
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
28,504
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
28,505
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
28,506
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
28,507
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
28,508
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
28,509
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
28,510
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
28,511
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
28,512
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
28,513
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
28,514
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
28,515
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
28,516
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
28,517
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
28,518
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
28,519
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
28,520
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
28,521
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
28,522
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
28,523
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
28,524
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
28,525
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
28,526
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
28,527
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
28,528
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
28,529
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
28,530
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
28,531
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
28,532
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
28,533
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
28,534
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
28,535
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
28,536
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
28,537
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
28,538
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
28,539
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
28,540
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
28,541
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
28,542
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
28,543
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
28,544
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
28,545
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
28,546
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
28,547
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
28,548
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
28,549
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
28,550
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
28,551
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
28,552
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
28,553
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
28,554
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
28,555
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
28,556
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
28,557
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
28,558
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
28,559
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
28,560
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
28,561
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
28,562
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
28,563
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
28,564
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
28,565
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
28,566
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
28,567
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
28,568
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
28,569
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
28,570
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
28,571
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
28,572
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
28,573
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
28,574
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
28,575
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
28,576
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
28,577
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
28,578
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
28,579
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
28,580
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
28,581
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
28,582
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
28,583
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
28,584
ceph/go-ceph
rados/ioctx.go
ListLockers
func (ioctx *IOContext) ListLockers(oid, name string) (*LockInfo, error) { c_oid := C.CString(oid) c_name := C.CString(name) c_tag := (*C.char)(C.malloc(C.size_t(1024))) c_clients := (*C.char)(C.malloc(C.size_t(1024))) c_cookies := (*C.char)(C.malloc(C.size_t(1024))) c_addrs := (*C.char)(C.malloc(C.size_t(1024))...
go
func (ioctx *IOContext) ListLockers(oid, name string) (*LockInfo, error) { c_oid := C.CString(oid) c_name := C.CString(name) c_tag := (*C.char)(C.malloc(C.size_t(1024))) c_clients := (*C.char)(C.malloc(C.size_t(1024))) c_cookies := (*C.char)(C.malloc(C.size_t(1024))) c_addrs := (*C.char)(C.malloc(C.size_t(1024))...
[ "func", "(", "ioctx", "*", "IOContext", ")", "ListLockers", "(", "oid", ",", "name", "string", ")", "(", "*", "LockInfo", ",", "error", ")", "{", "c_oid", ":=", "C", ".", "CString", "(", "oid", ")", "\n", "c_name", ":=", "C", ".", "CString", "(", ...
// List clients that have locked the named object lock and information about the lock. // The number of bytes required in each buffer is put in the corresponding size out parameter. // If any of the provided buffers are too short, -ERANGE is returned after these sizes are filled in.
[ "List", "clients", "that", "have", "locked", "the", "named", "object", "lock", "and", "information", "about", "the", "lock", ".", "The", "number", "of", "bytes", "required", "in", "each", "buffer", "is", "put", "in", "the", "corresponding", "size", "out", ...
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rados/ioctx.go#L803-L855
28,585
ceph/go-ceph
rados/ioctx.go
BreakLock
func (ioctx *IOContext) BreakLock(oid, name, client, cookie string) (int, error) { c_oid := C.CString(oid) c_name := C.CString(name) c_client := C.CString(client) 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_client)) defer ...
go
func (ioctx *IOContext) BreakLock(oid, name, client, cookie string) (int, error) { c_oid := C.CString(oid) c_name := C.CString(name) c_client := C.CString(client) 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_client)) defer ...
[ "func", "(", "ioctx", "*", "IOContext", ")", "BreakLock", "(", "oid", ",", "name", ",", "client", ",", "cookie", "string", ")", "(", "int", ",", "error", ")", "{", "c_oid", ":=", "C", ".", "CString", "(", "oid", ")", "\n", "c_name", ":=", "C", "....
// Releases a shared or exclusive lock on an object, which was taken by the specified client.
[ "Releases", "a", "shared", "or", "exclusive", "lock", "on", "an", "object", "which", "was", "taken", "by", "the", "specified", "client", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rados/ioctx.go#L858-L890
28,586
ceph/go-ceph
rbd/rbd.go
GetTrashList
func GetTrashList(ioctx *rados.IOContext) ([]TrashInfo, error) { var num_entries C.size_t // Call rbd_trash_list with nil pointer to get number of trash entries. if C.rbd_trash_list(C.rados_ioctx_t(ioctx.Pointer()), nil, &num_entries); num_entries == 0 { return nil, nil } c_entries := make([]C.rbd_trash_image_...
go
func GetTrashList(ioctx *rados.IOContext) ([]TrashInfo, error) { var num_entries C.size_t // Call rbd_trash_list with nil pointer to get number of trash entries. if C.rbd_trash_list(C.rados_ioctx_t(ioctx.Pointer()), nil, &num_entries); num_entries == 0 { return nil, nil } c_entries := make([]C.rbd_trash_image_...
[ "func", "GetTrashList", "(", "ioctx", "*", "rados", ".", "IOContext", ")", "(", "[", "]", "TrashInfo", ",", "error", ")", "{", "var", "num_entries", "C", ".", "size_t", "\n\n", "// Call rbd_trash_list with nil pointer to get number of trash entries.", "if", "C", "...
// GetTrashList returns a slice of TrashInfo structs, containing information about all RBD images // currently residing in the trash.
[ "GetTrashList", "returns", "a", "slice", "of", "TrashInfo", "structs", "containing", "information", "about", "all", "RBD", "images", "currently", "residing", "in", "the", "trash", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rbd/rbd.go#L944-L972
28,587
ceph/go-ceph
rbd/rbd.go
TrashRemove
func TrashRemove(ioctx *rados.IOContext, id string, force bool) error { c_id := C.CString(id) defer C.free(unsafe.Pointer(c_id)) return GetError(C.rbd_trash_remove(C.rados_ioctx_t(ioctx.Pointer()), c_id, C.bool(force))) }
go
func TrashRemove(ioctx *rados.IOContext, id string, force bool) error { c_id := C.CString(id) defer C.free(unsafe.Pointer(c_id)) return GetError(C.rbd_trash_remove(C.rados_ioctx_t(ioctx.Pointer()), c_id, C.bool(force))) }
[ "func", "TrashRemove", "(", "ioctx", "*", "rados", ".", "IOContext", ",", "id", "string", ",", "force", "bool", ")", "error", "{", "c_id", ":=", "C", ".", "CString", "(", "id", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(...
// TrashRemove permanently deletes the trashed RBD with the specified id.
[ "TrashRemove", "permanently", "deletes", "the", "trashed", "RBD", "with", "the", "specified", "id", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rbd/rbd.go#L975-L980
28,588
ceph/go-ceph
rbd/rbd.go
TrashRestore
func TrashRestore(ioctx *rados.IOContext, id, name string) error { c_id := C.CString(id) c_name := C.CString(name) defer C.free(unsafe.Pointer(c_id)) defer C.free(unsafe.Pointer(c_name)) return GetError(C.rbd_trash_restore(C.rados_ioctx_t(ioctx.Pointer()), c_id, c_name)) }
go
func TrashRestore(ioctx *rados.IOContext, id, name string) error { c_id := C.CString(id) c_name := C.CString(name) defer C.free(unsafe.Pointer(c_id)) defer C.free(unsafe.Pointer(c_name)) return GetError(C.rbd_trash_restore(C.rados_ioctx_t(ioctx.Pointer()), c_id, c_name)) }
[ "func", "TrashRestore", "(", "ioctx", "*", "rados", ".", "IOContext", ",", "id", ",", "name", "string", ")", "error", "{", "c_id", ":=", "C", ".", "CString", "(", "id", ")", "\n", "c_name", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer"...
// TrashRestore restores the trashed RBD with the specified id back to the pool from whence it // came, with the specified new name.
[ "TrashRestore", "restores", "the", "trashed", "RBD", "with", "the", "specified", "id", "back", "to", "the", "pool", "from", "whence", "it", "came", "with", "the", "specified", "new", "name", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rbd/rbd.go#L984-L991
28,589
ceph/go-ceph
rados/rados.go
Version
func Version() (int, int, int) { var c_major, c_minor, c_patch C.int C.rados_version(&c_major, &c_minor, &c_patch) return int(c_major), int(c_minor), int(c_patch) }
go
func Version() (int, int, int) { var c_major, c_minor, c_patch C.int C.rados_version(&c_major, &c_minor, &c_patch) return int(c_major), int(c_minor), int(c_patch) }
[ "func", "Version", "(", ")", "(", "int", ",", "int", ",", "int", ")", "{", "var", "c_major", ",", "c_minor", ",", "c_patch", "C", ".", "int", "\n", "C", ".", "rados_version", "(", "&", "c_major", ",", "&", "c_minor", ",", "&", "c_patch", ")", "\n...
// Version returns the major, minor, and patch components of the version of // the RADOS library linked against.
[ "Version", "returns", "the", "major", "minor", "and", "patch", "components", "of", "the", "version", "of", "the", "RADOS", "library", "linked", "against", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rados/rados.go#L34-L38
28,590
ceph/go-ceph
rados/rados.go
NewConnWithClusterAndUser
func NewConnWithClusterAndUser(clusterName string, userName string) (*Conn, error) { c_cluster_name := C.CString(clusterName) defer C.free(unsafe.Pointer(c_cluster_name)) c_name := C.CString(userName) defer C.free(unsafe.Pointer(c_name)) conn := makeConn() ret := C.rados_create2(&conn.cluster, c_cluster_name, c...
go
func NewConnWithClusterAndUser(clusterName string, userName string) (*Conn, error) { c_cluster_name := C.CString(clusterName) defer C.free(unsafe.Pointer(c_cluster_name)) c_name := C.CString(userName) defer C.free(unsafe.Pointer(c_name)) conn := makeConn() ret := C.rados_create2(&conn.cluster, c_cluster_name, c...
[ "func", "NewConnWithClusterAndUser", "(", "clusterName", "string", ",", "userName", "string", ")", "(", "*", "Conn", ",", "error", ")", "{", "c_cluster_name", ":=", "C", ".", "CString", "(", "clusterName", ")", "\n", "defer", "C", ".", "free", "(", "unsafe...
// NewConnWithClusterAndUser creates a new connection object for a specific cluster and username. // It returns the connection and an error, if any.
[ "NewConnWithClusterAndUser", "creates", "a", "new", "connection", "object", "for", "a", "specific", "cluster", "and", "username", ".", "It", "returns", "the", "connection", "and", "an", "error", "if", "any", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rados/rados.go#L71-L85
28,591
ceph/go-ceph
cephfs/cephfs.go
CreateMount
func CreateMount() (*MountInfo, error) { mount := &MountInfo{} ret := C.ceph_create(&mount.mount, nil) if ret != 0 { log.Errorf("CreateMount: Failed to create mount") return nil, cephError(ret) } return mount, nil }
go
func CreateMount() (*MountInfo, error) { mount := &MountInfo{} ret := C.ceph_create(&mount.mount, nil) if ret != 0 { log.Errorf("CreateMount: Failed to create mount") return nil, cephError(ret) } return mount, nil }
[ "func", "CreateMount", "(", ")", "(", "*", "MountInfo", ",", "error", ")", "{", "mount", ":=", "&", "MountInfo", "{", "}", "\n", "ret", ":=", "C", ".", "ceph_create", "(", "&", "mount", ".", "mount", ",", "nil", ")", "\n", "if", "ret", "!=", "0",...
// CreateMount creates a mount handle for interacting with Ceph.
[ "CreateMount", "creates", "a", "mount", "handle", "for", "interacting", "with", "Ceph", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/cephfs/cephfs.go#L35-L43
28,592
ceph/go-ceph
cephfs/cephfs.go
ReadDefaultConfigFile
func (mount *MountInfo) ReadDefaultConfigFile() error { ret := C.ceph_conf_read_file(mount.mount, nil) if ret != 0 { log.Errorf("ReadDefaultConfigFile: Failed to read ceph config") return cephError(ret) } return nil }
go
func (mount *MountInfo) ReadDefaultConfigFile() error { ret := C.ceph_conf_read_file(mount.mount, nil) if ret != 0 { log.Errorf("ReadDefaultConfigFile: Failed to read ceph config") return cephError(ret) } return nil }
[ "func", "(", "mount", "*", "MountInfo", ")", "ReadDefaultConfigFile", "(", ")", "error", "{", "ret", ":=", "C", ".", "ceph_conf_read_file", "(", "mount", ".", "mount", ",", "nil", ")", "\n", "if", "ret", "!=", "0", "{", "log", ".", "Errorf", "(", "\"...
// ReadDefaultConfigFile loads the ceph configuration from the specified config file.
[ "ReadDefaultConfigFile", "loads", "the", "ceph", "configuration", "from", "the", "specified", "config", "file", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/cephfs/cephfs.go#L46-L53
28,593
ceph/go-ceph
cephfs/cephfs.go
Mount
func (mount *MountInfo) Mount() error { ret := C.ceph_mount(mount.mount, nil) if ret != 0 { log.Errorf("Mount: Failed to mount") return cephError(ret) } return nil }
go
func (mount *MountInfo) Mount() error { ret := C.ceph_mount(mount.mount, nil) if ret != 0 { log.Errorf("Mount: Failed to mount") return cephError(ret) } return nil }
[ "func", "(", "mount", "*", "MountInfo", ")", "Mount", "(", ")", "error", "{", "ret", ":=", "C", ".", "ceph_mount", "(", "mount", ".", "mount", ",", "nil", ")", "\n", "if", "ret", "!=", "0", "{", "log", ".", "Errorf", "(", "\"", "\"", ")", "\n",...
// Mount mounts the mount handle.
[ "Mount", "mounts", "the", "mount", "handle", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/cephfs/cephfs.go#L56-L63
28,594
ceph/go-ceph
cephfs/cephfs.go
Unmount
func (mount *MountInfo) Unmount() error { ret := C.ceph_unmount(mount.mount) if ret != 0 { log.Errorf("Unmount: Failed to unmount") return cephError(ret) } return nil }
go
func (mount *MountInfo) Unmount() error { ret := C.ceph_unmount(mount.mount) if ret != 0 { log.Errorf("Unmount: Failed to unmount") return cephError(ret) } return nil }
[ "func", "(", "mount", "*", "MountInfo", ")", "Unmount", "(", ")", "error", "{", "ret", ":=", "C", ".", "ceph_unmount", "(", "mount", ".", "mount", ")", "\n", "if", "ret", "!=", "0", "{", "log", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return",...
// Unmount unmounts the mount handle.
[ "Unmount", "unmounts", "the", "mount", "handle", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/cephfs/cephfs.go#L66-L73
28,595
ceph/go-ceph
cephfs/cephfs.go
Release
func (mount *MountInfo) Release() error { ret := C.ceph_release(mount.mount) if ret != 0 { log.Errorf("Release: Failed to release mount") return cephError(ret) } return nil }
go
func (mount *MountInfo) Release() error { ret := C.ceph_release(mount.mount) if ret != 0 { log.Errorf("Release: Failed to release mount") return cephError(ret) } return nil }
[ "func", "(", "mount", "*", "MountInfo", ")", "Release", "(", ")", "error", "{", "ret", ":=", "C", ".", "ceph_release", "(", "mount", ".", "mount", ")", "\n", "if", "ret", "!=", "0", "{", "log", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return",...
// Release destroys the mount handle.
[ "Release", "destroys", "the", "mount", "handle", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/cephfs/cephfs.go#L76-L83
28,596
ceph/go-ceph
cephfs/cephfs.go
SyncFs
func (mount *MountInfo) SyncFs() error { ret := C.ceph_sync_fs(mount.mount) if ret != 0 { log.Errorf("Mount: Failed to sync filesystem") return cephError(ret) } return nil }
go
func (mount *MountInfo) SyncFs() error { ret := C.ceph_sync_fs(mount.mount) if ret != 0 { log.Errorf("Mount: Failed to sync filesystem") return cephError(ret) } return nil }
[ "func", "(", "mount", "*", "MountInfo", ")", "SyncFs", "(", ")", "error", "{", "ret", ":=", "C", ".", "ceph_sync_fs", "(", "mount", ".", "mount", ")", "\n", "if", "ret", "!=", "0", "{", "log", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", ...
// SyncFs synchronizes all filesystem data to persistent media.
[ "SyncFs", "synchronizes", "all", "filesystem", "data", "to", "persistent", "media", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/cephfs/cephfs.go#L86-L93
28,597
ceph/go-ceph
cephfs/cephfs.go
CurrentDir
func (mount *MountInfo) CurrentDir() string { cDir := C.ceph_getcwd(mount.mount) return C.GoString(cDir) }
go
func (mount *MountInfo) CurrentDir() string { cDir := C.ceph_getcwd(mount.mount) return C.GoString(cDir) }
[ "func", "(", "mount", "*", "MountInfo", ")", "CurrentDir", "(", ")", "string", "{", "cDir", ":=", "C", ".", "ceph_getcwd", "(", "mount", ".", "mount", ")", "\n", "return", "C", ".", "GoString", "(", "cDir", ")", "\n", "}" ]
// CurrentDir gets the current working directory.
[ "CurrentDir", "gets", "the", "current", "working", "directory", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/cephfs/cephfs.go#L96-L99
28,598
ceph/go-ceph
cephfs/cephfs.go
ChangeDir
func (mount *MountInfo) ChangeDir(path string) error { cPath := C.CString(path) defer C.free(unsafe.Pointer(cPath)) ret := C.ceph_chdir(mount.mount, cPath) if ret != 0 { log.Errorf("ChangeDir: Failed to change directory") return cephError(ret) } return nil }
go
func (mount *MountInfo) ChangeDir(path string) error { cPath := C.CString(path) defer C.free(unsafe.Pointer(cPath)) ret := C.ceph_chdir(mount.mount, cPath) if ret != 0 { log.Errorf("ChangeDir: Failed to change directory") return cephError(ret) } return nil }
[ "func", "(", "mount", "*", "MountInfo", ")", "ChangeDir", "(", "path", "string", ")", "error", "{", "cPath", ":=", "C", ".", "CString", "(", "path", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cPath", ")", ")", "\n\n"...
// ChangeDir changes the current working directory.
[ "ChangeDir", "changes", "the", "current", "working", "directory", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/cephfs/cephfs.go#L102-L112
28,599
ceph/go-ceph
cephfs/cephfs.go
MakeDir
func (mount *MountInfo) MakeDir(path string, mode uint32) error { cPath := C.CString(path) defer C.free(unsafe.Pointer(cPath)) ret := C.ceph_mkdir(mount.mount, cPath, C.mode_t(mode)) if ret != 0 { log.Errorf("MakeDir: Failed to make directory %s", path) return cephError(ret) } return nil }
go
func (mount *MountInfo) MakeDir(path string, mode uint32) error { cPath := C.CString(path) defer C.free(unsafe.Pointer(cPath)) ret := C.ceph_mkdir(mount.mount, cPath, C.mode_t(mode)) if ret != 0 { log.Errorf("MakeDir: Failed to make directory %s", path) return cephError(ret) } return nil }
[ "func", "(", "mount", "*", "MountInfo", ")", "MakeDir", "(", "path", "string", ",", "mode", "uint32", ")", "error", "{", "cPath", ":=", "C", ".", "CString", "(", "path", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cPa...
// MakeDir creates a directory.
[ "MakeDir", "creates", "a", "directory", "." ]
e32f9f0f2e941422937c0a6c4f0a61b8f0c82995
https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/cephfs/cephfs.go#L115-L125