Documentation ¶
Index ¶
- Constants
- func GenericStructScan[T any](t *T, val any) error
- func GenericStructValue[T any](t T, defaultNull bool) (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 any) error
- func (j JSON) String() string
- func (j *JSON) UnmarshalJSON(b []byte) error
- func (j JSON) Value() (driver.Value, error)
- 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 any) error
- func (m *JSONMap) UnmarshalJSON(b []byte) error
- func (m JSONMap) Value() (driver.Value, error)
- type JSONQueryExpression
- type JSONStringMap
- func (JSONStringMap) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (m JSONStringMap) GormDataType() string
- func (jm JSONStringMap) GormValue(ctx context.Context, db *gorm.DB) clause.Expr
- func (m JSONStringMap) MarshalJSON() ([]byte, error)
- func (m *JSONStringMap) Scan(val any) error
- func (m *JSONStringMap) UnmarshalJSON(b []byte) error
- func (m JSONStringMap) Value() (driver.Value, error)
Constants ¶
const ( SQLServerType = "sqlserver" PostgresType = "postgres" SqliteType = "sqlite" MysqlType = "mysql" Text = "TEXT" JSONType = "JSON" JSONBType = "JSONB" NVarcharType = "NVARCHAR(MAX)" )
const PostgresTimestampFormat = "2006-01-02T15:04:05.999999"
Variables ¶
This section is empty.
Functions ¶
func GenericStructScan ¶ added in v1.0.20
GenericStructScan can be set as the Scan(val) func for any json struct
Types ¶
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 JSONMap ¶
JSONMap defiend 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 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 any, keys ...string) *JSONQueryExpression
Keys returns clause.Expression
func (*JSONQueryExpression) HasKey ¶
func (jsonQuery *JSONQueryExpression) HasKey(keys ...string) *JSONQueryExpression
HasKey returns clause.Expression
type JSONStringMap ¶
JSONStringMap defiend JSON data type, need to implements driver.Valuer, sql.Scanner interface
func (JSONStringMap) GormDBDataType ¶
GormDBDataType gorm db data type
func (JSONStringMap) GormDataType ¶
func (m JSONStringMap) GormDataType() string
GormDataType gorm common data type
func (JSONStringMap) MarshalJSON ¶
func (m JSONStringMap) MarshalJSON() ([]byte, error)
MarshalJSON to output non base64 encoded []byte
func (*JSONStringMap) Scan ¶
func (m *JSONStringMap) Scan(val any) error
Scan scan value into Jsonb, implements sql.Scanner interface
func (*JSONStringMap) UnmarshalJSON ¶
func (m *JSONStringMap) UnmarshalJSON(b []byte) error
UnmarshalJSON to deserialize []byte