id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
140,900 | 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 |
140,901 | 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 |
140,902 | 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 |
140,903 | 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 |
140,904 | 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 |
140,905 | 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 |
140,906 | 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 |
140,907 | 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 |
140,908 | 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 |
140,909 | 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 |
140,910 | 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 |
140,911 | 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 |
140,912 | 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 |
140,913 | 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 |
140,914 | 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 |
140,915 | 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 |
140,916 | 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 |
140,917 | 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 |
140,918 | 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 |
140,919 | 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 |
140,920 | 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 |
140,921 | 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 |
140,922 | 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 |
140,923 | 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 |
140,924 | 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 |
140,925 | 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 |
140,926 | 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 |
140,927 | 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 |
140,928 | 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 |
140,929 | 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 |
140,930 | 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 |
140,931 | 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 |
140,932 | 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 |
140,933 | 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 |
140,934 | 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 |
140,935 | 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 |
140,936 | 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 |
140,937 | 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 |
140,938 | 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 |
140,939 | 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 |
140,940 | 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 |
140,941 | 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 |
140,942 | 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 |
140,943 | 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 |
140,944 | 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 |
140,945 | 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 |
140,946 | 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 |
140,947 | 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 |
140,948 | 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 |
140,949 | 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 |
140,950 | 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 |
140,951 | 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 |
140,952 | 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 |
140,953 | 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 |
140,954 | 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 |
140,955 | 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 |
140,956 | 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 |
140,957 | 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 |
140,958 | 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 |
140,959 | 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 |
140,960 | 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 |
140,961 | 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 |
140,962 | 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 |
140,963 | 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 |
140,964 | 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 |
140,965 | 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 |
140,966 | 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 |
140,967 | 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 |
140,968 | 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 |
140,969 | 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 |
140,970 | 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 |
140,971 | 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 |
140,972 | 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 |
140,973 | bxcodec/faker | price.go | precision | func precision(val float64, pre int) float64 {
div := math.Pow10(pre)
return float64(int64(val*div)) / div
} | go | func precision(val float64, pre int) float64 {
div := math.Pow10(pre)
return float64(int64(val*div)) / div
} | [
"func",
"precision",
"(",
"val",
"float64",
",",
"pre",
"int",
")",
"float64",
"{",
"div",
":=",
"math",
".",
"Pow10",
"(",
"pre",
")",
"\n",
"return",
"float64",
"(",
"int64",
"(",
"val",
"*",
"div",
")",
")",
"/",
"div",
"\n",
"}"
] | // precision | a helper function to set precision of price | [
"precision",
"|",
"a",
"helper",
"function",
"to",
"set",
"precision",
"of",
"price"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/price.go#L112-L115 |
140,974 | bxcodec/faker | lorem.go | GetLorem | func GetLorem() DataFaker {
mu.Lock()
defer mu.Unlock()
if lorem == nil {
lorem = &Lorem{}
}
return lorem
} | go | func GetLorem() DataFaker {
mu.Lock()
defer mu.Unlock()
if lorem == nil {
lorem = &Lorem{}
}
return lorem
} | [
"func",
"GetLorem",
"(",
")",
"DataFaker",
"{",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"lorem",
"==",
"nil",
"{",
"lorem",
"=",
"&",
"Lorem",
"{",
"}",
"\n",
"}",
"\n",
"return",
"lorem",
"\n",
... | // GetLorem returns a new DataFaker interface of Lorem struct | [
"GetLorem",
"returns",
"a",
"new",
"DataFaker",
"interface",
"of",
"Lorem",
"struct"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/lorem.go#L64-L72 |
140,975 | bxcodec/faker | lorem.go | Word | func (l Lorem) Word(v reflect.Value) (interface{}, error) {
return l.word(), nil
} | go | func (l Lorem) Word(v reflect.Value) (interface{}, error) {
return l.word(), nil
} | [
"func",
"(",
"l",
"Lorem",
")",
"Word",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"l",
".",
"word",
"(",
")",
",",
"nil",
"\n",
"}"
] | // Word returns a word from the wordList const | [
"Word",
"returns",
"a",
"word",
"from",
"the",
"wordList",
"const"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/lorem.go#L83-L85 |
140,976 | bxcodec/faker | lorem.go | Sentence | func (l Lorem) Sentence(v reflect.Value) (interface{}, error) {
sentence := l.sentence()
return sentence, nil
} | go | func (l Lorem) Sentence(v reflect.Value) (interface{}, error) {
sentence := l.sentence()
return sentence, nil
} | [
"func",
"(",
"l",
"Lorem",
")",
"Sentence",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"sentence",
":=",
"l",
".",
"sentence",
"(",
")",
"\n",
"return",
"sentence",
",",
"nil",
"\n",
"}"
] | // Sentence returns a sentence using the wordList const | [
"Sentence",
"returns",
"a",
"sentence",
"using",
"the",
"wordList",
"const"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/lorem.go#L111-L114 |
140,977 | bxcodec/faker | lorem.go | Paragraph | func (l Lorem) Paragraph(v reflect.Value) (interface{}, error) {
return l.paragraph(), nil
} | go | func (l Lorem) Paragraph(v reflect.Value) (interface{}, error) {
return l.paragraph(), nil
} | [
"func",
"(",
"l",
"Lorem",
")",
"Paragraph",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"l",
".",
"paragraph",
"(",
")",
",",
"nil",
"\n",
"}"
] | // Paragraph returns a series of sentences as a paragraph using the wordList const | [
"Paragraph",
"returns",
"a",
"series",
"of",
"sentences",
"as",
"a",
"paragraph",
"using",
"the",
"wordList",
"const"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/lorem.go#L135-L137 |
140,978 | bxcodec/faker | internet.go | GetNetworker | func GetNetworker() Networker {
mu.Lock()
defer mu.Unlock()
if internet == nil {
internet = &Internet{}
}
return internet
} | go | func GetNetworker() Networker {
mu.Lock()
defer mu.Unlock()
if internet == nil {
internet = &Internet{}
}
return internet
} | [
"func",
"GetNetworker",
"(",
")",
"Networker",
"{",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"internet",
"==",
"nil",
"{",
"internet",
"=",
"&",
"Internet",
"{",
"}",
"\n",
"}",
"\n",
"return",
"inter... | // GetNetworker returns a new Networker interface of Internet | [
"GetNetworker",
"returns",
"a",
"new",
"Networker",
"interface",
"of",
"Internet"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/internet.go#L29-L37 |
140,979 | bxcodec/faker | internet.go | Email | func (internet Internet) Email(v reflect.Value) (interface{}, error) {
return internet.email(), nil
} | go | func (internet Internet) Email(v reflect.Value) (interface{}, error) {
return internet.email(), nil
} | [
"func",
"(",
"internet",
"Internet",
")",
"Email",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"internet",
".",
"email",
"(",
")",
",",
"nil",
"\n",
"}"
] | // Email generates random email id | [
"Email",
"generates",
"random",
"email",
"id"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/internet.go#L64-L66 |
140,980 | bxcodec/faker | internet.go | MacAddress | func (internet Internet) MacAddress(v reflect.Value) (interface{}, error) {
return internet.macAddress(), nil
} | go | func (internet Internet) MacAddress(v reflect.Value) (interface{}, error) {
return internet.macAddress(), nil
} | [
"func",
"(",
"internet",
"Internet",
")",
"MacAddress",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"internet",
".",
"macAddress",
"(",
")",
",",
"nil",
"\n",
"}"
] | // MacAddress generates random MacAddress | [
"MacAddress",
"generates",
"random",
"MacAddress"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/internet.go#L83-L85 |
140,981 | bxcodec/faker | internet.go | DomainName | func (internet Internet) DomainName(v reflect.Value) (interface{}, error) {
return internet.domainName(), nil
} | go | func (internet Internet) DomainName(v reflect.Value) (interface{}, error) {
return internet.domainName(), nil
} | [
"func",
"(",
"internet",
"Internet",
")",
"DomainName",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"internet",
".",
"domainName",
"(",
")",
",",
"nil",
"\n",
"}"
] | // DomainName generates random domain name | [
"DomainName",
"generates",
"random",
"domain",
"name"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/internet.go#L98-L100 |
140,982 | bxcodec/faker | internet.go | URL | func (internet Internet) URL(v reflect.Value) (interface{}, error) {
return internet.url(), nil
} | go | func (internet Internet) URL(v reflect.Value) (interface{}, error) {
return internet.url(), nil
} | [
"func",
"(",
"internet",
"Internet",
")",
"URL",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"internet",
".",
"url",
"(",
")",
",",
"nil",
"\n",
"}"
] | // URL generates random URL standardised in urlFormats const | [
"URL",
"generates",
"random",
"URL",
"standardised",
"in",
"urlFormats",
"const"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/internet.go#L118-L120 |
140,983 | bxcodec/faker | internet.go | UserName | func (internet Internet) UserName(v reflect.Value) (interface{}, error) {
return internet.username(), nil
} | go | func (internet Internet) UserName(v reflect.Value) (interface{}, error) {
return internet.username(), nil
} | [
"func",
"(",
"internet",
"Internet",
")",
"UserName",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"internet",
".",
"username",
"(",
")",
",",
"nil",
"\n",
"}"
] | // UserName generates random username | [
"UserName",
"generates",
"random",
"username"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/internet.go#L133-L135 |
140,984 | bxcodec/faker | internet.go | IPv4 | func (internet Internet) IPv4(v reflect.Value) (interface{}, error) {
return internet.ipv4(), nil
} | go | func (internet Internet) IPv4(v reflect.Value) (interface{}, error) {
return internet.ipv4(), nil
} | [
"func",
"(",
"internet",
"Internet",
")",
"IPv4",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"internet",
".",
"ipv4",
"(",
")",
",",
"nil",
"\n",
"}"
] | // IPv4 generates random IPv4 address | [
"IPv4",
"generates",
"random",
"IPv4",
"address"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/internet.go#L153-L155 |
140,985 | bxcodec/faker | internet.go | IPv6 | func (internet Internet) IPv6(v reflect.Value) (interface{}, error) {
return internet.ipv6(), nil
} | go | func (internet Internet) IPv6(v reflect.Value) (interface{}, error) {
return internet.ipv6(), nil
} | [
"func",
"(",
"internet",
"Internet",
")",
"IPv6",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"internet",
".",
"ipv6",
"(",
")",
",",
"nil",
"\n",
"}"
] | // IPv6 generates random IPv6 address | [
"IPv6",
"generates",
"random",
"IPv6",
"address"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/internet.go#L173-L175 |
140,986 | bxcodec/faker | internet.go | Password | func (internet Internet) Password(v reflect.Value) (interface{}, error) {
return internet.password(), nil
} | go | func (internet Internet) Password(v reflect.Value) (interface{}, error) {
return internet.password(), nil
} | [
"func",
"(",
"internet",
"Internet",
")",
"Password",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"internet",
".",
"password",
"(",
")",
",",
"nil",
"\n",
"}"
] | // Password returns a hashed password | [
"Password",
"returns",
"a",
"hashed",
"password"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/internet.go#L188-L190 |
140,987 | bxcodec/faker | person.go | GetPerson | func GetPerson() Dowser {
mu.Lock()
defer mu.Unlock()
if person == nil {
person = &Person{}
}
return person
} | go | func GetPerson() Dowser {
mu.Lock()
defer mu.Unlock()
if person == nil {
person = &Person{}
}
return person
} | [
"func",
"GetPerson",
"(",
")",
"Dowser",
"{",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"person",
"==",
"nil",
"{",
"person",
"=",
"&",
"Person",
"{",
"}",
"\n",
"}",
"\n",
"return",
"person",
"\n",
... | // GetPerson returns a new Dowser interface of Person struct | [
"GetPerson",
"returns",
"a",
"new",
"Dowser",
"interface",
"of",
"Person",
"struct"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/person.go#L112-L120 |
140,988 | bxcodec/faker | person.go | TitleMale | func (p Person) TitleMale(v reflect.Value) (interface{}, error) {
return p.titlemale(), nil
} | go | func (p Person) TitleMale(v reflect.Value) (interface{}, error) {
return p.titlemale(), nil
} | [
"func",
"(",
"p",
"Person",
")",
"TitleMale",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"p",
".",
"titlemale",
"(",
")",
",",
"nil",
"\n",
"}"
] | // TitleMale generates random titles for males | [
"TitleMale",
"generates",
"random",
"titles",
"for",
"males"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/person.go#L136-L138 |
140,989 | bxcodec/faker | person.go | TitleFeMale | func (p Person) TitleFeMale(v reflect.Value) (interface{}, error) {
return p.titleFemale(), nil
} | go | func (p Person) TitleFeMale(v reflect.Value) (interface{}, error) {
return p.titleFemale(), nil
} | [
"func",
"(",
"p",
"Person",
")",
"TitleFeMale",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"p",
".",
"titleFemale",
"(",
")",
",",
"nil",
"\n",
"}"
] | // TitleFeMale generates random titles for females | [
"TitleFeMale",
"generates",
"random",
"titles",
"for",
"females"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/person.go#L151-L153 |
140,990 | bxcodec/faker | person.go | FirstName | func (p Person) FirstName(v reflect.Value) (interface{}, error) {
return p.firstname(), nil
} | go | func (p Person) FirstName(v reflect.Value) (interface{}, error) {
return p.firstname(), nil
} | [
"func",
"(",
"p",
"Person",
")",
"FirstName",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"p",
".",
"firstname",
"(",
")",
",",
"nil",
"\n",
"}"
] | // FirstName retuns first names | [
"FirstName",
"retuns",
"first",
"names"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/person.go#L166-L168 |
140,991 | bxcodec/faker | person.go | FirstNameMale | func (p Person) FirstNameMale(v reflect.Value) (interface{}, error) {
return p.firstnamemale(), nil
} | go | func (p Person) FirstNameMale(v reflect.Value) (interface{}, error) {
return p.firstnamemale(), nil
} | [
"func",
"(",
"p",
"Person",
")",
"FirstNameMale",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"p",
".",
"firstnamemale",
"(",
")",
",",
"nil",
"\n",
"}"
] | // FirstNameMale retuns first names for males | [
"FirstNameMale",
"retuns",
"first",
"names",
"for",
"males"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/person.go#L181-L183 |
140,992 | bxcodec/faker | person.go | FirstNameFemale | func (p Person) FirstNameFemale(v reflect.Value) (interface{}, error) {
return p.firstnamefemale(), nil
} | go | func (p Person) FirstNameFemale(v reflect.Value) (interface{}, error) {
return p.firstnamefemale(), nil
} | [
"func",
"(",
"p",
"Person",
")",
"FirstNameFemale",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"p",
".",
"firstnamefemale",
"(",
")",
",",
"nil",
"\n",
"}"
] | // FirstNameFemale retuns first names for females | [
"FirstNameFemale",
"retuns",
"first",
"names",
"for",
"females"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/person.go#L196-L198 |
140,993 | bxcodec/faker | person.go | LastName | func (p Person) LastName(v reflect.Value) (interface{}, error) {
return p.lastname(), nil
} | go | func (p Person) LastName(v reflect.Value) (interface{}, error) {
return p.lastname(), nil
} | [
"func",
"(",
"p",
"Person",
")",
"LastName",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"p",
".",
"lastname",
"(",
")",
",",
"nil",
"\n",
"}"
] | // LastName returns last name | [
"LastName",
"returns",
"last",
"name"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/person.go#L211-L213 |
140,994 | bxcodec/faker | person.go | Name | func (p Person) Name(v reflect.Value) (interface{}, error) {
return p.name(), nil
} | go | func (p Person) Name(v reflect.Value) (interface{}, error) {
return p.name(), nil
} | [
"func",
"(",
"p",
"Person",
")",
"Name",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"p",
".",
"name",
"(",
")",
",",
"nil",
"\n",
"}"
] | // Name returns a random name | [
"Name",
"returns",
"a",
"random",
"name"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/person.go#L229-L231 |
140,995 | bxcodec/faker | address.go | GetAddress | func GetAddress() Addresser {
mu.Lock()
defer mu.Unlock()
if address == nil {
address = &Address{}
}
return address
} | go | func GetAddress() Addresser {
mu.Lock()
defer mu.Unlock()
if address == nil {
address = &Address{}
}
return address
} | [
"func",
"GetAddress",
"(",
")",
"Addresser",
"{",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"address",
"==",
"nil",
"{",
"address",
"=",
"&",
"Address",
"{",
"}",
"\n",
"}",
"\n",
"return",
"address",
... | // GetAddress returns a new Addresser interface of Address | [
"GetAddress",
"returns",
"a",
"new",
"Addresser",
"interface",
"of",
"Address"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/address.go#L11-L19 |
140,996 | bxcodec/faker | address.go | Latitude | func (i Address) Latitude(v reflect.Value) (interface{}, error) {
kind := v.Kind()
val := i.latitute()
if kind == reflect.Float32 {
return val, nil
}
return float64(val), nil
} | go | func (i Address) Latitude(v reflect.Value) (interface{}, error) {
kind := v.Kind()
val := i.latitute()
if kind == reflect.Float32 {
return val, nil
}
return float64(val), nil
} | [
"func",
"(",
"i",
"Address",
")",
"Latitude",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"kind",
":=",
"v",
".",
"Kind",
"(",
")",
"\n",
"val",
":=",
"i",
".",
"latitute",
"(",
")",
"\n",
"if",
... | // Latitude sets latitude of the address | [
"Latitude",
"sets",
"latitude",
"of",
"the",
"address"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/address.go#L40-L47 |
140,997 | bxcodec/faker | address.go | Longitude | func (i Address) Longitude(v reflect.Value) (interface{}, error) {
kind := v.Kind()
val := i.longitude()
if kind == reflect.Float32 {
return val, nil
}
return float64(val), nil
} | go | func (i Address) Longitude(v reflect.Value) (interface{}, error) {
kind := v.Kind()
val := i.longitude()
if kind == reflect.Float32 {
return val, nil
}
return float64(val), nil
} | [
"func",
"(",
"i",
"Address",
")",
"Longitude",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"kind",
":=",
"v",
".",
"Kind",
"(",
")",
"\n",
"val",
":=",
"i",
".",
"longitude",
"(",
")",
"\n",
"if",... | // Longitude sets longitude of the address | [
"Longitude",
"sets",
"longitude",
"of",
"the",
"address"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/address.go#L54-L61 |
140,998 | bxcodec/faker | faker.go | SetRandomStringLength | func SetRandomStringLength(size int) error {
if size < 0 {
return fmt.Errorf(ErrSmallerThanZero, size)
}
randomStringLen = size
return nil
} | go | func SetRandomStringLength(size int) error {
if size < 0 {
return fmt.Errorf(ErrSmallerThanZero, size)
}
randomStringLen = size
return nil
} | [
"func",
"SetRandomStringLength",
"(",
"size",
"int",
")",
"error",
"{",
"if",
"size",
"<",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"ErrSmallerThanZero",
",",
"size",
")",
"\n",
"}",
"\n",
"randomStringLen",
"=",
"size",
"\n",
"return",
"nil",
"\n"... | // SetRandomStringLength sets a length for random string generation | [
"SetRandomStringLength",
"sets",
"a",
"length",
"for",
"random",
"string",
"generation"
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/faker.go#L218-L224 |
140,999 | bxcodec/faker | faker.go | SetRandomMapAndSliceSize | func SetRandomMapAndSliceSize(size int) error {
if size < 0 {
return fmt.Errorf(ErrSmallerThanZero, size)
}
randomSize = size
return nil
} | go | func SetRandomMapAndSliceSize(size int) error {
if size < 0 {
return fmt.Errorf(ErrSmallerThanZero, size)
}
randomSize = size
return nil
} | [
"func",
"SetRandomMapAndSliceSize",
"(",
"size",
"int",
")",
"error",
"{",
"if",
"size",
"<",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"ErrSmallerThanZero",
",",
"size",
")",
"\n",
"}",
"\n",
"randomSize",
"=",
"size",
"\n",
"return",
"nil",
"\n",
... | // SetRandomMapAndSliceSize sets the size for maps and slices for random generation. | [
"SetRandomMapAndSliceSize",
"sets",
"the",
"size",
"for",
"maps",
"and",
"slices",
"for",
"random",
"generation",
"."
] | 342a24f52a104690266c76399570254ec476d42c | https://github.com/bxcodec/faker/blob/342a24f52a104690266c76399570254ec476d42c/faker.go#L227-L233 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.