Documentation ¶
Index ¶
- func Column(col string) columnExpression
- type Date
- func (date *Date) GobDecode(b []byte) error
- func (date Date) GobEncode() ([]byte, error)
- func (date Date) GormDataType() string
- func (date Date) MarshalJSON() ([]byte, error)
- func (date *Date) Scan(value interface{}) (err error)
- func (date *Date) UnmarshalJSON(b []byte) error
- func (date Date) Value() (driver.Value, error)
- type JSON
- func (JSON) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (JSON) GormDataType() string
- func (js JSON) GormValue(ctx context.Context, db *gorm.DB) clause.Expr
- func (j JSON) MarshalJSON() ([]byte, error)
- func (j *JSON) Scan(value interface{}) error
- func (j JSON) String() string
- func (j *JSON) UnmarshalJSON(b []byte) error
- func (j JSON) Value() (driver.Value, error)
- type JSONArrayExpression
- type JSONMap
- func (JSONMap) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (m JSONMap) GormDataType() string
- func (jm JSONMap) GormValue(ctx context.Context, db *gorm.DB) clause.Expr
- func (m JSONMap) MarshalJSON() ([]byte, error)
- func (m *JSONMap) Scan(val interface{}) error
- func (m *JSONMap) UnmarshalJSON(b []byte) error
- func (m JSONMap) Value() (driver.Value, error)
- type JSONOverlapsExpression
- type JSONQueryExpression
- func (jsonQuery *JSONQueryExpression) Build(builder clause.Builder)
- func (jsonQuery *JSONQueryExpression) Equals(value interface{}, keys ...string) *JSONQueryExpression
- func (jsonQuery *JSONQueryExpression) Extract(path string) *JSONQueryExpression
- func (jsonQuery *JSONQueryExpression) HasKey(keys ...string) *JSONQueryExpression
- func (jsonQuery *JSONQueryExpression) Likes(value interface{}, keys ...string) *JSONQueryExpression
- type JSONSetExpression
- type JSONSlice
- func (JSONSlice[T]) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (JSONSlice[T]) GormDataType() string
- func (j JSONSlice[T]) GormValue(ctx context.Context, db *gorm.DB) clause.Expr
- func (j *JSONSlice[T]) Scan(value interface{}) error
- func (j JSONSlice[T]) Value() (driver.Value, error)
- type JSONType
- func (j JSONType[T]) Data() T
- func (JSONType[T]) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (JSONType[T]) GormDataType() string
- func (js JSONType[T]) GormValue(ctx context.Context, db *gorm.DB) clause.Expr
- func (j JSONType[T]) MarshalJSON() ([]byte, error)
- func (j *JSONType[T]) Scan(value interface{}) error
- func (j *JSONType[T]) UnmarshalJSON(b []byte) error
- func (j JSONType[T]) Value() (driver.Value, error)
- type Time
- type URL
- func (URL) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (URL) GormDataType() string
- func (u URL) MarshalJSON() ([]byte, error)
- func (u *URL) Scan(value interface{}) error
- func (u *URL) String() string
- func (u *URL) UnmarshalJSON(data []byte) error
- func (u URL) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Date ¶
func (Date) GormDataType ¶
GormDataType gorm common data type
func (Date) MarshalJSON ¶
func (*Date) UnmarshalJSON ¶
type JSON ¶
type JSON json.RawMessage
JSON defined JSON data type, need to implements driver.Valuer, sql.Scanner interface
func (JSON) GormDBDataType ¶
GormDBDataType gorm db data type
func (JSON) MarshalJSON ¶
MarshalJSON to output non base64 encoded []byte
func (*JSON) UnmarshalJSON ¶
UnmarshalJSON to deserialize []byte
type JSONArrayExpression ¶
type JSONArrayExpression struct {
// contains filtered or unexported fields
}
func JSONArrayQuery ¶
func JSONArrayQuery(column string) *JSONArrayExpression
func (*JSONArrayExpression) Build ¶
func (json *JSONArrayExpression) Build(builder clause.Builder)
Build implements clause.Expression
func (*JSONArrayExpression) Contains ¶
func (json *JSONArrayExpression) Contains(value interface{}) *JSONArrayExpression
type JSONMap ¶
type JSONMap map[string]interface{}
JSONMap defined JSON data type, need to implements driver.Valuer, sql.Scanner interface
func (JSONMap) GormDBDataType ¶
GormDBDataType gorm db data type
func (JSONMap) GormDataType ¶
GormDataType gorm common data type
func (JSONMap) MarshalJSON ¶
MarshalJSON to output non base64 encoded []byte
func (*JSONMap) UnmarshalJSON ¶
UnmarshalJSON to deserialize []byte
type JSONOverlapsExpression ¶
type JSONOverlapsExpression struct {
// contains filtered or unexported fields
}
JSONOverlapsExpression JSON_OVERLAPS expression, implements clause.Expression interface to use as querier
func JSONOverlaps ¶
func JSONOverlaps(column clause.Expression, value string) *JSONOverlapsExpression
JSONOverlaps query column as json
func (*JSONOverlapsExpression) Build ¶
func (json *JSONOverlapsExpression) Build(builder clause.Builder)
Build implements clause.Expression only mysql support JSON_OVERLAPS
type JSONQueryExpression ¶
type JSONQueryExpression struct {
// contains filtered or unexported fields
}
JSONQueryExpression json query expression, implements clause.Expression interface to use as querier
func (*JSONQueryExpression) Build ¶
func (jsonQuery *JSONQueryExpression) Build(builder clause.Builder)
Build implements clause.Expression
func (*JSONQueryExpression) Equals ¶
func (jsonQuery *JSONQueryExpression) Equals(value interface{}, keys ...string) *JSONQueryExpression
Keys returns clause.Expression
func (*JSONQueryExpression) Extract ¶
func (jsonQuery *JSONQueryExpression) Extract(path string) *JSONQueryExpression
Extract extract json with path
func (*JSONQueryExpression) HasKey ¶
func (jsonQuery *JSONQueryExpression) HasKey(keys ...string) *JSONQueryExpression
HasKey returns clause.Expression
func (*JSONQueryExpression) Likes ¶
func (jsonQuery *JSONQueryExpression) Likes(value interface{}, keys ...string) *JSONQueryExpression
Likes return clause.Expression
type JSONSetExpression ¶
type JSONSetExpression struct {
// contains filtered or unexported fields
}
JSONSetExpression json set expression, implements clause.Expression interface to use as updater
func (*JSONSetExpression) Build ¶
func (jsonSet *JSONSetExpression) Build(builder clause.Builder)
Build implements clause.Expression support mysql, sqlite and postgres
func (*JSONSetExpression) Set ¶
func (jsonSet *JSONSetExpression) Set(path string, value interface{}) *JSONSetExpression
Set return clause.Expression.
{ "age": 20, "name": "json-1", "orgs": {"orga": "orgv"}, "tags": ["tag1", "tag2"] } // In MySQL/SQLite, path is `age`, `name`, `orgs.orga`, `tags[0]`, `tags[1]`. DB.UpdateColumn("attr", JSONSet("attr").Set("orgs.orga", 42)) // In PostgreSQL, path is `{age}`, `{name}`, `{orgs,orga}`, `{tags, 0}`, `{tags, 1}`. DB.UpdateColumn("attr", JSONSet("attr").Set("{orgs, orga}", "bar"))
type JSONSlice ¶
type JSONSlice[T any] []T
JSONSlice give a generic data type for json encoded slice data.
func NewJSONSlice ¶
func (JSONSlice[T]) GormDBDataType ¶
GormDBDataType gorm db data type
func (JSONSlice[T]) GormDataType ¶
GormDataType gorm common data type
type JSONType ¶
type JSONType[T any] struct { // contains filtered or unexported fields }
JSONType give a generic data type for json encoded data.
func NewJSONType ¶
func (JSONType[T]) GormDBDataType ¶
GormDBDataType gorm db data type
func (JSONType[T]) GormDataType ¶
GormDataType gorm common data type
func (JSONType[T]) MarshalJSON ¶
MarshalJSON to output non base64 encoded []byte
func (*JSONType[T]) UnmarshalJSON ¶
UnmarshalJSON to deserialize []byte
type Time ¶
Time is alias type for time.Time
func (Time) MarshalJSON ¶
MarshalJSON implements json marshal interface.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements json unmarshal interface.