Documentation
¶
Index ¶
- Constants
- func Column(col string) columnExpression
- type Archive
- type ConcurrentMapShared
- type CreatedAt
- func (c CreatedAt) Add(d time.Duration) time.Time
- func (c CreatedAt) After(u time.Time) bool
- func (c CreatedAt) Before(u time.Time) bool
- func (c CreatedAt) Equal(u time.Time) bool
- func (c CreatedAt) Format(layout string) string
- func (c CreatedAt) IsZero() bool
- func (c *CreatedAt) Set(t time.Time)
- func (c CreatedAt) Sub(u time.Time) time.Duration
- func (c CreatedAt) Time() time.Time
- func (c CreatedAt) Unix() int64
- type Date
- func (Date) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (Date) GormDataType() string
- func (t Date) GormValue(ctx context.Context, db *gorm.DB) clause.Expr
- func (t Date) MarshalJSON() ([]byte, error)
- func (t *Date) Scan(src any) error
- func (t Date) String() string
- func (t *Date) UnmarshalJSON(data []byte) error
- func (t Date) Value() (driver.Value, error)
- type Dictionary
- func (dict *Dictionary[K, V]) Add(key K, value V)
- func (dict *Dictionary[K, V]) Delete(key K)
- func (dict *Dictionary[K, V]) FindByKey(key K) (int, *KeyValue[K, V])
- func (dict *Dictionary[K, V]) FindByValue(value V) (int, *KeyValue[K, V])
- func (dict *Dictionary[K, V]) FindByValueFunc(value V, equal func(a, b V) bool) (int, *KeyValue[K, V])
- func (*Dictionary[K, V]) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (*Dictionary[K, V]) GormDataType() string
- func (dict *Dictionary[K, V]) GormValue(ctx context.Context, db *gorm.DB) clause.Expr
- func (dict *Dictionary[K, V]) JSON() ([]byte, error)
- func (dict *Dictionary[K, V]) MarshalJSON() ([]byte, error)
- func (dict *Dictionary[K, V]) Replace(index int, key K, value V) bool
- func (dict *Dictionary[K, V]) Scan(val any) error
- func (dict *Dictionary[K, V]) String() string
- func (dict *Dictionary[K, V]) UnmarshalJSON(b []byte) error
- func (dict *Dictionary[K, V]) Value() (driver.Value, error)
- type Int64Array
- type IntArray
- 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 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 any) 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 any, keys ...string) *JSONQueryExpression
- func (jsonQuery *JSONQueryExpression) Extract(path string) *JSONQueryExpression
- func (jsonQuery *JSONQueryExpression) HasKey(keys ...string) *JSONQueryExpression
- type JSONSetExpression
- type JSONSlice
- 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 any) error
- func (j *JSONType[T]) UnmarshalJSON(b []byte) error
- func (j JSONType[T]) Value() (driver.Value, error)
- type KeyValue
- type Map
- func (m Map[K, V]) Exists(key K) bool
- func (m Map[K, V]) Get(key K) (V, bool)
- func (m Map[K, V]) GetShard(key K) *ConcurrentMapShared[K, V]
- func (m *Map[K, V]) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (m Map[K, V]) Iterate() ...
- func (m Map[K, V]) MSet(data map[K]V)
- func (m Map[K, V]) Range(f func(key K, value V))
- func (m Map[K, V]) Remove(key K)
- func (m Map[K, V]) RemoveCb(key K, cb RemoveCb[K, V]) bool
- func (m *Map[K, V]) Scan(src any) error
- func (m Map[K, V]) Set(key K, value V)
- func (m Map[K, V]) SetIfAbsent(key K, value V) bool
- func (m Map[K, V]) Upsert(key K, value V, cb UpsertCb[V]) (res V)
- func (m *Map[K, V]) Value() (driver.Value, error)
- type RemoveCb
- type SoftDelete
- func (o SoftDelete) After(u time.Time) bool
- func (o SoftDelete) Before(u time.Time) bool
- func (o *SoftDelete) Delete()
- func (o SoftDelete) Equal(u time.Time) bool
- func (o SoftDelete) Format(layout string) string
- func (o *SoftDelete) IsDeleted() bool
- func (o SoftDelete) IsZero() bool
- func (o *SoftDelete) Restore()
- func (o *SoftDelete) Set(t time.Time)
- func (o *SoftDelete) SetDeleted(v bool)
- func (o SoftDelete) Time() time.Time
- func (o SoftDelete) Unix() int64
- type SoftDeletedAt
- func (SoftDeletedAt) DeleteClauses(f *schema.Field) []clause.Interface
- func (SoftDeletedAt) GormDataType() string
- func (n SoftDeletedAt) MarshalJSON() ([]byte, error)
- func (n SoftDeletedAt) NullTime() sql.NullTime
- func (SoftDeletedAt) QueryClauses(f *schema.Field) []clause.Interface
- func (n *SoftDeletedAt) Scan(value interface{}) error
- func (n SoftDeletedAt) TimeValue() (time.Time, bool)
- func (n *SoftDeletedAt) UnmarshalJSON(b []byte) error
- func (SoftDeletedAt) UpdateClauses(f *schema.Field) []clause.Interface
- func (n SoftDeletedAt) Value() (driver.Value, error)
- type StringArray
- type Stringer
- type Time
- func (Time) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (Time) GormDataType() string
- func (t Time) MarshalJSON() ([]byte, error)
- func (t *Time) Scan(src any) error
- func (t Time) String() string
- func (t *Time) UnmarshalJSON(data []byte) error
- func (t Time) Value() (driver.Value, error)
- type URL
- type UUID
- func (u UUID) Equals(other UUID) bool
- func (UUID) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (UUID) GormDataType() string
- func (u UUID) IsEmpty() bool
- func (u *UUID) IsEmptyPtr() bool
- func (u UUID) IsNil() bool
- func (u *UUID) IsNilPtr() bool
- func (u UUID) Length() int
- func (u *UUID) Scan(value interface{}) error
- func (u UUID) String() string
- func (u UUID) Value() (driver.Value, error)
- type UpdatedAt
- func (u UpdatedAt) Add(d time.Duration) time.Time
- func (u UpdatedAt) After(t time.Time) bool
- func (u UpdatedAt) Before(t time.Time) bool
- func (u UpdatedAt) Equal(t time.Time) bool
- func (u UpdatedAt) Format(layout string) string
- func (u UpdatedAt) IsZero() bool
- func (u *UpdatedAt) Set(t time.Time)
- func (u UpdatedAt) Sub(t time.Time) time.Duration
- func (u UpdatedAt) Time() time.Time
- func (u UpdatedAt) Unix() int64
- type UpsertCb
Constants ¶
const SHARD_COUNT = 32
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Archive ¶
type Archive struct {
Archive bool `gorm:"column:archive" json:"archive"`
}
func (*Archive) SetArchive ¶
type ConcurrentMapShared ¶
type ConcurrentMapShared[K comparable, V any] struct { // contains filtered or unexported fields }
ConcurrentMapShared represents a single shard of the ConcurrentMap. It contains a map guarded by a RWMutex for safe concurrent access.
type CreatedAt ¶
CreatedAt represents the timestamp of when an entity or object was created. It uses GORM's autoCreateTime for automatic timestamp management.
func NewCreatedAt ¶
NewCreatedAt creates a new CreatedAt with the given time
func NowCreatedAt ¶
func NowCreatedAt() CreatedAt
NowCreatedAt creates a new CreatedAt with the current time
func (CreatedAt) Format ¶
Format returns a textual representation of the time value formatted according to the layout
func (CreatedAt) IsZero ¶
IsZero reports whether the CreatedAt time represents the zero time instant
type Date ¶
func (Date) GormDBDataType ¶
GormDBDataType returns gorm DB data type based on the current using database.
func (Date) GormDataType ¶
GormDataType returns gorm common data type. This type is used for the field's column type.
func (Date) GormValue ¶
GormValue implements GormValuerInterface for dialect-aware date handling. Zero dates (year < 1000) are stored as NULL to avoid invalid date errors in strict-mode databases (PostgreSQL, MySQL 5.7+ with STRICT_TRANS_TABLES).
func (Date) MarshalJSON ¶
MarshalJSON implements json.Marshaler to convert Time to json serialization.
func (*Date) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler to deserialize json data.
type Dictionary ¶
type Dictionary[K comparable, V any] struct { // contains filtered or unexported fields }
Dictionary represents an array of KeyValue pairs with thread-safety
func (*Dictionary[K, V]) Add ¶
func (dict *Dictionary[K, V]) Add(key K, value V)
Add adds a new key-value pair to the dictionary (Thread-Safe)
func (*Dictionary[K, V]) Delete ¶
func (dict *Dictionary[K, V]) Delete(key K)
Delete removes a key-value pair by key (Thread-Safe)
func (*Dictionary[K, V]) FindByKey ¶
func (dict *Dictionary[K, V]) FindByKey(key K) (int, *KeyValue[K, V])
FindByKey finds a key and returns its index and pointer to the KeyValue (Thread-Safe)
func (*Dictionary[K, V]) FindByValue ¶
func (dict *Dictionary[K, V]) FindByValue(value V) (int, *KeyValue[K, V])
FindByValue finds a value and returns its index and pointer to the KeyValue (Thread-Safe)
func (*Dictionary[K, V]) FindByValueFunc ¶
func (dict *Dictionary[K, V]) FindByValueFunc(value V, equal func(a, b V) bool) (int, *KeyValue[K, V])
FindByValueFunc finds a value and returns its index and pointer to the KeyValue (Thread-Safe)
func (*Dictionary[K, V]) GormDBDataType ¶
GormDBDataType specifies the database data type for Dictionary
func (*Dictionary[K, V]) GormDataType ¶
func (*Dictionary[K, V]) GormDataType() string
GormDataType specifies the GORM data type for Dictionary
func (*Dictionary[K, V]) JSON ¶
func (dict *Dictionary[K, V]) JSON() ([]byte, error)
JSON serializes the dictionary into JSON format (Thread-Safe)
func (*Dictionary[K, V]) MarshalJSON ¶
func (dict *Dictionary[K, V]) MarshalJSON() ([]byte, error)
MarshalJSON serializes the dictionary to JSON (Thread-Safe)
func (*Dictionary[K, V]) Replace ¶
func (dict *Dictionary[K, V]) Replace(index int, key K, value V) bool
Replace replaces a key-value pair at a specific index (Thread-Safe)
func (*Dictionary[K, V]) Scan ¶
func (dict *Dictionary[K, V]) Scan(val any) error
Scan scans value into Dictionary, implements sql.Scanner interface
func (*Dictionary[K, V]) String ¶
func (dict *Dictionary[K, V]) String() string
String displays all key-value pairs in the dictionary (for debugging)
func (*Dictionary[K, V]) UnmarshalJSON ¶
func (dict *Dictionary[K, V]) UnmarshalJSON(b []byte) error
UnmarshalJSON deserializes JSON into the dictionary (Thread-Safe)
type Int64Array ¶
type Int64Array []int64
func (Int64Array) GormDBDataType ¶
func (Int64Array) GormDataType ¶
func (Int64Array) GormDataType() string
func (*Int64Array) Scan ¶
func (o *Int64Array) Scan(src any) error
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 any) *JSONArrayExpression
type JSONMap ¶
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 MySQL uses JSON_OVERLAPS, PostgreSQL uses JSONB @> (containment check)
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) 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
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 any) *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 { Val T }
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 KeyValue ¶
type KeyValue[K comparable, V any] struct { Key K `json:"key"` Value V `json:"value"` }
KeyValue represents a key-value pair with generic types
type Map ¶
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
Map represents a thread-safe map using sharded storage. It divides the map into multiple shards to reduce lock contention and improve performance.
func NewMapWithCustomShardingFunction ¶
func NewMapWithCustomShardingFunction[K comparable, V any](sharding func(key K) uint32) Map[K, V]
NewMapWithCustomShardingFunction creates a new Map with a user-defined sharding function.
func NewStringerMap ¶
NewStringerMap creates a new Map with custom Stringer keys and a sharding function.
func (Map[K, V]) GetShard ¶
func (m Map[K, V]) GetShard(key K) *ConcurrentMapShared[K, V]
GetShard returns the shard corresponding to the given key.
func (*Map[K, V]) GormDBDataType ¶
GormDBDataType defines how GORM should handle the type in different databases.
func (Map[K, V]) Iterate ¶
func (m Map[K, V]) Iterate() <-chan struct { Key K Value V }
Iterate returns a channel to iterate over all key-value pairs in the map.
func (Map[K, V]) MSet ¶
func (m Map[K, V]) MSet(data map[K]V)
MSet sets multiple key-value pairs in the map concurrently.
func (Map[K, V]) Range ¶
func (m Map[K, V]) Range(f func(key K, value V))
Range iterates over all key-value pairs and applies the callback function to each pair.
func (Map[K, V]) Remove ¶
func (m Map[K, V]) Remove(key K)
Remove deletes a key-value pair from the map.
func (Map[K, V]) RemoveCb ¶
RemoveCb removes a key-value pair if the callback condition returns true.
func (Map[K, V]) Set ¶
func (m Map[K, V]) Set(key K, value V)
Set inserts or updates a value in the map under the specified key.
func (Map[K, V]) SetIfAbsent ¶
SetIfAbsent sets a value in the map only if the key does not already exist.
type SoftDelete ¶
type SoftDelete struct {
Deleted bool `gorm:"column:deleted;default:0;index" json:"deleted"`
DeletedAt SoftDeletedAt `gorm:"column:deleted_at;default:null" json:"deleted_at"`
}
SoftDelete provides soft delete functionality in GORM. It includes a `Deleted` flag and a `DeletedAt` timestamp.
GORM integration: embedding SoftDelete in a model causes GORM to intercept db.Delete() calls and run UPDATE SET deleted=1, deleted_at=NOW() instead of a hard DELETE. Queries automatically filter with WHERE deleted=0. Use db.Unscoped() to bypass the filter and see or hard-delete records.
func (SoftDelete) After ¶
func (o SoftDelete) After(u time.Time) bool
After reports whether the DeletedAt time is after u (returns false if DeletedAt is not set).
func (SoftDelete) Before ¶
func (o SoftDelete) Before(u time.Time) bool
Before reports whether the DeletedAt time is before u (returns false if DeletedAt is not set).
func (*SoftDelete) Delete ¶
func (o *SoftDelete) Delete()
Delete set the Deleted status and the DeletedAt timestamp.
func (SoftDelete) Equal ¶
func (o SoftDelete) Equal(u time.Time) bool
Equal reports whether the DeletedAt time is equal to u (returns false if DeletedAt is not set).
func (SoftDelete) Format ¶
func (o SoftDelete) Format(layout string) string
Format returns a textual representation of the time value formatted according to the layout (returns empty string if DeletedAt is not set).
func (*SoftDelete) IsDeleted ¶
func (o *SoftDelete) IsDeleted() bool
IsDeleted checks if the entity has been marked as deleted. Returns true if the `Deleted` field is set to true.
func (SoftDelete) IsZero ¶
func (o SoftDelete) IsZero() bool
IsZero reports whether the DeletedAt is not set or represents the zero time instant.
func (*SoftDelete) Restore ¶
func (o *SoftDelete) Restore()
Restore resets the Deleted status and clears the DeletedAt timestamp.
func (*SoftDelete) SetDeleted ¶
func (o *SoftDelete) SetDeleted(v bool)
SetDeleted updates the `Deleted` and `DeletedAt` fields of the SoftDelete object. If `v` is true, it sets `Deleted` to true and `DeletedAt` to the current time. If `v` is false, it resets `Deleted` to false and clears `DeletedAt`.
func (SoftDelete) Time ¶
func (o SoftDelete) Time() time.Time
Time returns the underlying time.Time value, or zero time if DeletedAt is not set.
func (SoftDelete) Unix ¶
func (o SoftDelete) Unix() int64
Unix returns the Unix timestamp (returns 0 if DeletedAt is not set).
type SoftDeletedAt ¶
SoftDeletedAt is a nullable time type used as the DeletedAt field in types.SoftDelete. It implements GORM's QueryClauses, UpdateClauses, and DeleteClauses interfaces so that:
- SELECT/UPDATE queries automatically gain WHERE deleted_at IS NULL.
- db.Delete() is converted to UPDATE SET deleted_at=NOW(), deleted=1 instead of issuing a hard DELETE.
Use db.Unscoped() to bypass the filter and see or hard-delete records.
func (SoftDeletedAt) DeleteClauses ¶
func (SoftDeletedAt) DeleteClauses(f *schema.Field) []clause.Interface
DeleteClauses implements schema.DeleteClausesInterface. Converts DELETE into UPDATE SET deleted_at=NOW(), deleted=1.
func (SoftDeletedAt) GormDataType ¶
func (SoftDeletedAt) GormDataType() string
GormDataType returns the GORM column data type.
func (SoftDeletedAt) MarshalJSON ¶
func (n SoftDeletedAt) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (SoftDeletedAt) NullTime ¶
func (n SoftDeletedAt) NullTime() sql.NullTime
NullTime returns the underlying sql.NullTime.
func (SoftDeletedAt) QueryClauses ¶
func (SoftDeletedAt) QueryClauses(f *schema.Field) []clause.Interface
QueryClauses implements schema.QueryClausesInterface. GORM calls this during schema parsing and registers the returned clauses so that all SELECT statements gain WHERE deleted_at IS NULL automatically.
func (*SoftDeletedAt) Scan ¶
func (n *SoftDeletedAt) Scan(value interface{}) error
Scan implements the sql.Scanner interface.
func (SoftDeletedAt) TimeValue ¶
func (n SoftDeletedAt) TimeValue() (time.Time, bool)
TimeValue returns the time.Time value and whether it is valid (non-NULL).
func (*SoftDeletedAt) UnmarshalJSON ¶
func (n *SoftDeletedAt) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (SoftDeletedAt) UpdateClauses ¶
func (SoftDeletedAt) UpdateClauses(f *schema.Field) []clause.Interface
UpdateClauses implements schema.UpdateClausesInterface. Ensures the WHERE deleted_at IS NULL filter is also applied on UPDATE.
type StringArray ¶
type StringArray []string
func (StringArray) GormDBDataType ¶
func (StringArray) GormDataType ¶
func (StringArray) GormDataType() string
func (*StringArray) Scan ¶
func (o *StringArray) Scan(src any) error
type Stringer ¶
type Stringer interface {
fmt.Stringer
comparable
}
Stringer is an interface that combines fmt.Stringer and comparable. It ensures that the type can be used both as a string and as a map key.
type Time ¶
Time is time data type.
func (Time) GormDBDataType ¶
GormDBDataType returns gorm DB data type based on the current using database.
func (Time) GormDataType ¶
GormDataType returns gorm common data type. This type is used for the field's column type.
func (Time) MarshalJSON ¶
MarshalJSON implements json.Marshaler to convert Time to json serialization.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler to deserialize json data.
type UUID ¶
func NewUUID ¶
func NewUUID() UUID
NewUUID generates a UUID version 4, panics on generation failure.
func NewUUIDv1 ¶
func NewUUIDv1() UUID
NewUUIDv1 generates a UUID version 1, panics on generation failure.
func NewUUIDv4 ¶
func NewUUIDv4() UUID
NewUUIDv4 generates a UUID version 4, panics on generation failure.
func (UUID) GormDBDataType ¶
GormDBDataType gorm db data type.
func (*UUID) IsEmptyPtr ¶
IsEmptyPtr returns true if caller UUID ptr is nil or it's value is empty.
type UpdatedAt ¶
UpdatedAt represents the timestamp when an entity was last updated. It uses GORM's autoUpdateTime for automatic timestamp management.
func NewUpdatedAt ¶
NewUpdatedAt creates a new UpdatedAt with the given time
func NowUpdatedAt ¶
func NowUpdatedAt() UpdatedAt
NowUpdatedAt creates a new UpdatedAt with the current time
func (UpdatedAt) Format ¶
Format returns a textual representation of the time value formatted according to the layout
func (UpdatedAt) IsZero ¶
IsZero reports whether the UpdatedAt time represents the zero time instant