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
partition
stringclasses
1 value
howeyc/fsnotify
fsnotify_bsd.go
Close
func (w *Watcher) Close() error { w.mu.Lock() if w.isClosed { w.mu.Unlock() return nil } w.isClosed = true w.mu.Unlock() // Send "quit" message to the reader goroutine w.done <- true w.wmut.Lock() ws := w.watches w.wmut.Unlock() for path := range ws { w.removeWatch(path) } return nil }
go
func (w *Watcher) Close() error { w.mu.Lock() if w.isClosed { w.mu.Unlock() return nil } w.isClosed = true w.mu.Unlock() // Send "quit" message to the reader goroutine w.done <- true w.wmut.Lock() ws := w.watches w.wmut.Unlock() for path := range ws { w.removeWatch(path) } return nil }
[ "func", "(", "w", "*", "Watcher", ")", "Close", "(", ")", "error", "{", "w", ".", "mu", ".", "Lock", "(", ")", "\n", "if", "w", ".", "isClosed", "{", "w", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "nil", "\n", "}", "\n", "w", ".",...
// Close closes a kevent watcher instance // It sends a message to the reader goroutine to quit and removes all watches // associated with the kevent instance
[ "Close", "closes", "a", "kevent", "watcher", "instance", "It", "sends", "a", "message", "to", "the", "reader", "goroutine", "to", "quit", "and", "removes", "all", "watches", "associated", "with", "the", "kevent", "instance" ]
f0c08ee9c60704c1879025f2ae0ff3e000082c13
https://github.com/howeyc/fsnotify/blob/f0c08ee9c60704c1879025f2ae0ff3e000082c13/fsnotify_bsd.go#L113-L132
train
howeyc/fsnotify
fsnotify_bsd.go
sendDirectoryChangeEvents
func (w *Watcher) sendDirectoryChangeEvents(dirPath string) { // Get all files files, err := ioutil.ReadDir(dirPath) if err != nil { w.Error <- err } // Search for new files for _, fileInfo := range files { filePath := filepath.Join(dirPath, fileInfo.Name()) w.femut.Lock() _, doesExist := w.fileExists[fi...
go
func (w *Watcher) sendDirectoryChangeEvents(dirPath string) { // Get all files files, err := ioutil.ReadDir(dirPath) if err != nil { w.Error <- err } // Search for new files for _, fileInfo := range files { filePath := filepath.Join(dirPath, fileInfo.Name()) w.femut.Lock() _, doesExist := w.fileExists[fi...
[ "func", "(", "w", "*", "Watcher", ")", "sendDirectoryChangeEvents", "(", "dirPath", "string", ")", "{", "// Get all files", "files", ",", "err", ":=", "ioutil", ".", "ReadDir", "(", "dirPath", ")", "\n", "if", "err", "!=", "nil", "{", "w", ".", "Error", ...
// sendDirectoryEvents searches the directory for newly created files // and sends them over the event channel. This functionality is to have // the BSD version of fsnotify match linux fsnotify which provides a // create event for files created in a watched directory.
[ "sendDirectoryEvents", "searches", "the", "directory", "for", "newly", "created", "files", "and", "sends", "them", "over", "the", "event", "channel", ".", "This", "functionality", "is", "to", "have", "the", "BSD", "version", "of", "fsnotify", "match", "linux", ...
f0c08ee9c60704c1879025f2ae0ff3e000082c13
https://github.com/howeyc/fsnotify/blob/f0c08ee9c60704c1879025f2ae0ff3e000082c13/fsnotify_bsd.go#L462-L496
train
coreos/go-oidc
jwks.go
NewRemoteKeySet
func NewRemoteKeySet(ctx context.Context, jwksURL string) KeySet { return newRemoteKeySet(ctx, jwksURL, time.Now) }
go
func NewRemoteKeySet(ctx context.Context, jwksURL string) KeySet { return newRemoteKeySet(ctx, jwksURL, time.Now) }
[ "func", "NewRemoteKeySet", "(", "ctx", "context", ".", "Context", ",", "jwksURL", "string", ")", "KeySet", "{", "return", "newRemoteKeySet", "(", "ctx", ",", "jwksURL", ",", "time", ".", "Now", ")", "\n", "}" ]
// NewRemoteKeySet returns a KeySet that can validate JSON web tokens by using HTTP // GETs to fetch JSON web token sets hosted at a remote URL. This is automatically // used by NewProvider using the URLs returned by OpenID Connect discovery, but is // exposed for providers that don't support discovery or to prevent ro...
[ "NewRemoteKeySet", "returns", "a", "KeySet", "that", "can", "validate", "JSON", "web", "tokens", "by", "using", "HTTP", "GETs", "to", "fetch", "JSON", "web", "token", "sets", "hosted", "at", "a", "remote", "URL", ".", "This", "is", "automatically", "used", ...
66476e0267012774b2f9767d2d37a317d1f1aac3
https://github.com/coreos/go-oidc/blob/66476e0267012774b2f9767d2d37a317d1f1aac3/jwks.go#L36-L38
train
coreos/go-oidc
jwks.go
done
func (i *inflight) done(keys []jose.JSONWebKey, err error) { i.keys = keys i.err = err close(i.doneCh) }
go
func (i *inflight) done(keys []jose.JSONWebKey, err error) { i.keys = keys i.err = err close(i.doneCh) }
[ "func", "(", "i", "*", "inflight", ")", "done", "(", "keys", "[", "]", "jose", ".", "JSONWebKey", ",", "err", "error", ")", "{", "i", ".", "keys", "=", "keys", "\n", "i", ".", "err", "=", "err", "\n", "close", "(", "i", ".", "doneCh", ")", "\...
// done can only be called by a single goroutine. It records the result of the // inflight request and signals other goroutines that the result is safe to // inspect.
[ "done", "can", "only", "be", "called", "by", "a", "single", "goroutine", ".", "It", "records", "the", "result", "of", "the", "inflight", "request", "and", "signals", "other", "goroutines", "that", "the", "result", "is", "safe", "to", "inspect", "." ]
66476e0267012774b2f9767d2d37a317d1f1aac3
https://github.com/coreos/go-oidc/blob/66476e0267012774b2f9767d2d37a317d1f1aac3/jwks.go#L85-L89
train
coreos/go-oidc
jwks.go
keysFromRemote
func (r *remoteKeySet) keysFromRemote(ctx context.Context) ([]jose.JSONWebKey, error) { // Need to lock to inspect the inflight request field. r.mu.Lock() // If there's not a current inflight request, create one. if r.inflight == nil { r.inflight = newInflight() // This goroutine has exclusive ownership over t...
go
func (r *remoteKeySet) keysFromRemote(ctx context.Context) ([]jose.JSONWebKey, error) { // Need to lock to inspect the inflight request field. r.mu.Lock() // If there's not a current inflight request, create one. if r.inflight == nil { r.inflight = newInflight() // This goroutine has exclusive ownership over t...
[ "func", "(", "r", "*", "remoteKeySet", ")", "keysFromRemote", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "jose", ".", "JSONWebKey", ",", "error", ")", "{", "// Need to lock to inspect the inflight request field.", "r", ".", "mu", ".", "Lock", ...
// keysFromRemote syncs the key set from the remote set, records the values in the // cache, and returns the key set.
[ "keysFromRemote", "syncs", "the", "key", "set", "from", "the", "remote", "set", "records", "the", "values", "in", "the", "cache", "and", "returns", "the", "key", "set", "." ]
66476e0267012774b2f9767d2d37a317d1f1aac3
https://github.com/coreos/go-oidc/blob/66476e0267012774b2f9767d2d37a317d1f1aac3/jwks.go#L151-L190
train
coreos/go-oidc
verify.go
Verifier
func (p *Provider) Verifier(config *Config) *IDTokenVerifier { return NewVerifier(p.issuer, p.remoteKeySet, config) }
go
func (p *Provider) Verifier(config *Config) *IDTokenVerifier { return NewVerifier(p.issuer, p.remoteKeySet, config) }
[ "func", "(", "p", "*", "Provider", ")", "Verifier", "(", "config", "*", "Config", ")", "*", "IDTokenVerifier", "{", "return", "NewVerifier", "(", "p", ".", "issuer", ",", "p", ".", "remoteKeySet", ",", "config", ")", "\n", "}" ]
// Verifier returns an IDTokenVerifier that uses the provider's key set to verify JWTs. // // The returned IDTokenVerifier is tied to the Provider's context and its behavior is // undefined once the Provider's context is canceled.
[ "Verifier", "returns", "an", "IDTokenVerifier", "that", "uses", "the", "provider", "s", "key", "set", "to", "verify", "JWTs", ".", "The", "returned", "IDTokenVerifier", "is", "tied", "to", "the", "Provider", "s", "context", "and", "its", "behavior", "is", "u...
66476e0267012774b2f9767d2d37a317d1f1aac3
https://github.com/coreos/go-oidc/blob/66476e0267012774b2f9767d2d37a317d1f1aac3/verify.go#L98-L100
train
coreos/go-oidc
verify.go
resolveDistributedClaim
func resolveDistributedClaim(ctx context.Context, verifier *IDTokenVerifier, src claimSource) ([]byte, error) { req, err := http.NewRequest("GET", src.Endpoint, nil) if err != nil { return nil, fmt.Errorf("malformed request: %v", err) } if src.AccessToken != "" { req.Header.Set("Authorization", "Bearer "+src.Ac...
go
func resolveDistributedClaim(ctx context.Context, verifier *IDTokenVerifier, src claimSource) ([]byte, error) { req, err := http.NewRequest("GET", src.Endpoint, nil) if err != nil { return nil, fmt.Errorf("malformed request: %v", err) } if src.AccessToken != "" { req.Header.Set("Authorization", "Bearer "+src.Ac...
[ "func", "resolveDistributedClaim", "(", "ctx", "context", ".", "Context", ",", "verifier", "*", "IDTokenVerifier", ",", "src", "claimSource", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "req", ",", "err", ":=", "http", ".", "NewRequest", "(", "\"...
// Returns the Claims from the distributed JWT token
[ "Returns", "the", "Claims", "from", "the", "distributed", "JWT", "token" ]
66476e0267012774b2f9767d2d37a317d1f1aac3
https://github.com/coreos/go-oidc/blob/66476e0267012774b2f9767d2d37a317d1f1aac3/verify.go#L124-L154
train
coreos/go-oidc
oidc.go
Claims
func (u *UserInfo) Claims(v interface{}) error { if u.claims == nil { return errors.New("oidc: claims not set") } return json.Unmarshal(u.claims, v) }
go
func (u *UserInfo) Claims(v interface{}) error { if u.claims == nil { return errors.New("oidc: claims not set") } return json.Unmarshal(u.claims, v) }
[ "func", "(", "u", "*", "UserInfo", ")", "Claims", "(", "v", "interface", "{", "}", ")", "error", "{", "if", "u", ".", "claims", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "json", ".", "Unm...
// Claims unmarshals the raw JSON object claims into the provided object.
[ "Claims", "unmarshals", "the", "raw", "JSON", "object", "claims", "into", "the", "provided", "object", "." ]
66476e0267012774b2f9767d2d37a317d1f1aac3
https://github.com/coreos/go-oidc/blob/66476e0267012774b2f9767d2d37a317d1f1aac3/oidc.go#L172-L177
train
scylladb/gocqlx
qb/utils.go
placeholders
func placeholders(cql *bytes.Buffer, count int) { if count < 1 { return } for i := 0; i < count-1; i++ { cql.WriteByte('?') cql.WriteByte(',') } cql.WriteByte('?') }
go
func placeholders(cql *bytes.Buffer, count int) { if count < 1 { return } for i := 0; i < count-1; i++ { cql.WriteByte('?') cql.WriteByte(',') } cql.WriteByte('?') }
[ "func", "placeholders", "(", "cql", "*", "bytes", ".", "Buffer", ",", "count", "int", ")", "{", "if", "count", "<", "1", "{", "return", "\n", "}", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "count", "-", "1", ";", "i", "++", "{", "cql", "....
// placeholders returns a string with count ? placeholders joined with commas.
[ "placeholders", "returns", "a", "string", "with", "count", "?", "placeholders", "joined", "with", "commas", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/utils.go#L12-L22
train
scylladb/gocqlx
qb/update.go
Table
func (b *UpdateBuilder) Table(table string) *UpdateBuilder { b.table = table return b }
go
func (b *UpdateBuilder) Table(table string) *UpdateBuilder { b.table = table return b }
[ "func", "(", "b", "*", "UpdateBuilder", ")", "Table", "(", "table", "string", ")", "*", "UpdateBuilder", "{", "b", ".", "table", "=", "table", "\n", "return", "b", "\n", "}" ]
// Table sets the table to be updated.
[ "Table", "sets", "the", "table", "to", "be", "updated", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/update.go#L77-L80
train
scylladb/gocqlx
qb/update.go
Set
func (b *UpdateBuilder) Set(columns ...string) *UpdateBuilder { for _, c := range columns { b.assignments = append(b.assignments, assignment{ column: c, value: param(c), }) } return b }
go
func (b *UpdateBuilder) Set(columns ...string) *UpdateBuilder { for _, c := range columns { b.assignments = append(b.assignments, assignment{ column: c, value: param(c), }) } return b }
[ "func", "(", "b", "*", "UpdateBuilder", ")", "Set", "(", "columns", "...", "string", ")", "*", "UpdateBuilder", "{", "for", "_", ",", "c", ":=", "range", "columns", "{", "b", ".", "assignments", "=", "append", "(", "b", ".", "assignments", ",", "assi...
// Set adds SET clauses to the query.
[ "Set", "adds", "SET", "clauses", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/update.go#L108-L117
train
scylladb/gocqlx
qb/update.go
SetNamed
func (b *UpdateBuilder) SetNamed(column, name string) *UpdateBuilder { b.assignments = append( b.assignments, assignment{column: column, value: param(name)}) return b }
go
func (b *UpdateBuilder) SetNamed(column, name string) *UpdateBuilder { b.assignments = append( b.assignments, assignment{column: column, value: param(name)}) return b }
[ "func", "(", "b", "*", "UpdateBuilder", ")", "SetNamed", "(", "column", ",", "name", "string", ")", "*", "UpdateBuilder", "{", "b", ".", "assignments", "=", "append", "(", "b", ".", "assignments", ",", "assignment", "{", "column", ":", "column", ",", "...
// SetNamed adds SET column=? clause to the query with a custom parameter name.
[ "SetNamed", "adds", "SET", "column", "=", "?", "clause", "to", "the", "query", "with", "a", "custom", "parameter", "name", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/update.go#L120-L124
train
scylladb/gocqlx
qb/update.go
SetLit
func (b *UpdateBuilder) SetLit(column, literal string) *UpdateBuilder { b.assignments = append( b.assignments, assignment{column: column, value: lit(literal)}) return b }
go
func (b *UpdateBuilder) SetLit(column, literal string) *UpdateBuilder { b.assignments = append( b.assignments, assignment{column: column, value: lit(literal)}) return b }
[ "func", "(", "b", "*", "UpdateBuilder", ")", "SetLit", "(", "column", ",", "literal", "string", ")", "*", "UpdateBuilder", "{", "b", ".", "assignments", "=", "append", "(", "b", ".", "assignments", ",", "assignment", "{", "column", ":", "column", ",", ...
// SetLit adds SET column=literal clause to the query.
[ "SetLit", "adds", "SET", "column", "=", "literal", "clause", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/update.go#L127-L131
train
scylladb/gocqlx
qb/update.go
Add
func (b *UpdateBuilder) Add(column string) *UpdateBuilder { return b.addValue(column, param(column)) }
go
func (b *UpdateBuilder) Add(column string) *UpdateBuilder { return b.addValue(column, param(column)) }
[ "func", "(", "b", "*", "UpdateBuilder", ")", "Add", "(", "column", "string", ")", "*", "UpdateBuilder", "{", "return", "b", ".", "addValue", "(", "column", ",", "param", "(", "column", ")", ")", "\n", "}" ]
// Add adds SET column=column+? clauses to the query.
[ "Add", "adds", "SET", "column", "=", "column", "+", "?", "clauses", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/update.go#L140-L142
train
scylladb/gocqlx
qb/update.go
AddNamed
func (b *UpdateBuilder) AddNamed(column, name string) *UpdateBuilder { return b.addValue(column, param(name)) }
go
func (b *UpdateBuilder) AddNamed(column, name string) *UpdateBuilder { return b.addValue(column, param(name)) }
[ "func", "(", "b", "*", "UpdateBuilder", ")", "AddNamed", "(", "column", ",", "name", "string", ")", "*", "UpdateBuilder", "{", "return", "b", ".", "addValue", "(", "column", ",", "param", "(", "name", ")", ")", "\n", "}" ]
// AddNamed adds SET column=column+? clauses to the query with a custom // parameter name.
[ "AddNamed", "adds", "SET", "column", "=", "column", "+", "?", "clauses", "to", "the", "query", "with", "a", "custom", "parameter", "name", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/update.go#L146-L148
train
scylladb/gocqlx
qb/update.go
AddLit
func (b *UpdateBuilder) AddLit(column, literal string) *UpdateBuilder { return b.addValue(column, lit(literal)) }
go
func (b *UpdateBuilder) AddLit(column, literal string) *UpdateBuilder { return b.addValue(column, lit(literal)) }
[ "func", "(", "b", "*", "UpdateBuilder", ")", "AddLit", "(", "column", ",", "literal", "string", ")", "*", "UpdateBuilder", "{", "return", "b", ".", "addValue", "(", "column", ",", "lit", "(", "literal", ")", ")", "\n", "}" ]
// AddLit adds SET column=column+literal clauses to the query.
[ "AddLit", "adds", "SET", "column", "=", "column", "+", "literal", "clauses", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/update.go#L151-L153
train
scylladb/gocqlx
qb/update.go
Remove
func (b *UpdateBuilder) Remove(column string) *UpdateBuilder { return b.removeValue(column, param(column)) }
go
func (b *UpdateBuilder) Remove(column string) *UpdateBuilder { return b.removeValue(column, param(column)) }
[ "func", "(", "b", "*", "UpdateBuilder", ")", "Remove", "(", "column", "string", ")", "*", "UpdateBuilder", "{", "return", "b", ".", "removeValue", "(", "column", ",", "param", "(", "column", ")", ")", "\n", "}" ]
// Remove adds SET column=column-? clauses to the query.
[ "Remove", "adds", "SET", "column", "=", "column", "-", "?", "clauses", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/update.go#L170-L172
train
scylladb/gocqlx
qb/update.go
RemoveNamed
func (b *UpdateBuilder) RemoveNamed(column, name string) *UpdateBuilder { return b.removeValue(column, param(name)) }
go
func (b *UpdateBuilder) RemoveNamed(column, name string) *UpdateBuilder { return b.removeValue(column, param(name)) }
[ "func", "(", "b", "*", "UpdateBuilder", ")", "RemoveNamed", "(", "column", ",", "name", "string", ")", "*", "UpdateBuilder", "{", "return", "b", ".", "removeValue", "(", "column", ",", "param", "(", "name", ")", ")", "\n", "}" ]
// RemoveNamed adds SET column=column-? clauses to the query with a custom // parameter name.
[ "RemoveNamed", "adds", "SET", "column", "=", "column", "-", "?", "clauses", "to", "the", "query", "with", "a", "custom", "parameter", "name", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/update.go#L176-L178
train
scylladb/gocqlx
qb/update.go
RemoveLit
func (b *UpdateBuilder) RemoveLit(column, literal string) *UpdateBuilder { return b.removeValue(column, lit(literal)) }
go
func (b *UpdateBuilder) RemoveLit(column, literal string) *UpdateBuilder { return b.removeValue(column, lit(literal)) }
[ "func", "(", "b", "*", "UpdateBuilder", ")", "RemoveLit", "(", "column", ",", "literal", "string", ")", "*", "UpdateBuilder", "{", "return", "b", ".", "removeValue", "(", "column", ",", "lit", "(", "literal", ")", ")", "\n", "}" ]
// RemoveLit adds SET column=column-literal clauses to the query.
[ "RemoveLit", "adds", "SET", "column", "=", "column", "-", "literal", "clauses", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/update.go#L181-L183
train
scylladb/gocqlx
queryx.go
Query
func Query(q *gocql.Query, names []string) *Queryx { return &Queryx{ Query: q, Names: names, Mapper: DefaultMapper, } }
go
func Query(q *gocql.Query, names []string) *Queryx { return &Queryx{ Query: q, Names: names, Mapper: DefaultMapper, } }
[ "func", "Query", "(", "q", "*", "gocql", ".", "Query", ",", "names", "[", "]", "string", ")", "*", "Queryx", "{", "return", "&", "Queryx", "{", "Query", ":", "q", ",", "Names", ":", "names", ",", "Mapper", ":", "DefaultMapper", ",", "}", "\n", "}...
// Query creates a new Queryx from gocql.Query using a default mapper.
[ "Query", "creates", "a", "new", "Queryx", "from", "gocql", ".", "Query", "using", "a", "default", "mapper", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/queryx.go#L92-L98
train
scylladb/gocqlx
queryx.go
BindStruct
func (q *Queryx) BindStruct(arg interface{}) *Queryx { arglist, err := bindStructArgs(q.Names, arg, nil, q.Mapper) if err != nil { q.err = fmt.Errorf("bind error: %s", err) } else { q.err = nil q.Bind(arglist...) } return q }
go
func (q *Queryx) BindStruct(arg interface{}) *Queryx { arglist, err := bindStructArgs(q.Names, arg, nil, q.Mapper) if err != nil { q.err = fmt.Errorf("bind error: %s", err) } else { q.err = nil q.Bind(arglist...) } return q }
[ "func", "(", "q", "*", "Queryx", ")", "BindStruct", "(", "arg", "interface", "{", "}", ")", "*", "Queryx", "{", "arglist", ",", "err", ":=", "bindStructArgs", "(", "q", ".", "Names", ",", "arg", ",", "nil", ",", "q", ".", "Mapper", ")", "\n", "if...
// BindStruct binds query named parameters to values from arg using mapper. If // value cannot be found error is reported.
[ "BindStruct", "binds", "query", "named", "parameters", "to", "values", "from", "arg", "using", "mapper", ".", "If", "value", "cannot", "be", "found", "error", "is", "reported", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/queryx.go#L102-L112
train
scylladb/gocqlx
queryx.go
BindStructMap
func (q *Queryx) BindStructMap(arg0 interface{}, arg1 map[string]interface{}) *Queryx { arglist, err := bindStructArgs(q.Names, arg0, arg1, q.Mapper) if err != nil { q.err = fmt.Errorf("bind error: %s", err) } else { q.err = nil q.Bind(arglist...) } return q }
go
func (q *Queryx) BindStructMap(arg0 interface{}, arg1 map[string]interface{}) *Queryx { arglist, err := bindStructArgs(q.Names, arg0, arg1, q.Mapper) if err != nil { q.err = fmt.Errorf("bind error: %s", err) } else { q.err = nil q.Bind(arglist...) } return q }
[ "func", "(", "q", "*", "Queryx", ")", "BindStructMap", "(", "arg0", "interface", "{", "}", ",", "arg1", "map", "[", "string", "]", "interface", "{", "}", ")", "*", "Queryx", "{", "arglist", ",", "err", ":=", "bindStructArgs", "(", "q", ".", "Names", ...
// BindStructMap binds query named parameters to values from arg0 and arg1 // using a mapper. If value cannot be found in arg0 it's looked up in arg1 // before reporting an error.
[ "BindStructMap", "binds", "query", "named", "parameters", "to", "values", "from", "arg0", "and", "arg1", "using", "a", "mapper", ".", "If", "value", "cannot", "be", "found", "in", "arg0", "it", "s", "looked", "up", "in", "arg1", "before", "reporting", "an"...
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/queryx.go#L117-L127
train
scylladb/gocqlx
queryx.go
BindMap
func (q *Queryx) BindMap(arg map[string]interface{}) *Queryx { arglist, err := bindMapArgs(q.Names, arg) if err != nil { q.err = fmt.Errorf("bind error: %s", err) } else { q.err = nil q.Bind(arglist...) } return q }
go
func (q *Queryx) BindMap(arg map[string]interface{}) *Queryx { arglist, err := bindMapArgs(q.Names, arg) if err != nil { q.err = fmt.Errorf("bind error: %s", err) } else { q.err = nil q.Bind(arglist...) } return q }
[ "func", "(", "q", "*", "Queryx", ")", "BindMap", "(", "arg", "map", "[", "string", "]", "interface", "{", "}", ")", "*", "Queryx", "{", "arglist", ",", "err", ":=", "bindMapArgs", "(", "q", ".", "Names", ",", "arg", ")", "\n", "if", "err", "!=", ...
// BindMap binds query named parameters using map.
[ "BindMap", "binds", "query", "named", "parameters", "using", "map", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/queryx.go#L157-L167
train
scylladb/gocqlx
queryx.go
Exec
func (q *Queryx) Exec() error { if q.err != nil { return q.err } return q.Query.Exec() }
go
func (q *Queryx) Exec() error { if q.err != nil { return q.err } return q.Query.Exec() }
[ "func", "(", "q", "*", "Queryx", ")", "Exec", "(", ")", "error", "{", "if", "q", ".", "err", "!=", "nil", "{", "return", "q", ".", "err", "\n", "}", "\n", "return", "q", ".", "Query", ".", "Exec", "(", ")", "\n", "}" ]
// Exec executes the query without returning any rows.
[ "Exec", "executes", "the", "query", "without", "returning", "any", "rows", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/queryx.go#L188-L193
train
scylladb/gocqlx
queryx.go
Get
func (q *Queryx) Get(dest interface{}) error { if q.err != nil { return q.err } return Iter(q.Query).Get(dest) }
go
func (q *Queryx) Get(dest interface{}) error { if q.err != nil { return q.err } return Iter(q.Query).Get(dest) }
[ "func", "(", "q", "*", "Queryx", ")", "Get", "(", "dest", "interface", "{", "}", ")", "error", "{", "if", "q", ".", "err", "!=", "nil", "{", "return", "q", ".", "err", "\n", "}", "\n", "return", "Iter", "(", "q", ".", "Query", ")", ".", "Get"...
// Get scans first row into a destination. If the destination type is a struct // pointer, then Iter.StructScan will be used. If the destination is some // other type, then the row must only have one column which can scan into that // type. // // If no rows were selected, ErrNotFound is returned.
[ "Get", "scans", "first", "row", "into", "a", "destination", ".", "If", "the", "destination", "type", "is", "a", "struct", "pointer", "then", "Iter", ".", "StructScan", "will", "be", "used", ".", "If", "the", "destination", "is", "some", "other", "type", ...
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/queryx.go#L208-L213
train
scylladb/gocqlx
queryx.go
GetRelease
func (q *Queryx) GetRelease(dest interface{}) error { defer q.Release() return q.Get(dest) }
go
func (q *Queryx) GetRelease(dest interface{}) error { defer q.Release() return q.Get(dest) }
[ "func", "(", "q", "*", "Queryx", ")", "GetRelease", "(", "dest", "interface", "{", "}", ")", "error", "{", "defer", "q", ".", "Release", "(", ")", "\n", "return", "q", ".", "Get", "(", "dest", ")", "\n", "}" ]
// GetRelease calls Get and releases the query, a released query cannot be // reused.
[ "GetRelease", "calls", "Get", "and", "releases", "the", "query", "a", "released", "query", "cannot", "be", "reused", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/queryx.go#L217-L220
train
scylladb/gocqlx
queryx.go
SelectRelease
func (q *Queryx) SelectRelease(dest interface{}) error { defer q.Release() return q.Select(dest) }
go
func (q *Queryx) SelectRelease(dest interface{}) error { defer q.Release() return q.Select(dest) }
[ "func", "(", "q", "*", "Queryx", ")", "SelectRelease", "(", "dest", "interface", "{", "}", ")", "error", "{", "defer", "q", ".", "Release", "(", ")", "\n", "return", "q", ".", "Select", "(", "dest", ")", "\n", "}" ]
// SelectRelease calls Select and releases the query, a released query cannot be // reused.
[ "SelectRelease", "calls", "Select", "and", "releases", "the", "query", "a", "released", "query", "cannot", "be", "reused", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/queryx.go#L237-L240
train
scylladb/gocqlx
iterx.go
Get
func Get(dest interface{}, q *gocql.Query) error { return Iter(q).Get(dest) }
go
func Get(dest interface{}, q *gocql.Query) error { return Iter(q).Get(dest) }
[ "func", "Get", "(", "dest", "interface", "{", "}", ",", "q", "*", "gocql", ".", "Query", ")", "error", "{", "return", "Iter", "(", "q", ")", ".", "Get", "(", "dest", ")", "\n", "}" ]
// Get is a convenience function for creating iterator and calling Get. // // DEPRECATED use Queryx.Get or Queryx.GetRelease.
[ "Get", "is", "a", "convenience", "function", "for", "creating", "iterator", "and", "calling", "Get", ".", "DEPRECATED", "use", "Queryx", ".", "Get", "or", "Queryx", ".", "GetRelease", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/iterx.go#L19-L21
train
scylladb/gocqlx
iterx.go
Select
func Select(dest interface{}, q *gocql.Query) error { return Iter(q).Select(dest) }
go
func Select(dest interface{}, q *gocql.Query) error { return Iter(q).Select(dest) }
[ "func", "Select", "(", "dest", "interface", "{", "}", ",", "q", "*", "gocql", ".", "Query", ")", "error", "{", "return", "Iter", "(", "q", ")", ".", "Select", "(", "dest", ")", "\n", "}" ]
// Select is a convenience function for creating iterator and calling Select. // // DEPRECATED use Queryx.Select or Queryx.SelectRelease.
[ "Select", "is", "a", "convenience", "function", "for", "creating", "iterator", "and", "calling", "Select", ".", "DEPRECATED", "use", "Queryx", ".", "Select", "or", "Queryx", ".", "SelectRelease", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/iterx.go#L26-L28
train
scylladb/gocqlx
iterx.go
Iter
func Iter(q *gocql.Query) *Iterx { return &Iterx{ Iter: q.Iter(), Mapper: DefaultMapper, } }
go
func Iter(q *gocql.Query) *Iterx { return &Iterx{ Iter: q.Iter(), Mapper: DefaultMapper, } }
[ "func", "Iter", "(", "q", "*", "gocql", ".", "Query", ")", "*", "Iterx", "{", "return", "&", "Iterx", "{", "Iter", ":", "q", ".", "Iter", "(", ")", ",", "Mapper", ":", "DefaultMapper", ",", "}", "\n", "}" ]
// Iter creates a new Iterx from gocql.Query using a default mapper.
[ "Iter", "creates", "a", "new", "Iterx", "from", "gocql", ".", "Query", "using", "a", "default", "mapper", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/iterx.go#L44-L49
train
scylladb/gocqlx
iterx.go
Get
func (iter *Iterx) Get(dest interface{}) error { iter.scanAny(dest, false) iter.Close() return iter.checkErrAndNotFound() }
go
func (iter *Iterx) Get(dest interface{}) error { iter.scanAny(dest, false) iter.Close() return iter.checkErrAndNotFound() }
[ "func", "(", "iter", "*", "Iterx", ")", "Get", "(", "dest", "interface", "{", "}", ")", "error", "{", "iter", ".", "scanAny", "(", "dest", ",", "false", ")", "\n", "iter", ".", "Close", "(", ")", "\n\n", "return", "iter", ".", "checkErrAndNotFound", ...
// Get scans first row into a destination and closes the iterator. If the // destination type is a struct pointer, then StructScan will be used. // If the destination is some other type, then the row must only have one column // which can scan into that type. // // If no rows were selected, ErrNotFound is returned.
[ "Get", "scans", "first", "row", "into", "a", "destination", "and", "closes", "the", "iterator", ".", "If", "the", "destination", "type", "is", "a", "struct", "pointer", "then", "StructScan", "will", "be", "used", ".", "If", "the", "destination", "is", "som...
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/iterx.go#L65-L70
train
scylladb/gocqlx
iterx.go
Select
func (iter *Iterx) Select(dest interface{}) error { iter.scanAll(dest, false) iter.Close() return iter.err }
go
func (iter *Iterx) Select(dest interface{}) error { iter.scanAll(dest, false) iter.Close() return iter.err }
[ "func", "(", "iter", "*", "Iterx", ")", "Select", "(", "dest", "interface", "{", "}", ")", "error", "{", "iter", ".", "scanAll", "(", "dest", ",", "false", ")", "\n", "iter", ".", "Close", "(", ")", "\n\n", "return", "iter", ".", "err", "\n", "}"...
// Select scans all rows into a destination, which must be a pointer to slice // of any type and closes the iterator. If the destination slice type is // a struct, then StructScan will be used on each row. If the destination is // some other type, then each row must only have one column which can scan into // that type...
[ "Select", "scans", "all", "rows", "into", "a", "destination", "which", "must", "be", "a", "pointer", "to", "slice", "of", "any", "type", "and", "closes", "the", "iterator", ".", "If", "the", "destination", "slice", "type", "is", "a", "struct", "then", "S...
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/iterx.go#L115-L120
train
scylladb/gocqlx
queryx_wrap.go
SetSpeculativeExecutionPolicy
func (q *Queryx) SetSpeculativeExecutionPolicy(sp gocql.SpeculativeExecutionPolicy) *Queryx { q.Query.SetSpeculativeExecutionPolicy(sp) return q }
go
func (q *Queryx) SetSpeculativeExecutionPolicy(sp gocql.SpeculativeExecutionPolicy) *Queryx { q.Query.SetSpeculativeExecutionPolicy(sp) return q }
[ "func", "(", "q", "*", "Queryx", ")", "SetSpeculativeExecutionPolicy", "(", "sp", "gocql", ".", "SpeculativeExecutionPolicy", ")", "*", "Queryx", "{", "q", ".", "Query", ".", "SetSpeculativeExecutionPolicy", "(", "sp", ")", "\n", "return", "q", "\n", "}" ]
// SetSpeculativeExecutionPolicy sets the execution policy.
[ "SetSpeculativeExecutionPolicy", "sets", "the", "execution", "policy", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/queryx_wrap.go#L108-L111
train
scylladb/gocqlx
queryx_wrap.go
Bind
func (q *Queryx) Bind(v ...interface{}) *Queryx { q.Query.Bind(v...) return q }
go
func (q *Queryx) Bind(v ...interface{}) *Queryx { q.Query.Bind(v...) return q }
[ "func", "(", "q", "*", "Queryx", ")", "Bind", "(", "v", "...", "interface", "{", "}", ")", "*", "Queryx", "{", "q", ".", "Query", ".", "Bind", "(", "v", "...", ")", "\n", "return", "q", "\n", "}" ]
// Bind sets query arguments of query. This can also be used to rebind new query arguments // to an existing query instance.
[ "Bind", "sets", "query", "arguments", "of", "query", ".", "This", "can", "also", "be", "used", "to", "rebind", "new", "query", "arguments", "to", "an", "existing", "query", "instance", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/queryx_wrap.go#L122-L125
train
scylladb/gocqlx
qb/cmp.go
Eq
func Eq(column string) Cmp { return Cmp{ op: eq, column: column, value: param(column), } }
go
func Eq(column string) Cmp { return Cmp{ op: eq, column: column, value: param(column), } }
[ "func", "Eq", "(", "column", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "eq", ",", "column", ":", "column", ",", "value", ":", "param", "(", "column", ")", ",", "}", "\n", "}" ]
// Eq produces column=?.
[ "Eq", "produces", "column", "=", "?", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L61-L67
train
scylladb/gocqlx
qb/cmp.go
EqNamed
func EqNamed(column, name string) Cmp { return Cmp{ op: eq, column: column, value: param(name), } }
go
func EqNamed(column, name string) Cmp { return Cmp{ op: eq, column: column, value: param(name), } }
[ "func", "EqNamed", "(", "column", ",", "name", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "eq", ",", "column", ":", "column", ",", "value", ":", "param", "(", "name", ")", ",", "}", "\n", "}" ]
// EqNamed produces column=? with a custom parameter name.
[ "EqNamed", "produces", "column", "=", "?", "with", "a", "custom", "parameter", "name", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L70-L76
train
scylladb/gocqlx
qb/cmp.go
EqLit
func EqLit(column, literal string) Cmp { return Cmp{ op: eq, column: column, value: lit(literal), } }
go
func EqLit(column, literal string) Cmp { return Cmp{ op: eq, column: column, value: lit(literal), } }
[ "func", "EqLit", "(", "column", ",", "literal", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "eq", ",", "column", ":", "column", ",", "value", ":", "lit", "(", "literal", ")", ",", "}", "\n", "}" ]
// EqLit produces column=literal and does not add a parameter to the query.
[ "EqLit", "produces", "column", "=", "literal", "and", "does", "not", "add", "a", "parameter", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L79-L85
train
scylladb/gocqlx
qb/cmp.go
Lt
func Lt(column string) Cmp { return Cmp{ op: lt, column: column, value: param(column), } }
go
func Lt(column string) Cmp { return Cmp{ op: lt, column: column, value: param(column), } }
[ "func", "Lt", "(", "column", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "lt", ",", "column", ":", "column", ",", "value", ":", "param", "(", "column", ")", ",", "}", "\n", "}" ]
// Lt produces column<?.
[ "Lt", "produces", "column<?", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L97-L103
train
scylladb/gocqlx
qb/cmp.go
LtNamed
func LtNamed(column, name string) Cmp { return Cmp{ op: lt, column: column, value: param(name), } }
go
func LtNamed(column, name string) Cmp { return Cmp{ op: lt, column: column, value: param(name), } }
[ "func", "LtNamed", "(", "column", ",", "name", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "lt", ",", "column", ":", "column", ",", "value", ":", "param", "(", "name", ")", ",", "}", "\n", "}" ]
// LtNamed produces column<? with a custom parameter name.
[ "LtNamed", "produces", "column<?", "with", "a", "custom", "parameter", "name", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L106-L112
train
scylladb/gocqlx
qb/cmp.go
LtLit
func LtLit(column, literal string) Cmp { return Cmp{ op: lt, column: column, value: lit(literal), } }
go
func LtLit(column, literal string) Cmp { return Cmp{ op: lt, column: column, value: lit(literal), } }
[ "func", "LtLit", "(", "column", ",", "literal", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "lt", ",", "column", ":", "column", ",", "value", ":", "lit", "(", "literal", ")", ",", "}", "\n", "}" ]
// LtLit produces column<literal and does not add a parameter to the query.
[ "LtLit", "produces", "column<literal", "and", "does", "not", "add", "a", "parameter", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L115-L121
train
scylladb/gocqlx
qb/cmp.go
LtOrEq
func LtOrEq(column string) Cmp { return Cmp{ op: leq, column: column, value: param(column), } }
go
func LtOrEq(column string) Cmp { return Cmp{ op: leq, column: column, value: param(column), } }
[ "func", "LtOrEq", "(", "column", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "leq", ",", "column", ":", "column", ",", "value", ":", "param", "(", "column", ")", ",", "}", "\n", "}" ]
// LtOrEq produces column<=?.
[ "LtOrEq", "produces", "column<", "=", "?", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L133-L139
train
scylladb/gocqlx
qb/cmp.go
LtOrEqNamed
func LtOrEqNamed(column, name string) Cmp { return Cmp{ op: leq, column: column, value: param(name), } }
go
func LtOrEqNamed(column, name string) Cmp { return Cmp{ op: leq, column: column, value: param(name), } }
[ "func", "LtOrEqNamed", "(", "column", ",", "name", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "leq", ",", "column", ":", "column", ",", "value", ":", "param", "(", "name", ")", ",", "}", "\n", "}" ]
// LtOrEqNamed produces column<=? with a custom parameter name.
[ "LtOrEqNamed", "produces", "column<", "=", "?", "with", "a", "custom", "parameter", "name", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L142-L148
train
scylladb/gocqlx
qb/cmp.go
LtOrEqLit
func LtOrEqLit(column, literal string) Cmp { return Cmp{ op: leq, column: column, value: lit(literal), } }
go
func LtOrEqLit(column, literal string) Cmp { return Cmp{ op: leq, column: column, value: lit(literal), } }
[ "func", "LtOrEqLit", "(", "column", ",", "literal", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "leq", ",", "column", ":", "column", ",", "value", ":", "lit", "(", "literal", ")", ",", "}", "\n", "}" ]
// LtOrEqLit produces column<=literal and does not add a parameter to the query.
[ "LtOrEqLit", "produces", "column<", "=", "literal", "and", "does", "not", "add", "a", "parameter", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L151-L157
train
scylladb/gocqlx
qb/cmp.go
Gt
func Gt(column string) Cmp { return Cmp{ op: gt, column: column, value: param(column), } }
go
func Gt(column string) Cmp { return Cmp{ op: gt, column: column, value: param(column), } }
[ "func", "Gt", "(", "column", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "gt", ",", "column", ":", "column", ",", "value", ":", "param", "(", "column", ")", ",", "}", "\n", "}" ]
// Gt produces column>?.
[ "Gt", "produces", "column", ">", "?", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L169-L175
train
scylladb/gocqlx
qb/cmp.go
GtNamed
func GtNamed(column, name string) Cmp { return Cmp{ op: gt, column: column, value: param(name), } }
go
func GtNamed(column, name string) Cmp { return Cmp{ op: gt, column: column, value: param(name), } }
[ "func", "GtNamed", "(", "column", ",", "name", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "gt", ",", "column", ":", "column", ",", "value", ":", "param", "(", "name", ")", ",", "}", "\n", "}" ]
// GtNamed produces column>? with a custom parameter name.
[ "GtNamed", "produces", "column", ">", "?", "with", "a", "custom", "parameter", "name", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L178-L184
train
scylladb/gocqlx
qb/cmp.go
GtLit
func GtLit(column, literal string) Cmp { return Cmp{ op: gt, column: column, value: lit(literal), } }
go
func GtLit(column, literal string) Cmp { return Cmp{ op: gt, column: column, value: lit(literal), } }
[ "func", "GtLit", "(", "column", ",", "literal", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "gt", ",", "column", ":", "column", ",", "value", ":", "lit", "(", "literal", ")", ",", "}", "\n", "}" ]
// GtLit produces column>literal and does not add a parameter to the query.
[ "GtLit", "produces", "column", ">", "literal", "and", "does", "not", "add", "a", "parameter", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L187-L193
train
scylladb/gocqlx
qb/cmp.go
GtOrEq
func GtOrEq(column string) Cmp { return Cmp{ op: geq, column: column, value: param(column), } }
go
func GtOrEq(column string) Cmp { return Cmp{ op: geq, column: column, value: param(column), } }
[ "func", "GtOrEq", "(", "column", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "geq", ",", "column", ":", "column", ",", "value", ":", "param", "(", "column", ")", ",", "}", "\n", "}" ]
// GtOrEq produces column>=?.
[ "GtOrEq", "produces", "column", ">", "=", "?", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L205-L211
train
scylladb/gocqlx
qb/cmp.go
GtOrEqNamed
func GtOrEqNamed(column, name string) Cmp { return Cmp{ op: geq, column: column, value: param(name), } }
go
func GtOrEqNamed(column, name string) Cmp { return Cmp{ op: geq, column: column, value: param(name), } }
[ "func", "GtOrEqNamed", "(", "column", ",", "name", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "geq", ",", "column", ":", "column", ",", "value", ":", "param", "(", "name", ")", ",", "}", "\n", "}" ]
// GtOrEqNamed produces column>=? with a custom parameter name.
[ "GtOrEqNamed", "produces", "column", ">", "=", "?", "with", "a", "custom", "parameter", "name", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L214-L220
train
scylladb/gocqlx
qb/cmp.go
GtOrEqLit
func GtOrEqLit(column, literal string) Cmp { return Cmp{ op: geq, column: column, value: lit(literal), } }
go
func GtOrEqLit(column, literal string) Cmp { return Cmp{ op: geq, column: column, value: lit(literal), } }
[ "func", "GtOrEqLit", "(", "column", ",", "literal", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "geq", ",", "column", ":", "column", ",", "value", ":", "lit", "(", "literal", ")", ",", "}", "\n", "}" ]
// GtOrEqLit produces column>=literal and does not add a parameter to the query.
[ "GtOrEqLit", "produces", "column", ">", "=", "literal", "and", "does", "not", "add", "a", "parameter", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L223-L229
train
scylladb/gocqlx
qb/cmp.go
In
func In(column string) Cmp { return Cmp{ op: in, column: column, value: param(column), } }
go
func In(column string) Cmp { return Cmp{ op: in, column: column, value: param(column), } }
[ "func", "In", "(", "column", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "in", ",", "column", ":", "column", ",", "value", ":", "param", "(", "column", ")", ",", "}", "\n", "}" ]
// In produces column IN ?.
[ "In", "produces", "column", "IN", "?", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L241-L247
train
scylladb/gocqlx
qb/cmp.go
InNamed
func InNamed(column, name string) Cmp { return Cmp{ op: in, column: column, value: param(name), } }
go
func InNamed(column, name string) Cmp { return Cmp{ op: in, column: column, value: param(name), } }
[ "func", "InNamed", "(", "column", ",", "name", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "in", ",", "column", ":", "column", ",", "value", ":", "param", "(", "name", ")", ",", "}", "\n", "}" ]
// InNamed produces column IN ? with a custom parameter name.
[ "InNamed", "produces", "column", "IN", "?", "with", "a", "custom", "parameter", "name", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L250-L256
train
scylladb/gocqlx
qb/cmp.go
InLit
func InLit(column, literal string) Cmp { return Cmp{ op: in, column: column, value: lit(literal), } }
go
func InLit(column, literal string) Cmp { return Cmp{ op: in, column: column, value: lit(literal), } }
[ "func", "InLit", "(", "column", ",", "literal", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "in", ",", "column", ":", "column", ",", "value", ":", "lit", "(", "literal", ")", ",", "}", "\n", "}" ]
// InLit produces column IN literal and does not add a parameter to the query.
[ "InLit", "produces", "column", "IN", "literal", "and", "does", "not", "add", "a", "parameter", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L259-L265
train
scylladb/gocqlx
qb/cmp.go
Contains
func Contains(column string) Cmp { return Cmp{ op: cnt, column: column, value: param(column), } }
go
func Contains(column string) Cmp { return Cmp{ op: cnt, column: column, value: param(column), } }
[ "func", "Contains", "(", "column", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "cnt", ",", "column", ":", "column", ",", "value", ":", "param", "(", "column", ")", ",", "}", "\n", "}" ]
// Contains produces column CONTAINS ?.
[ "Contains", "produces", "column", "CONTAINS", "?", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L268-L274
train
scylladb/gocqlx
qb/cmp.go
ContainsKey
func ContainsKey(column string) Cmp { return Cmp{ op: cntKey, column: column, value: param(column), } }
go
func ContainsKey(column string) Cmp { return Cmp{ op: cntKey, column: column, value: param(column), } }
[ "func", "ContainsKey", "(", "column", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "cntKey", ",", "column", ":", "column", ",", "value", ":", "param", "(", "column", ")", ",", "}", "\n", "}" ]
// ContainsKey produces column CONTAINS KEY ?.
[ "ContainsKey", "produces", "column", "CONTAINS", "KEY", "?", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L277-L283
train
scylladb/gocqlx
qb/cmp.go
ContainsNamed
func ContainsNamed(column, name string) Cmp { return Cmp{ op: cnt, column: column, value: param(name), } }
go
func ContainsNamed(column, name string) Cmp { return Cmp{ op: cnt, column: column, value: param(name), } }
[ "func", "ContainsNamed", "(", "column", ",", "name", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "cnt", ",", "column", ":", "column", ",", "value", ":", "param", "(", "name", ")", ",", "}", "\n", "}" ]
// ContainsNamed produces column CONTAINS ? with a custom parameter name.
[ "ContainsNamed", "produces", "column", "CONTAINS", "?", "with", "a", "custom", "parameter", "name", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L286-L292
train
scylladb/gocqlx
qb/cmp.go
ContainsKeyNamed
func ContainsKeyNamed(column, name string) Cmp { return Cmp{ op: cntKey, column: column, value: param(name), } }
go
func ContainsKeyNamed(column, name string) Cmp { return Cmp{ op: cntKey, column: column, value: param(name), } }
[ "func", "ContainsKeyNamed", "(", "column", ",", "name", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "cntKey", ",", "column", ":", "column", ",", "value", ":", "param", "(", "name", ")", ",", "}", "\n", "}" ]
// ContainsKeyNamed produces column CONTAINS KEY ? with a custom parameter name.
[ "ContainsKeyNamed", "produces", "column", "CONTAINS", "KEY", "?", "with", "a", "custom", "parameter", "name", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L295-L301
train
scylladb/gocqlx
qb/cmp.go
ContainsLit
func ContainsLit(column, literal string) Cmp { return Cmp{ op: cnt, column: column, value: lit(literal), } }
go
func ContainsLit(column, literal string) Cmp { return Cmp{ op: cnt, column: column, value: lit(literal), } }
[ "func", "ContainsLit", "(", "column", ",", "literal", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "cnt", ",", "column", ":", "column", ",", "value", ":", "lit", "(", "literal", ")", ",", "}", "\n", "}" ]
// ContainsLit produces column CONTAINS literal and does not add a parameter to the query.
[ "ContainsLit", "produces", "column", "CONTAINS", "literal", "and", "does", "not", "add", "a", "parameter", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L304-L310
train
scylladb/gocqlx
qb/cmp.go
Like
func Like(column string) Cmp { return Cmp{ op: like, column: column, value: param(column), } }
go
func Like(column string) Cmp { return Cmp{ op: like, column: column, value: param(column), } }
[ "func", "Like", "(", "column", "string", ")", "Cmp", "{", "return", "Cmp", "{", "op", ":", "like", ",", "column", ":", "column", ",", "value", ":", "param", "(", "column", ")", ",", "}", "\n", "}" ]
// Like produces column LIKE ?.
[ "Like", "produces", "column", "LIKE", "?", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/cmp.go#L313-L319
train
scylladb/gocqlx
qb/select.go
From
func (b *SelectBuilder) From(table string) *SelectBuilder { b.table = table return b }
go
func (b *SelectBuilder) From(table string) *SelectBuilder { b.table = table return b }
[ "func", "(", "b", "*", "SelectBuilder", ")", "From", "(", "table", "string", ")", "*", "SelectBuilder", "{", "b", ".", "table", "=", "table", "\n", "return", "b", "\n", "}" ]
// From sets the table to be selected from.
[ "From", "sets", "the", "table", "to", "be", "selected", "from", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/select.go#L111-L114
train
scylladb/gocqlx
qb/select.go
Columns
func (b *SelectBuilder) Columns(columns ...string) *SelectBuilder { b.columns = append(b.columns, columns...) return b }
go
func (b *SelectBuilder) Columns(columns ...string) *SelectBuilder { b.columns = append(b.columns, columns...) return b }
[ "func", "(", "b", "*", "SelectBuilder", ")", "Columns", "(", "columns", "...", "string", ")", "*", "SelectBuilder", "{", "b", ".", "columns", "=", "append", "(", "b", ".", "columns", ",", "columns", "...", ")", "\n", "return", "b", "\n", "}" ]
// Columns adds result columns to the query.
[ "Columns", "adds", "result", "columns", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/select.go#L117-L120
train
scylladb/gocqlx
qb/select.go
Distinct
func (b *SelectBuilder) Distinct(columns ...string) *SelectBuilder { b.distinct = append(b.distinct, columns...) return b }
go
func (b *SelectBuilder) Distinct(columns ...string) *SelectBuilder { b.distinct = append(b.distinct, columns...) return b }
[ "func", "(", "b", "*", "SelectBuilder", ")", "Distinct", "(", "columns", "...", "string", ")", "*", "SelectBuilder", "{", "b", ".", "distinct", "=", "append", "(", "b", ".", "distinct", ",", "columns", "...", ")", "\n", "return", "b", "\n", "}" ]
// Distinct sets DISTINCT clause on the query.
[ "Distinct", "sets", "DISTINCT", "clause", "on", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/select.go#L128-L131
train
scylladb/gocqlx
qb/select.go
GroupBy
func (b *SelectBuilder) GroupBy(columns ...string) *SelectBuilder { b.groupBy = append(b.groupBy, columns...) return b }
go
func (b *SelectBuilder) GroupBy(columns ...string) *SelectBuilder { b.groupBy = append(b.groupBy, columns...) return b }
[ "func", "(", "b", "*", "SelectBuilder", ")", "GroupBy", "(", "columns", "...", "string", ")", "*", "SelectBuilder", "{", "b", ".", "groupBy", "=", "append", "(", "b", ".", "groupBy", ",", "columns", "...", ")", "\n", "return", "b", "\n", "}" ]
// GroupBy sets GROUP BY clause on the query. Columns must be a primary key, // this will automatically add the the columns as first selectors.
[ "GroupBy", "sets", "GROUP", "BY", "clause", "on", "the", "query", ".", "Columns", "must", "be", "a", "primary", "key", "this", "will", "automatically", "add", "the", "the", "columns", "as", "first", "selectors", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/select.go#L142-L145
train
scylladb/gocqlx
qb/select.go
OrderBy
func (b *SelectBuilder) OrderBy(column string, o Order) *SelectBuilder { b.orderBy = append(b.orderBy, column+" "+o.String()) return b }
go
func (b *SelectBuilder) OrderBy(column string, o Order) *SelectBuilder { b.orderBy = append(b.orderBy, column+" "+o.String()) return b }
[ "func", "(", "b", "*", "SelectBuilder", ")", "OrderBy", "(", "column", "string", ",", "o", "Order", ")", "*", "SelectBuilder", "{", "b", ".", "orderBy", "=", "append", "(", "b", ".", "orderBy", ",", "column", "+", "\"", "\"", "+", "o", ".", "String...
// OrderBy sets ORDER BY clause on the query.
[ "OrderBy", "sets", "ORDER", "BY", "clause", "on", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/select.go#L148-L151
train
scylladb/gocqlx
qb/select.go
Limit
func (b *SelectBuilder) Limit(limit uint) *SelectBuilder { b.limit = limit return b }
go
func (b *SelectBuilder) Limit(limit uint) *SelectBuilder { b.limit = limit return b }
[ "func", "(", "b", "*", "SelectBuilder", ")", "Limit", "(", "limit", "uint", ")", "*", "SelectBuilder", "{", "b", ".", "limit", "=", "limit", "\n", "return", "b", "\n", "}" ]
// Limit sets a LIMIT clause on the query.
[ "Limit", "sets", "a", "LIMIT", "clause", "on", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/select.go#L154-L157
train
scylladb/gocqlx
qb/select.go
LimitPerPartition
func (b *SelectBuilder) LimitPerPartition(limit uint) *SelectBuilder { b.limitPerPartition = limit return b }
go
func (b *SelectBuilder) LimitPerPartition(limit uint) *SelectBuilder { b.limitPerPartition = limit return b }
[ "func", "(", "b", "*", "SelectBuilder", ")", "LimitPerPartition", "(", "limit", "uint", ")", "*", "SelectBuilder", "{", "b", ".", "limitPerPartition", "=", "limit", "\n", "return", "b", "\n", "}" ]
// LimitPerPartition sets a PER PARTITION LIMIT clause on the query.
[ "LimitPerPartition", "sets", "a", "PER", "PARTITION", "LIMIT", "clause", "on", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/select.go#L160-L163
train
scylladb/gocqlx
qb/func.go
Fn
func Fn(name string, paramNames ...string) *Func { return &Func{ Name: name, ParamNames: paramNames, } }
go
func Fn(name string, paramNames ...string) *Func { return &Func{ Name: name, ParamNames: paramNames, } }
[ "func", "Fn", "(", "name", "string", ",", "paramNames", "...", "string", ")", "*", "Func", "{", "return", "&", "Func", "{", "Name", ":", "name", ",", "ParamNames", ":", "paramNames", ",", "}", "\n", "}" ]
// Fn creates Func.
[ "Fn", "creates", "Func", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/func.go#L31-L36
train
scylladb/gocqlx
migrate/migrate.go
List
func List(ctx context.Context, session *gocql.Session) ([]*Info, error) { if err := ensureInfoTable(ctx, session); err != nil { return nil, err } var v []*Info err := gocqlx.Select(&v, session.Query(selectInfo).WithContext(ctx)) if err == gocql.ErrNotFound { return nil, nil } sort.Slice(v, func(i, j int) b...
go
func List(ctx context.Context, session *gocql.Session) ([]*Info, error) { if err := ensureInfoTable(ctx, session); err != nil { return nil, err } var v []*Info err := gocqlx.Select(&v, session.Query(selectInfo).WithContext(ctx)) if err == gocql.ErrNotFound { return nil, nil } sort.Slice(v, func(i, j int) b...
[ "func", "List", "(", "ctx", "context", ".", "Context", ",", "session", "*", "gocql", ".", "Session", ")", "(", "[", "]", "*", "Info", ",", "error", ")", "{", "if", "err", ":=", "ensureInfoTable", "(", "ctx", ",", "session", ")", ";", "err", "!=", ...
// List provides a listing of applied migrations.
[ "List", "provides", "a", "listing", "of", "applied", "migrations", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/migrate/migrate.go#L47-L63
train
scylladb/gocqlx
migrate/migrate.go
Migrate
func Migrate(ctx context.Context, session *gocql.Session, dir string) error { // get database migrations dbm, err := List(ctx, session) if err != nil { return fmt.Errorf("failed to list migrations: %s", err) } // get file migrations fm, err := filepath.Glob(filepath.Join(dir, "*.cql")) if err != nil { retur...
go
func Migrate(ctx context.Context, session *gocql.Session, dir string) error { // get database migrations dbm, err := List(ctx, session) if err != nil { return fmt.Errorf("failed to list migrations: %s", err) } // get file migrations fm, err := filepath.Glob(filepath.Join(dir, "*.cql")) if err != nil { retur...
[ "func", "Migrate", "(", "ctx", "context", ".", "Context", ",", "session", "*", "gocql", ".", "Session", ",", "dir", "string", ")", "error", "{", "// get database migrations", "dbm", ",", "err", ":=", "List", "(", "ctx", ",", "session", ")", "\n", "if", ...
// Migrate reads the cql files from a directory and applies required migrations.
[ "Migrate", "reads", "the", "cql", "files", "from", "a", "directory", "and", "applies", "required", "migrations", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/migrate/migrate.go#L70-L121
train
scylladb/gocqlx
table/table.go
New
func New(m Metadata) *Table { t := &Table{ metadata: m, } // prepare primary and partition key comparators t.primaryKeyCmp = make([]qb.Cmp, 0, len(m.PartKey)+len(m.SortKey)) for _, k := range m.PartKey { t.primaryKeyCmp = append(t.primaryKeyCmp, qb.Eq(k)) } for _, k := range m.SortKey { t.primaryKeyCmp = ...
go
func New(m Metadata) *Table { t := &Table{ metadata: m, } // prepare primary and partition key comparators t.primaryKeyCmp = make([]qb.Cmp, 0, len(m.PartKey)+len(m.SortKey)) for _, k := range m.PartKey { t.primaryKeyCmp = append(t.primaryKeyCmp, qb.Eq(k)) } for _, k := range m.SortKey { t.primaryKeyCmp = ...
[ "func", "New", "(", "m", "Metadata", ")", "*", "Table", "{", "t", ":=", "&", "Table", "{", "metadata", ":", "m", ",", "}", "\n\n", "// prepare primary and partition key comparators", "t", ".", "primaryKeyCmp", "=", "make", "(", "[", "]", "qb", ".", "Cmp"...
// New creates new Table based on table schema read from Metadata.
[ "New", "creates", "new", "Table", "based", "on", "table", "schema", "read", "from", "Metadata", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/table/table.go#L35-L58
train
scylladb/gocqlx
table/table.go
Get
func (t *Table) Get(columns ...string) (stmt string, names []string) { if len(columns) == 0 { return t.get.stmt, t.get.names } return qb.Select(t.metadata.Name). Columns(columns...). Where(t.primaryKeyCmp...). ToCql() }
go
func (t *Table) Get(columns ...string) (stmt string, names []string) { if len(columns) == 0 { return t.get.stmt, t.get.names } return qb.Select(t.metadata.Name). Columns(columns...). Where(t.primaryKeyCmp...). ToCql() }
[ "func", "(", "t", "*", "Table", ")", "Get", "(", "columns", "...", "string", ")", "(", "stmt", "string", ",", "names", "[", "]", "string", ")", "{", "if", "len", "(", "columns", ")", "==", "0", "{", "return", "t", ".", "get", ".", "stmt", ",", ...
// Get returns select by primary key statement.
[ "Get", "returns", "select", "by", "primary", "key", "statement", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/table/table.go#L71-L80
train
scylladb/gocqlx
table/table.go
Select
func (t *Table) Select(columns ...string) (stmt string, names []string) { if len(columns) == 0 { return t.sel.stmt, t.sel.names } return qb.Select(t.metadata.Name). Columns(columns...). Where(t.primaryKeyCmp[0:len(t.metadata.PartKey)]...). ToCql() }
go
func (t *Table) Select(columns ...string) (stmt string, names []string) { if len(columns) == 0 { return t.sel.stmt, t.sel.names } return qb.Select(t.metadata.Name). Columns(columns...). Where(t.primaryKeyCmp[0:len(t.metadata.PartKey)]...). ToCql() }
[ "func", "(", "t", "*", "Table", ")", "Select", "(", "columns", "...", "string", ")", "(", "stmt", "string", ",", "names", "[", "]", "string", ")", "{", "if", "len", "(", "columns", ")", "==", "0", "{", "return", "t", ".", "sel", ".", "stmt", ",...
// Select returns select by partition key statement.
[ "Select", "returns", "select", "by", "partition", "key", "statement", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/table/table.go#L83-L92
train
scylladb/gocqlx
table/table.go
SelectBuilder
func (t *Table) SelectBuilder(columns ...string) *qb.SelectBuilder { return qb.Select(t.metadata.Name).Columns(columns...).Where(t.partKeyCmp...) }
go
func (t *Table) SelectBuilder(columns ...string) *qb.SelectBuilder { return qb.Select(t.metadata.Name).Columns(columns...).Where(t.partKeyCmp...) }
[ "func", "(", "t", "*", "Table", ")", "SelectBuilder", "(", "columns", "...", "string", ")", "*", "qb", ".", "SelectBuilder", "{", "return", "qb", ".", "Select", "(", "t", ".", "metadata", ".", "Name", ")", ".", "Columns", "(", "columns", "...", ")", ...
// SelectBuilder returns a builder initialised to select by partition key // statement.
[ "SelectBuilder", "returns", "a", "builder", "initialised", "to", "select", "by", "partition", "key", "statement", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/table/table.go#L96-L98
train
scylladb/gocqlx
table/table.go
Insert
func (t *Table) Insert() (stmt string, names []string) { return t.insert.stmt, t.insert.names }
go
func (t *Table) Insert() (stmt string, names []string) { return t.insert.stmt, t.insert.names }
[ "func", "(", "t", "*", "Table", ")", "Insert", "(", ")", "(", "stmt", "string", ",", "names", "[", "]", "string", ")", "{", "return", "t", ".", "insert", ".", "stmt", ",", "t", ".", "insert", ".", "names", "\n", "}" ]
// Insert returns insert all columns statement.
[ "Insert", "returns", "insert", "all", "columns", "statement", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/table/table.go#L101-L103
train
scylladb/gocqlx
table/table.go
Update
func (t *Table) Update(columns ...string) (stmt string, names []string) { return qb.Update(t.metadata.Name).Set(columns...).Where(t.primaryKeyCmp...).ToCql() }
go
func (t *Table) Update(columns ...string) (stmt string, names []string) { return qb.Update(t.metadata.Name).Set(columns...).Where(t.primaryKeyCmp...).ToCql() }
[ "func", "(", "t", "*", "Table", ")", "Update", "(", "columns", "...", "string", ")", "(", "stmt", "string", ",", "names", "[", "]", "string", ")", "{", "return", "qb", ".", "Update", "(", "t", ".", "metadata", ".", "Name", ")", ".", "Set", "(", ...
// Update returns update by primary key statement.
[ "Update", "returns", "update", "by", "primary", "key", "statement", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/table/table.go#L106-L108
train
scylladb/gocqlx
table/table.go
Delete
func (t *Table) Delete(columns ...string) (stmt string, names []string) { return qb.Delete(t.metadata.Name).Columns(columns...).Where(t.primaryKeyCmp...).ToCql() }
go
func (t *Table) Delete(columns ...string) (stmt string, names []string) { return qb.Delete(t.metadata.Name).Columns(columns...).Where(t.primaryKeyCmp...).ToCql() }
[ "func", "(", "t", "*", "Table", ")", "Delete", "(", "columns", "...", "string", ")", "(", "stmt", "string", ",", "names", "[", "]", "string", ")", "{", "return", "qb", ".", "Delete", "(", "t", ".", "metadata", ".", "Name", ")", ".", "Columns", "(...
// Delete returns delete by primary key statement.
[ "Delete", "returns", "delete", "by", "primary", "key", "statement", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/table/table.go#L111-L113
train
scylladb/gocqlx
qb/delete.go
From
func (b *DeleteBuilder) From(table string) *DeleteBuilder { b.table = table return b }
go
func (b *DeleteBuilder) From(table string) *DeleteBuilder { b.table = table return b }
[ "func", "(", "b", "*", "DeleteBuilder", ")", "From", "(", "table", "string", ")", "*", "DeleteBuilder", "{", "b", ".", "table", "=", "table", "\n", "return", "b", "\n", "}" ]
// From sets the table to be deleted from.
[ "From", "sets", "the", "table", "to", "be", "deleted", "from", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/delete.go#L58-L61
train
scylladb/gocqlx
qb/delete.go
Columns
func (b *DeleteBuilder) Columns(columns ...string) *DeleteBuilder { b.columns = append(b.columns, columns...) return b }
go
func (b *DeleteBuilder) Columns(columns ...string) *DeleteBuilder { b.columns = append(b.columns, columns...) return b }
[ "func", "(", "b", "*", "DeleteBuilder", ")", "Columns", "(", "columns", "...", "string", ")", "*", "DeleteBuilder", "{", "b", ".", "columns", "=", "append", "(", "b", ".", "columns", ",", "columns", "...", ")", "\n", "return", "b", "\n", "}" ]
// Columns adds delete columns to the query.
[ "Columns", "adds", "delete", "columns", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/delete.go#L64-L67
train
scylladb/gocqlx
gocqlx.go
structOnlyError
func structOnlyError(t reflect.Type) error { isStruct := t.Kind() == reflect.Struct isScanner := reflect.PtrTo(t).Implements(_unmarshallerInterface) if !isStruct { return fmt.Errorf("expected %s but got %s", reflect.Struct, t.Kind()) } if isScanner { return fmt.Errorf("structscan expects a struct dest but the ...
go
func structOnlyError(t reflect.Type) error { isStruct := t.Kind() == reflect.Struct isScanner := reflect.PtrTo(t).Implements(_unmarshallerInterface) if !isStruct { return fmt.Errorf("expected %s but got %s", reflect.Struct, t.Kind()) } if isScanner { return fmt.Errorf("structscan expects a struct dest but the ...
[ "func", "structOnlyError", "(", "t", "reflect", ".", "Type", ")", "error", "{", "isStruct", ":=", "t", ".", "Kind", "(", ")", "==", "reflect", ".", "Struct", "\n", "isScanner", ":=", "reflect", ".", "PtrTo", "(", "t", ")", ".", "Implements", "(", "_u...
// structOnlyError returns an error appropriate for type when a non-scannable // struct is expected but something else is given
[ "structOnlyError", "returns", "an", "error", "appropriate", "for", "type", "when", "a", "non", "-", "scannable", "struct", "is", "expected", "but", "something", "else", "is", "given" ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/gocqlx.go#L18-L28
train
scylladb/gocqlx
gocqlx.go
fieldsByTraversal
func fieldsByTraversal(v reflect.Value, traversals [][]int, values []interface{}, ptrs bool) error { v = reflect.Indirect(v) if v.Kind() != reflect.Struct { return errors.New("argument not a struct") } for i, traversal := range traversals { if len(traversal) == 0 { continue } f := reflectx.FieldByIndexe...
go
func fieldsByTraversal(v reflect.Value, traversals [][]int, values []interface{}, ptrs bool) error { v = reflect.Indirect(v) if v.Kind() != reflect.Struct { return errors.New("argument not a struct") } for i, traversal := range traversals { if len(traversal) == 0 { continue } f := reflectx.FieldByIndexe...
[ "func", "fieldsByTraversal", "(", "v", "reflect", ".", "Value", ",", "traversals", "[", "]", "[", "]", "int", ",", "values", "[", "]", "interface", "{", "}", ",", "ptrs", "bool", ")", "error", "{", "v", "=", "reflect", ".", "Indirect", "(", "v", ")...
// fieldsByName fills a values interface with fields from the passed value based // on the traversals in int. If ptrs is true, return addresses instead of values. // We write this instead of using FieldsByName to save allocations and map lookups // when iterating over many rows. Empty traversals will get an interface p...
[ "fieldsByName", "fills", "a", "values", "interface", "with", "fields", "from", "the", "passed", "value", "based", "on", "the", "traversals", "in", "int", ".", "If", "ptrs", "is", "true", "return", "addresses", "instead", "of", "values", ".", "We", "write", ...
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/gocqlx.go#L68-L86
train
scylladb/gocqlx
qb/insert.go
Into
func (b *InsertBuilder) Into(table string) *InsertBuilder { b.table = table return b }
go
func (b *InsertBuilder) Into(table string) *InsertBuilder { b.table = table return b }
[ "func", "(", "b", "*", "InsertBuilder", ")", "Into", "(", "table", "string", ")", "*", "InsertBuilder", "{", "b", ".", "table", "=", "table", "\n", "return", "b", "\n", "}" ]
// Into sets the INTO clause of the query.
[ "Into", "sets", "the", "INTO", "clause", "of", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/insert.go#L74-L77
train
scylladb/gocqlx
qb/insert.go
Columns
func (b *InsertBuilder) Columns(columns ...string) *InsertBuilder { for _, c := range columns { b.columns = append(b.columns, initializer{ column: c, value: param(c), }) } return b }
go
func (b *InsertBuilder) Columns(columns ...string) *InsertBuilder { for _, c := range columns { b.columns = append(b.columns, initializer{ column: c, value: param(c), }) } return b }
[ "func", "(", "b", "*", "InsertBuilder", ")", "Columns", "(", "columns", "...", "string", ")", "*", "InsertBuilder", "{", "for", "_", ",", "c", ":=", "range", "columns", "{", "b", ".", "columns", "=", "append", "(", "b", ".", "columns", ",", "initiali...
// Columns adds insert columns to the query.
[ "Columns", "adds", "insert", "columns", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/insert.go#L80-L88
train
scylladb/gocqlx
qb/insert.go
NamedColumn
func (b *InsertBuilder) NamedColumn(column, name string) *InsertBuilder { b.columns = append(b.columns, initializer{ column: column, value: param(name), }) return b }
go
func (b *InsertBuilder) NamedColumn(column, name string) *InsertBuilder { b.columns = append(b.columns, initializer{ column: column, value: param(name), }) return b }
[ "func", "(", "b", "*", "InsertBuilder", ")", "NamedColumn", "(", "column", ",", "name", "string", ")", "*", "InsertBuilder", "{", "b", ".", "columns", "=", "append", "(", "b", ".", "columns", ",", "initializer", "{", "column", ":", "column", ",", "valu...
// NamedColumn adds an insert column with a custom parameter name.
[ "NamedColumn", "adds", "an", "insert", "column", "with", "a", "custom", "parameter", "name", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/insert.go#L91-L97
train
scylladb/gocqlx
qb/insert.go
LitColumn
func (b *InsertBuilder) LitColumn(column, literal string) *InsertBuilder { b.columns = append(b.columns, initializer{ column: column, value: lit(literal), }) return b }
go
func (b *InsertBuilder) LitColumn(column, literal string) *InsertBuilder { b.columns = append(b.columns, initializer{ column: column, value: lit(literal), }) return b }
[ "func", "(", "b", "*", "InsertBuilder", ")", "LitColumn", "(", "column", ",", "literal", "string", ")", "*", "InsertBuilder", "{", "b", ".", "columns", "=", "append", "(", "b", ".", "columns", ",", "initializer", "{", "column", ":", "column", ",", "val...
// LitColumn adds an insert column with a literal value to the query.
[ "LitColumn", "adds", "an", "insert", "column", "with", "a", "literal", "value", "to", "the", "query", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/insert.go#L100-L106
train
scylladb/gocqlx
qb/insert.go
FuncColumn
func (b *InsertBuilder) FuncColumn(column string, fn *Func) *InsertBuilder { b.columns = append(b.columns, initializer{ column: column, value: fn, }) return b }
go
func (b *InsertBuilder) FuncColumn(column string, fn *Func) *InsertBuilder { b.columns = append(b.columns, initializer{ column: column, value: fn, }) return b }
[ "func", "(", "b", "*", "InsertBuilder", ")", "FuncColumn", "(", "column", "string", ",", "fn", "*", "Func", ")", "*", "InsertBuilder", "{", "b", ".", "columns", "=", "append", "(", "b", ".", "columns", ",", "initializer", "{", "column", ":", "column", ...
// FuncColumn adds an insert column initialized by evaluating a CQL function.
[ "FuncColumn", "adds", "an", "insert", "column", "initialized", "by", "evaluating", "a", "CQL", "function", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/insert.go#L109-L115
train
scylladb/gocqlx
qb/batch.go
Add
func (b *BatchBuilder) Add(builder Builder) *BatchBuilder { return b.AddStmt(builder.ToCql()) }
go
func (b *BatchBuilder) Add(builder Builder) *BatchBuilder { return b.AddStmt(builder.ToCql()) }
[ "func", "(", "b", "*", "BatchBuilder", ")", "Add", "(", "builder", "Builder", ")", "*", "BatchBuilder", "{", "return", "b", ".", "AddStmt", "(", "builder", ".", "ToCql", "(", ")", ")", "\n", "}" ]
// Add builds the builder and adds the statement to the batch.
[ "Add", "builds", "the", "builder", "and", "adds", "the", "statement", "to", "the", "batch", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/batch.go#L59-L61
train
scylladb/gocqlx
qb/batch.go
AddStmt
func (b *BatchBuilder) AddStmt(stmt string, names []string) *BatchBuilder { b.stmts = append(b.stmts, stmt) b.names = append(b.names, names...) return b }
go
func (b *BatchBuilder) AddStmt(stmt string, names []string) *BatchBuilder { b.stmts = append(b.stmts, stmt) b.names = append(b.names, names...) return b }
[ "func", "(", "b", "*", "BatchBuilder", ")", "AddStmt", "(", "stmt", "string", ",", "names", "[", "]", "string", ")", "*", "BatchBuilder", "{", "b", ".", "stmts", "=", "append", "(", "b", ".", "stmts", ",", "stmt", ")", "\n", "b", ".", "names", "=...
// AddStmt adds statement to the batch.
[ "AddStmt", "adds", "statement", "to", "the", "batch", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/batch.go#L64-L68
train
scylladb/gocqlx
qb/batch.go
AddWithPrefix
func (b *BatchBuilder) AddWithPrefix(prefix string, builder Builder) *BatchBuilder { stmt, names := builder.ToCql() return b.AddStmtWithPrefix(prefix, stmt, names) }
go
func (b *BatchBuilder) AddWithPrefix(prefix string, builder Builder) *BatchBuilder { stmt, names := builder.ToCql() return b.AddStmtWithPrefix(prefix, stmt, names) }
[ "func", "(", "b", "*", "BatchBuilder", ")", "AddWithPrefix", "(", "prefix", "string", ",", "builder", "Builder", ")", "*", "BatchBuilder", "{", "stmt", ",", "names", ":=", "builder", ".", "ToCql", "(", ")", "\n", "return", "b", ".", "AddStmtWithPrefix", ...
// AddWithPrefix builds the builder and adds the statement to the batch. Names // are prefixed with the prefix + ".".
[ "AddWithPrefix", "builds", "the", "builder", "and", "adds", "the", "statement", "to", "the", "batch", ".", "Names", "are", "prefixed", "with", "the", "prefix", "+", ".", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/batch.go#L72-L75
train
scylladb/gocqlx
qb/batch.go
AddStmtWithPrefix
func (b *BatchBuilder) AddStmtWithPrefix(prefix string, stmt string, names []string) *BatchBuilder { b.stmts = append(b.stmts, stmt) for _, name := range names { if prefix != "" { name = fmt.Sprint(prefix, ".", name) } b.names = append(b.names, name) } return b }
go
func (b *BatchBuilder) AddStmtWithPrefix(prefix string, stmt string, names []string) *BatchBuilder { b.stmts = append(b.stmts, stmt) for _, name := range names { if prefix != "" { name = fmt.Sprint(prefix, ".", name) } b.names = append(b.names, name) } return b }
[ "func", "(", "b", "*", "BatchBuilder", ")", "AddStmtWithPrefix", "(", "prefix", "string", ",", "stmt", "string", ",", "names", "[", "]", "string", ")", "*", "BatchBuilder", "{", "b", ".", "stmts", "=", "append", "(", "b", ".", "stmts", ",", "stmt", "...
// AddStmtWithPrefix adds statement to the batch. Names are prefixed with // the prefix + ".".
[ "AddStmtWithPrefix", "adds", "statement", "to", "the", "batch", ".", "Names", "are", "prefixed", "with", "the", "prefix", "+", ".", "." ]
3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5
https://github.com/scylladb/gocqlx/blob/3a6a3da0c7b34883b12cb1730c936b2ebd3d04a5/qb/batch.go#L79-L88
train
cespare/reflex
backlog.go
Add
func (b *UnifiedBacklog) Add(path string) { if b.empty { b.s = path b.empty = false } }
go
func (b *UnifiedBacklog) Add(path string) { if b.empty { b.s = path b.empty = false } }
[ "func", "(", "b", "*", "UnifiedBacklog", ")", "Add", "(", "path", "string", ")", "{", "if", "b", ".", "empty", "{", "b", ".", "s", "=", "path", "\n", "b", ".", "empty", "=", "false", "\n", "}", "\n", "}" ]
// Add adds path to b if there is not a path there currently. // Otherwise it discards it.
[ "Add", "adds", "path", "to", "b", "if", "there", "is", "not", "a", "path", "there", "currently", ".", "Otherwise", "it", "discards", "it", "." ]
e1e64e8a6dd7552a6e8f616474c91d4d089eada6
https://github.com/cespare/reflex/blob/e1e64e8a6dd7552a6e8f616474c91d4d089eada6/backlog.go#L30-L35
train
cespare/reflex
backlog.go
RemoveOne
func (b *UnifiedBacklog) RemoveOne() bool { if b.empty { panic("RemoveOne() called on empty backlog") } b.empty = true b.s = "" return true }
go
func (b *UnifiedBacklog) RemoveOne() bool { if b.empty { panic("RemoveOne() called on empty backlog") } b.empty = true b.s = "" return true }
[ "func", "(", "b", "*", "UnifiedBacklog", ")", "RemoveOne", "(", ")", "bool", "{", "if", "b", ".", "empty", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "b", ".", "empty", "=", "true", "\n", "b", ".", "s", "=", "\"", "\"", "\n", "retur...
// RemoveOne removes the path in b.
[ "RemoveOne", "removes", "the", "path", "in", "b", "." ]
e1e64e8a6dd7552a6e8f616474c91d4d089eada6
https://github.com/cespare/reflex/blob/e1e64e8a6dd7552a6e8f616474c91d4d089eada6/backlog.go#L46-L53
train
cespare/reflex
backlog.go
Add
func (b *UniqueFilesBacklog) Add(path string) { defer func() { b.empty = false }() if b.empty { b.next = path return } if path == b.next { return } b.rest[path] = struct{}{} }
go
func (b *UniqueFilesBacklog) Add(path string) { defer func() { b.empty = false }() if b.empty { b.next = path return } if path == b.next { return } b.rest[path] = struct{}{} }
[ "func", "(", "b", "*", "UniqueFilesBacklog", ")", "Add", "(", "path", "string", ")", "{", "defer", "func", "(", ")", "{", "b", ".", "empty", "=", "false", "}", "(", ")", "\n", "if", "b", ".", "empty", "{", "b", ".", "next", "=", "path", "\n", ...
// Add adds path to the set of files in b.
[ "Add", "adds", "path", "to", "the", "set", "of", "files", "in", "b", "." ]
e1e64e8a6dd7552a6e8f616474c91d4d089eada6
https://github.com/cespare/reflex/blob/e1e64e8a6dd7552a6e8f616474c91d4d089eada6/backlog.go#L71-L81
train
cespare/reflex
config.go
ReadConfigs
func ReadConfigs(path string) ([]*Config, error) { var r io.Reader name := path if path == "-" { r = os.Stdin name = "standard input" } else { f, err := os.Open(flagConf) if err != nil { return nil, err } defer f.Close() r = f } return readConfigsFromReader(r, name) }
go
func ReadConfigs(path string) ([]*Config, error) { var r io.Reader name := path if path == "-" { r = os.Stdin name = "standard input" } else { f, err := os.Open(flagConf) if err != nil { return nil, err } defer f.Close() r = f } return readConfigsFromReader(r, name) }
[ "func", "ReadConfigs", "(", "path", "string", ")", "(", "[", "]", "*", "Config", ",", "error", ")", "{", "var", "r", "io", ".", "Reader", "\n", "name", ":=", "path", "\n", "if", "path", "==", "\"", "\"", "{", "r", "=", "os", ".", "Stdin", "\n",...
// ReadConfigs reads configurations from either a file or, as a special case, // stdin if "-" is given for path.
[ "ReadConfigs", "reads", "configurations", "from", "either", "a", "file", "or", "as", "a", "special", "case", "stdin", "if", "-", "is", "given", "for", "path", "." ]
e1e64e8a6dd7552a6e8f616474c91d4d089eada6
https://github.com/cespare/reflex/blob/e1e64e8a6dd7552a6e8f616474c91d4d089eada6/config.go#L60-L75
train
cespare/reflex
watch.go
watch
func watch(root string, watcher *fsnotify.Watcher, names chan<- string, done chan<- error, reflexes []*Reflex) { if err := filepath.Walk(root, walker(watcher, reflexes)); err != nil { infoPrintf(-1, "Error while walking path %s: %s", root, err) } for { select { case e := <-watcher.Events: if verbose { ...
go
func watch(root string, watcher *fsnotify.Watcher, names chan<- string, done chan<- error, reflexes []*Reflex) { if err := filepath.Walk(root, walker(watcher, reflexes)); err != nil { infoPrintf(-1, "Error while walking path %s: %s", root, err) } for { select { case e := <-watcher.Events: if verbose { ...
[ "func", "watch", "(", "root", "string", ",", "watcher", "*", "fsnotify", ".", "Watcher", ",", "names", "chan", "<-", "string", ",", "done", "chan", "<-", "error", ",", "reflexes", "[", "]", "*", "Reflex", ")", "{", "if", "err", ":=", "filepath", ".",...
// watch recursively watches changes in root and reports the filenames to names. // It sends an error on the done chan. // As an optimization, any dirs we encounter that meet the ExcludePrefix // criteria of all reflexes can be ignored.
[ "watch", "recursively", "watches", "changes", "in", "root", "and", "reports", "the", "filenames", "to", "names", ".", "It", "sends", "an", "error", "on", "the", "done", "chan", ".", "As", "an", "optimization", "any", "dirs", "we", "encounter", "that", "mee...
e1e64e8a6dd7552a6e8f616474c91d4d089eada6
https://github.com/cespare/reflex/blob/e1e64e8a6dd7552a6e8f616474c91d4d089eada6/watch.go#L17-L52
train
cespare/reflex
reflex.go
NewReflex
func NewReflex(c *Config) (*Reflex, error) { matcher, err := ParseMatchers(c.regexes, c.inverseRegexes, c.globs, c.inverseGlobs) if err != nil { return nil, fmt.Errorf("error parsing glob/regex: %s", err) } if !c.allFiles { matcher = multiMatcher{defaultExcludeMatcher, matcher} } if len(c.command) == 0 { re...
go
func NewReflex(c *Config) (*Reflex, error) { matcher, err := ParseMatchers(c.regexes, c.inverseRegexes, c.globs, c.inverseGlobs) if err != nil { return nil, fmt.Errorf("error parsing glob/regex: %s", err) } if !c.allFiles { matcher = multiMatcher{defaultExcludeMatcher, matcher} } if len(c.command) == 0 { re...
[ "func", "NewReflex", "(", "c", "*", "Config", ")", "(", "*", "Reflex", ",", "error", ")", "{", "matcher", ",", "err", ":=", "ParseMatchers", "(", "c", ".", "regexes", ",", "c", ".", "inverseRegexes", ",", "c", ".", "globs", ",", "c", ".", "inverseG...
// NewReflex prepares a Reflex from a Config, with sanity checking.
[ "NewReflex", "prepares", "a", "Reflex", "from", "a", "Config", "with", "sanity", "checking", "." ]
e1e64e8a6dd7552a6e8f616474c91d4d089eada6
https://github.com/cespare/reflex/blob/e1e64e8a6dd7552a6e8f616474c91d4d089eada6/reflex.go#L43-L102
train
cespare/reflex
reflex.go
runCommand
func (r *Reflex) runCommand(name string, stdout chan<- OutMsg) { command := replaceSubSymbol(r.command, r.subSymbol, name) cmd := exec.Command(command[0], command[1:]...) r.cmd = cmd if flagSequential { seqCommands.Lock() } tty, err := pty.Start(cmd) if err != nil { infoPrintln(r.id, err) return } r.tt...
go
func (r *Reflex) runCommand(name string, stdout chan<- OutMsg) { command := replaceSubSymbol(r.command, r.subSymbol, name) cmd := exec.Command(command[0], command[1:]...) r.cmd = cmd if flagSequential { seqCommands.Lock() } tty, err := pty.Start(cmd) if err != nil { infoPrintln(r.id, err) return } r.tt...
[ "func", "(", "r", "*", "Reflex", ")", "runCommand", "(", "name", "string", ",", "stdout", "chan", "<-", "OutMsg", ")", "{", "command", ":=", "replaceSubSymbol", "(", "r", ".", "command", ",", "r", ".", "subSymbol", ",", "name", ")", "\n", "cmd", ":="...
// runCommand runs the given Command. All output is passed line-by-line to the // stdout channel.
[ "runCommand", "runs", "the", "given", "Command", ".", "All", "output", "is", "passed", "line", "-", "by", "-", "line", "to", "the", "stdout", "channel", "." ]
e1e64e8a6dd7552a6e8f616474c91d4d089eada6
https://github.com/cespare/reflex/blob/e1e64e8a6dd7552a6e8f616474c91d4d089eada6/reflex.go#L261-L316
train
bxcodec/faker
support/slice/helpers.go
Contains
func Contains(slice []string, item string) bool { set := make(map[string]struct{}, len(slice)) for _, s := range slice { set[s] = struct{}{} } _, ok := set[item] return ok }
go
func Contains(slice []string, item string) bool { set := make(map[string]struct{}, len(slice)) for _, s := range slice { set[s] = struct{}{} } _, ok := set[item] return ok }
[ "func", "Contains", "(", "slice", "[", "]", "string", ",", "item", "string", ")", "bool", "{", "set", ":=", "make", "(", "map", "[", "string", "]", "struct", "{", "}", ",", "len", "(", "slice", ")", ")", "\n", "for", "_", ",", "s", ":=", "range...
// Contains Check item in slice string type
[ "Contains", "Check", "item", "in", "slice", "string", "type" ]
342a24f52a104690266c76399570254ec476d42c
https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/support/slice/helpers.go#L8-L16
train
bxcodec/faker
support/slice/helpers.go
IntToString
func IntToString(intSl []int) (str []string) { for i := range intSl { number := intSl[i] text := strconv.Itoa(number) str = append(str, text) } return str }
go
func IntToString(intSl []int) (str []string) { for i := range intSl { number := intSl[i] text := strconv.Itoa(number) str = append(str, text) } return str }
[ "func", "IntToString", "(", "intSl", "[", "]", "int", ")", "(", "str", "[", "]", "string", ")", "{", "for", "i", ":=", "range", "intSl", "{", "number", ":=", "intSl", "[", "i", "]", "\n", "text", ":=", "strconv", ".", "Itoa", "(", "number", ")", ...
// IntToString Convert slice int to slice string
[ "IntToString", "Convert", "slice", "int", "to", "slice", "string" ]
342a24f52a104690266c76399570254ec476d42c
https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/support/slice/helpers.go#L19-L26
train
bxcodec/faker
price.go
GetPrice
func GetPrice() Money { mu.Lock() defer mu.Unlock() if pri == nil { pri = &Price{} } return pri }
go
func GetPrice() Money { mu.Lock() defer mu.Unlock() if pri == nil { pri = &Price{} } return pri }
[ "func", "GetPrice", "(", ")", "Money", "{", "mu", ".", "Lock", "(", ")", "\n", "defer", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "pri", "==", "nil", "{", "pri", "=", "&", "Price", "{", "}", "\n", "}", "\n", "return", "pri", "\n", "}" ]
// GetPrice returns a new Money interface of Price struct
[ "GetPrice", "returns", "a", "new", "Money", "interface", "of", "Price", "struct" ]
342a24f52a104690266c76399570254ec476d42c
https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/price.go#L48-L56
train
bxcodec/faker
price.go
Currency
func (p Price) Currency(v reflect.Value) (interface{}, error) { return p.currency(), nil }
go
func (p Price) Currency(v reflect.Value) (interface{}, error) { return p.currency(), nil }
[ "func", "(", "p", "Price", ")", "Currency", "(", "v", "reflect", ".", "Value", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "p", ".", "currency", "(", ")", ",", "nil", "\n", "}" ]
// Currency returns a random currency from currencies
[ "Currency", "returns", "a", "random", "currency", "from", "currencies" ]
342a24f52a104690266c76399570254ec476d42c
https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/price.go#L68-L70
train
bxcodec/faker
price.go
AmountWithCurrency
func (p Price) AmountWithCurrency(v reflect.Value) (interface{}, error) { return p.amountwithcurrency(), nil }
go
func (p Price) AmountWithCurrency(v reflect.Value) (interface{}, error) { return p.amountwithcurrency(), nil }
[ "func", "(", "p", "Price", ")", "AmountWithCurrency", "(", "v", "reflect", ".", "Value", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "p", ".", "amountwithcurrency", "(", ")", ",", "nil", "\n", "}" ]
// AmountWithCurrency combines both price and currency together
[ "AmountWithCurrency", "combines", "both", "price", "and", "currency", "together" ]
342a24f52a104690266c76399570254ec476d42c
https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/price.go#L101-L103
train