Documentation
¶
Index ¶
- type Bool
- func (b Bool) Asc() clause.OrderByColumn
- func (b Bool) Column() clause.Column
- func (b Bool) ColumnName() string
- func (b Bool) Desc() clause.OrderByColumn
- func (b Bool) Eq(value bool) clause.Expression
- func (b Bool) InExpr(expr clause.Expression) clause.Expression
- func (b Bool) IsFalse() clause.Expression
- func (b Bool) IsNotNull() clause.Expression
- func (b Bool) IsNull() clause.Expression
- func (b Bool) IsTrue() clause.Expression
- func (b Bool) Neq(value bool) clause.Expression
- func (b Bool) NotInExpr(expr clause.Expression) clause.Expression
- func (b Bool) Set(val bool) clause.Assignment
- func (b Bool) WithColumn(name string) Bool
- func (b Bool) WithTable(name string) Bool
- type Bytes
- func (b Bytes) Column() clause.Column
- func (b Bytes) ColumnName() string
- func (b Bytes) Eq(value []byte) clause.Expression
- func (b Bytes) InExpr(expr clause.Expression) clause.Expression
- func (b Bytes) IsNotNull() clause.Expression
- func (b Bytes) IsNull() clause.Expression
- func (b Bytes) Neq(value []byte) clause.Expression
- func (b Bytes) NotInExpr(expr clause.Expression) clause.Expression
- func (b Bytes) Set(val []byte) clause.Assignment
- func (b Bytes) WithColumn(name string) Bytes
- func (b Bytes) WithTable(name string) Bytes
- type Field
- func (f Field[T]) Asc() clause.OrderByColumn
- func (f Field[T]) Column() clause.Column
- func (f Field[T]) ColumnName() string
- func (f Field[T]) Desc() clause.OrderByColumn
- func (f Field[T]) Eq(value T) clause.Expression
- func (f Field[T]) In(values ...T) clause.Expression
- func (f Field[T]) IsNotNull() clause.Expression
- func (f Field[T]) IsNull() clause.Expression
- func (f Field[T]) Neq(value T) clause.Expression
- func (f Field[T]) NotIn(values ...T) clause.Expression
- func (f Field[T]) Set(val T) clause.Assignment
- func (f Field[T]) WithColumn(name string) Field[T]
- func (f Field[T]) WithTable(name string) Field[T]
- type JSON
- func (j JSON[T]) Column() clause.Column
- func (j JSON[T]) ColumnName() string
- func (j JSON[T]) IsNotNull() clause.Expression
- func (j JSON[T]) IsNull() clause.Expression
- func (j JSON[T]) MergePatch(value any) clause.Assignment
- func (j JSON[T]) MergePreserve(value any) clause.Assignment
- func (j JSON[T]) Path(path string) JSONPathBuilder
- func (j JSON[T]) PathEq(path string, value any) clause.Expression
- func (j JSON[T]) RawSet(val any) clause.Assignment
- func (j JSON[T]) RemoveBuilder(dialect jsonpkg.JSONDialect) *jsonpkg.JSONRemoveBuilder
- func (j JSON[T]) RemovePath(path string) clause.Assignment
- func (j JSON[T]) Set(val T) clause.Assignment
- func (j JSON[T]) SetBuilder(dialect jsonpkg.JSONDialect) *jsonpkg.JSONSetBuilder
- func (j JSON[T]) SetPath(path string, value any) clause.Assignment
- func (j JSON[T]) SetPaths(args ...jsonpkg.PathValue) clause.Assignment
- func (j JSON[T]) WithColumn(name string) JSON[T]
- func (j JSON[T]) WithTable(name string) JSON[T]
- type JSONPathBuilder
- type Number
- func (n Number[T]) Asc() clause.OrderByColumn
- func (n Number[T]) Between(v1, v2 T) clause.Expression
- func (n Number[T]) Column() clause.Column
- func (n Number[T]) ColumnName() string
- func (n Number[T]) Desc() clause.OrderByColumn
- func (n Number[T]) Eq(value T) clause.Expression
- func (n Number[T]) Gt(value T) clause.Expression
- func (n Number[T]) Gte(value T) clause.Expression
- func (n Number[T]) In(values ...T) clause.Expression
- func (n Number[T]) InExpr(expr clause.Expression) clause.Expression
- func (n Number[T]) IsNotNull() clause.Expression
- func (n Number[T]) IsNull() clause.Expression
- func (n Number[T]) Lt(value T) clause.Expression
- func (n Number[T]) Lte(value T) clause.Expression
- func (n Number[T]) Neq(value T) clause.Expression
- func (n Number[T]) NotIn(values ...T) clause.Expression
- func (n Number[T]) NotInExpr(expr clause.Expression) clause.Expression
- func (n Number[T]) Set(val T) clause.Assignment
- func (n Number[T]) WithColumn(name string) Number[T]
- func (n Number[T]) WithTable(name string) Number[T]
- type String
- func (s String) Asc() clause.OrderByColumn
- func (s String) Column() clause.Column
- func (s String) ColumnName() string
- func (s String) Desc() clause.OrderByColumn
- func (s String) Eq(value string) clause.Expression
- func (s String) In(values ...string) clause.Expression
- func (s String) InExpr(expr clause.Expression) clause.Expression
- func (s String) IsNotNull() clause.Expression
- func (s String) IsNull() clause.Expression
- func (s String) Like(pattern string) clause.Expression
- func (s String) Neq(value string) clause.Expression
- func (s String) NotIn(values ...string) clause.Expression
- func (s String) NotInExpr(expr clause.Expression) clause.Expression
- func (s String) NotLike(pattern string) clause.Expression
- func (s String) Set(val string) clause.Assignment
- func (s String) WithColumn(name string) String
- func (s String) WithTable(name string) String
- type Time
- func (t Time) Asc() clause.OrderByColumn
- func (t Time) Between(v1, v2 time.Time) clause.Expression
- func (t Time) Column() clause.Column
- func (t Time) ColumnName() string
- func (t Time) Desc() clause.OrderByColumn
- func (t Time) Eq(value time.Time) clause.Expression
- func (t Time) Gt(value time.Time) clause.Expression
- func (t Time) Gte(value time.Time) clause.Expression
- func (t Time) InExpr(expr clause.Expression) clause.Expression
- func (t Time) IsNotNull() clause.Expression
- func (t Time) IsNull() clause.Expression
- func (t Time) Lt(value time.Time) clause.Expression
- func (t Time) Lte(value time.Time) clause.Expression
- func (t Time) Neq(value time.Time) clause.Expression
- func (t Time) NotInExpr(expr clause.Expression) clause.Expression
- func (t Time) Set(val time.Time) clause.Assignment
- func (t Time) WithColumn(name string) Time
- func (t Time) WithTable(name string) Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
Bool represents a boolean field for building SQL queries.
func (Bool) Asc ¶
func (b Bool) Asc() clause.OrderByColumn
Asc creates an ascending order expression for ORDER BY clauses.
func (Bool) ColumnName ¶
ColumnName implements the clause.Columnar interface
func (Bool) Desc ¶
func (b Bool) Desc() clause.OrderByColumn
Desc creates a descending order expression for ORDER BY clauses.
func (Bool) Eq ¶
func (b Bool) Eq(value bool) clause.Expression
Eq creates an equality comparison expression (field = value).
func (Bool) InExpr ¶ added in v0.2.0
func (b Bool) InExpr(expr clause.Expression) clause.Expression
InExpr creates an IN expression with a subquery (field IN (SELECT ...)).
func (Bool) IsFalse ¶
func (b Bool) IsFalse() clause.Expression
IsFalse creates a FALSE check expression (field = FALSE).
func (Bool) IsNotNull ¶
func (b Bool) IsNotNull() clause.Expression
IsNotNull creates a NOT NULL check expression (field IS NOT NULL).
func (Bool) IsNull ¶
func (b Bool) IsNull() clause.Expression
IsNull creates a NULL check expression (field IS NULL).
func (Bool) IsTrue ¶
func (b Bool) IsTrue() clause.Expression
IsTrue creates a TRUE check expression (field = TRUE).
func (Bool) Neq ¶
func (b Bool) Neq(value bool) clause.Expression
Neq creates a not equal comparison expression (field != value).
func (Bool) NotInExpr ¶ added in v0.2.0
func (b Bool) NotInExpr(expr clause.Expression) clause.Expression
NotInExpr creates a NOT IN expression with a subquery (field NOT IN (SELECT ...)).
func (Bool) Set ¶
func (b Bool) Set(val bool) clause.Assignment
Set creates an assignment expression for UPDATE operations (field = value).
func (Bool) WithColumn ¶
WithColumn creates a new Bool field with the specified column name.
type Bytes ¶
type Bytes struct {
// contains filtered or unexported fields
}
Bytes represents a binary data field (BLOB/BYTEA) for building SQL queries.
func (Bytes) ColumnName ¶
ColumnName implements the clause.Columnar interface
func (Bytes) Eq ¶
func (b Bytes) Eq(value []byte) clause.Expression
Eq creates an equality comparison expression (field = value).
func (Bytes) InExpr ¶ added in v0.2.0
func (b Bytes) InExpr(expr clause.Expression) clause.Expression
InExpr creates an IN expression with a subquery (field IN (SELECT ...)).
func (Bytes) IsNotNull ¶
func (b Bytes) IsNotNull() clause.Expression
IsNotNull creates a NOT NULL check expression (field IS NOT NULL).
func (Bytes) IsNull ¶
func (b Bytes) IsNull() clause.Expression
IsNull creates a NULL check expression (field IS NULL).
func (Bytes) Neq ¶
func (b Bytes) Neq(value []byte) clause.Expression
Neq creates a not equal comparison expression (field != value).
func (Bytes) NotInExpr ¶ added in v0.2.0
func (b Bytes) NotInExpr(expr clause.Expression) clause.Expression
NotInExpr creates a NOT IN expression with a subquery (field NOT IN (SELECT ...)).
func (Bytes) Set ¶
func (b Bytes) Set(val []byte) clause.Assignment
Set creates an assignment expression for UPDATE operations (field = value).
func (Bytes) WithColumn ¶
WithColumn creates a new Bytes field with the specified column name.
type Field ¶
type Field[T any] struct { // contains filtered or unexported fields }
Field represents a generic field for any type. Use this for types that don't have a specific field type.
func (Field[T]) Asc ¶
func (f Field[T]) Asc() clause.OrderByColumn
Asc creates an ascending order expression for ORDER BY clauses.
func (Field[T]) ColumnName ¶
ColumnName implements the clause.Columnar interface
func (Field[T]) Desc ¶
func (f Field[T]) Desc() clause.OrderByColumn
Desc creates a descending order expression for ORDER BY clauses.
func (Field[T]) Eq ¶
func (f Field[T]) Eq(value T) clause.Expression
Eq creates an equality comparison expression (field = value).
func (Field[T]) In ¶
func (f Field[T]) In(values ...T) clause.Expression
In creates an IN comparison expression (field IN (values...)).
func (Field[T]) IsNotNull ¶
func (f Field[T]) IsNotNull() clause.Expression
IsNotNull creates a NOT NULL check expression (field IS NOT NULL).
func (Field[T]) IsNull ¶
func (f Field[T]) IsNull() clause.Expression
IsNull creates a NULL check expression (field IS NULL).
func (Field[T]) Neq ¶
func (f Field[T]) Neq(value T) clause.Expression
Neq creates a not equal comparison expression (field != value).
func (Field[T]) NotIn ¶
func (f Field[T]) NotIn(values ...T) clause.Expression
NotIn creates a NOT IN comparison expression (field NOT IN (values...)).
func (Field[T]) Set ¶
func (f Field[T]) Set(val T) clause.Assignment
Set creates an assignment expression for UPDATE operations (field = value).
func (Field[T]) WithColumn ¶
WithColumn creates a new Field with the specified column name.
type JSON ¶
type JSON[T any] struct { // contains filtered or unexported fields }
JSON represents a JSON field for building SQL queries. It supports any type that implements json.Marshaler/Unmarshaler indirectly.
func (JSON[T]) ColumnName ¶
ColumnName implements the clause.Columnar interface
func (JSON[T]) IsNotNull ¶
func (j JSON[T]) IsNotNull() clause.Expression
IsNotNull creates a NOT NULL check expression (field IS NOT NULL).
func (JSON[T]) IsNull ¶
func (j JSON[T]) IsNull() clause.Expression
IsNull creates a NULL check expression (field IS NULL).
func (JSON[T]) MergePatch ¶
func (j JSON[T]) MergePatch(value any) clause.Assignment
MergePatch creates a merge patch assignment (RFC 7396). Merges the given JSON object into the existing column value.
func (JSON[T]) MergePreserve ¶
func (j JSON[T]) MergePreserve(value any) clause.Assignment
MergePreserve creates a merge preserve assignment (Legacy/Concat). Merges values, preserving arrays (concatenating) where supported.
func (JSON[T]) Path ¶
func (j JSON[T]) Path(path string) JSONPathBuilder
Path returns a JSONPathBuilder for operating on a specific JSON path. Use .With(dialect) to get dialect-specific operations.
Example:
field.Metadata.Path("$.name").With(json.MySQL).Eq("alice")
field.Metadata.Path("name").With(json.Postgres).Eq("alice")
func (JSON[T]) PathEq ¶
func (j JSON[T]) PathEq(path string, value any) clause.Expression
PathEq creates an equality expression for this JSON path using the default dialect. For explicit dialect control, use Path("...").With(dialect).Eq(value).
func (JSON[T]) RawSet ¶
func (j JSON[T]) RawSet(val any) clause.Assignment
RawSet allows setting raw JSON string/bytes directly if needed
func (JSON[T]) RemoveBuilder ¶
func (j JSON[T]) RemoveBuilder(dialect jsonpkg.JSONDialect) *jsonpkg.JSONRemoveBuilder
RemoveBuilder returns a JSONRemoveBuilder for constructing multi-path REMOVE expressions.
Example:
builder := field.Metadata.RemoveBuilder(json.MySQL).
Path("$.temp").
Path("$.cache")
repo.UpdateColumns(ctx, id, builder.Assignment(field.Metadata.Column()))
func (JSON[T]) RemovePath ¶
func (j JSON[T]) RemovePath(path string) clause.Assignment
RemovePath creates an assignment expression for removing a JSON path using the default dialect.
func (JSON[T]) Set ¶
func (j JSON[T]) Set(val T) clause.Assignment
Set creates an assignment expression with JSON marshaling.
func (JSON[T]) SetBuilder ¶
func (j JSON[T]) SetBuilder(dialect jsonpkg.JSONDialect) *jsonpkg.JSONSetBuilder
SetBuilder returns a JSONSetBuilder for constructing multi-path SET expressions. Use with a dialect: .SetBuilder(json.MySQL).Path(...).Path(...).Assignment(col)
Example:
builder := field.Metadata.SetBuilder(json.MySQL).
Path("$.name", "alice").
Path("$.age", 25)
repo.UpdateColumns(ctx, id, builder.Assignment(field.Metadata.Column()))
func (JSON[T]) SetPath ¶
func (j JSON[T]) SetPath(path string, value any) clause.Assignment
SetPath creates an assignment expression for setting a JSON path using the default dialect.
func (JSON[T]) SetPaths ¶
func (j JSON[T]) SetPaths(args ...jsonpkg.PathValue) clause.Assignment
SetPaths creates an assignment expression for setting multiple JSON paths using the default dialect. It simplifies using SetBuilder by accepting PathValue pairs directly.
Example:
repo.UpdateColumns(ctx, id, field.Metadata.SetPaths(
generated.UserMetadata.Name.Arg("Alice"),
generated.UserMetadata.Age.Arg(30),
))
func (JSON[T]) WithColumn ¶
WithColumn creates a new JSON field with the specified column name.
type JSONPathBuilder ¶
type JSONPathBuilder struct {
// contains filtered or unexported fields
}
JSONPathBuilder holds a JSON column and path for dialect-aware operations.
func (JSONPathBuilder) With ¶
func (p JSONPathBuilder) With(dialect jsonpkg.JSONDialect) jsonpkg.JSONPathOps
With returns JSONPathOps configured with the specified dialect.
type Number ¶
type Number[T constraints.Integer | constraints.Float] struct { // contains filtered or unexported fields }
Number represents a numeric field that supports both integer and float types. It provides type-safe operations for building SQL queries.
func (Number[T]) Asc ¶
func (n Number[T]) Asc() clause.OrderByColumn
Asc creates an ascending order expression for ORDER BY clauses.
func (Number[T]) Between ¶
func (n Number[T]) Between(v1, v2 T) clause.Expression
Between creates a range comparison expression (field BETWEEN v1 AND v2).
func (Number[T]) ColumnName ¶
ColumnName implements the clause.Columnar interface
func (Number[T]) Desc ¶
func (n Number[T]) Desc() clause.OrderByColumn
Desc creates a descending order expression for ORDER BY clauses.
func (Number[T]) Eq ¶
func (n Number[T]) Eq(value T) clause.Expression
Eq creates an equality comparison expression (field = value).
func (Number[T]) Gt ¶
func (n Number[T]) Gt(value T) clause.Expression
Gt creates a greater than comparison expression (field > value).
func (Number[T]) Gte ¶
func (n Number[T]) Gte(value T) clause.Expression
Gte creates a greater than or equal comparison expression (field >= value).
func (Number[T]) In ¶
func (n Number[T]) In(values ...T) clause.Expression
In creates an IN comparison expression (field IN (values...)).
func (Number[T]) InExpr ¶ added in v0.2.0
func (n Number[T]) InExpr(expr clause.Expression) clause.Expression
InExpr creates an IN expression with a subquery (field IN (SELECT ...)).
func (Number[T]) IsNotNull ¶
func (n Number[T]) IsNotNull() clause.Expression
IsNotNull creates a NOT NULL check expression (field IS NOT NULL).
func (Number[T]) IsNull ¶
func (n Number[T]) IsNull() clause.Expression
IsNull creates a NULL check expression (field IS NULL).
func (Number[T]) Lt ¶
func (n Number[T]) Lt(value T) clause.Expression
Lt creates a less than comparison expression (field < value).
func (Number[T]) Lte ¶
func (n Number[T]) Lte(value T) clause.Expression
Lte creates a less than or equal comparison expression (field <= value).
func (Number[T]) Neq ¶
func (n Number[T]) Neq(value T) clause.Expression
Neq creates a not equal comparison expression (field != value).
func (Number[T]) NotIn ¶
func (n Number[T]) NotIn(values ...T) clause.Expression
NotIn creates a NOT IN comparison expression (field NOT IN (values...)).
func (Number[T]) NotInExpr ¶ added in v0.2.0
func (n Number[T]) NotInExpr(expr clause.Expression) clause.Expression
NotInExpr creates a NOT IN expression with a subquery (field NOT IN (SELECT ...)).
func (Number[T]) Set ¶
func (n Number[T]) Set(val T) clause.Assignment
Set creates an assignment expression for UPDATE operations (field = value).
func (Number[T]) WithColumn ¶
WithColumn creates a new Number field with the specified column name.
type String ¶
type String struct {
// contains filtered or unexported fields
}
String represents a string field for building SQL queries.
func (String) Asc ¶
func (s String) Asc() clause.OrderByColumn
Asc creates an ascending order expression for ORDER BY clauses.
func (String) ColumnName ¶
ColumnName implements the clause.Columnar interface
func (String) Desc ¶
func (s String) Desc() clause.OrderByColumn
Desc creates a descending order expression for ORDER BY clauses.
func (String) Eq ¶
func (s String) Eq(value string) clause.Expression
Eq creates an equality comparison expression (field = value).
func (String) In ¶
func (s String) In(values ...string) clause.Expression
In creates an IN comparison expression (field IN (values...)).
func (String) InExpr ¶ added in v0.2.0
func (s String) InExpr(expr clause.Expression) clause.Expression
InExpr creates an IN expression with a subquery (field IN (SELECT ...)).
func (String) IsNotNull ¶
func (s String) IsNotNull() clause.Expression
IsNotNull creates a NOT NULL check expression (field IS NOT NULL).
func (String) IsNull ¶
func (s String) IsNull() clause.Expression
IsNull creates a NULL check expression (field IS NULL).
func (String) Like ¶
func (s String) Like(pattern string) clause.Expression
Like creates a LIKE comparison expression (field LIKE pattern).
func (String) Neq ¶
func (s String) Neq(value string) clause.Expression
Neq creates a not equal comparison expression (field != value).
func (String) NotIn ¶
func (s String) NotIn(values ...string) clause.Expression
NotIn creates a NOT IN comparison expression (field NOT IN (values...)).
func (String) NotInExpr ¶ added in v0.2.0
func (s String) NotInExpr(expr clause.Expression) clause.Expression
NotInExpr creates a NOT IN expression with a subquery (field NOT IN (SELECT ...)).
func (String) NotLike ¶
func (s String) NotLike(pattern string) clause.Expression
NotLike creates a NOT LIKE comparison expression (field NOT LIKE pattern).
func (String) Set ¶
func (s String) Set(val string) clause.Assignment
Set creates an assignment expression for UPDATE operations (field = value).
func (String) WithColumn ¶
WithColumn creates a new String field with the specified column name.
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
Time represents a time/date field for building SQL queries.
func (Time) Asc ¶
func (t Time) Asc() clause.OrderByColumn
Asc creates an ascending order expression for ORDER BY clauses.
func (Time) Between ¶
func (t Time) Between(v1, v2 time.Time) clause.Expression
Between creates a range comparison expression (field BETWEEN v1 AND v2).
func (Time) ColumnName ¶
ColumnName implements the clause.Columnar interface
func (Time) Desc ¶
func (t Time) Desc() clause.OrderByColumn
Desc creates a descending order expression for ORDER BY clauses.
func (Time) Eq ¶
func (t Time) Eq(value time.Time) clause.Expression
Eq creates an equality comparison expression (field = value).
func (Time) Gt ¶
func (t Time) Gt(value time.Time) clause.Expression
Gt creates a greater than comparison expression (field > value).
func (Time) Gte ¶
func (t Time) Gte(value time.Time) clause.Expression
Gte creates a greater than or equal comparison expression (field >= value).
func (Time) InExpr ¶ added in v0.2.0
func (t Time) InExpr(expr clause.Expression) clause.Expression
InExpr creates an IN expression with a subquery (field IN (SELECT ...)).
func (Time) IsNotNull ¶
func (t Time) IsNotNull() clause.Expression
IsNotNull creates a NOT NULL check expression (field IS NOT NULL).
func (Time) IsNull ¶
func (t Time) IsNull() clause.Expression
IsNull creates a NULL check expression (field IS NULL).
func (Time) Lt ¶
func (t Time) Lt(value time.Time) clause.Expression
Lt creates a less than comparison expression (field < value).
func (Time) Lte ¶
func (t Time) Lte(value time.Time) clause.Expression
Lte creates a less than or equal comparison expression (field <= value).
func (Time) Neq ¶
func (t Time) Neq(value time.Time) clause.Expression
Neq creates a not equal comparison expression (field != value).
func (Time) NotInExpr ¶ added in v0.2.0
func (t Time) NotInExpr(expr clause.Expression) clause.Expression
NotInExpr creates a NOT IN expression with a subquery (field NOT IN (SELECT ...)).
func (Time) Set ¶
func (t Time) Set(val time.Time) clause.Assignment
Set creates an assignment expression for UPDATE operations (field = value).
func (Time) WithColumn ¶
WithColumn creates a new Time field with the specified column name.