Documentation
¶
Index ¶
Constants ¶
View Source
const ( COLUMN_ID = "id" COLUMN_SETTING_KEY = "setting_key" COLUMN_SETTING_VALUE = "setting_value" COLUMN_CREATED_AT = "created_at" COLUMN_UPDATED_AT = "updated_at" COLUMN_SOFT_DELETED_AT = "soft_deleted_at" )
View Source
const MAX_DATETIME = "9999-12-31 23:59:59"
MAX_DATETIME is a far-future datetime used as the default soft-delete sentinel.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NewStoreOptions ¶
type NewStoreOptions struct {
SettingTableName string
DB *sql.DB
AutomigrateEnabled bool
DebugEnabled bool
}
NewStoreOptions define the options for creating a new setting store
type SettingInterface ¶
type SettingInterface interface {
IsSoftDeleted() bool
GetCreatedAt() string
GetCreatedAtCarbon() *carbon.Carbon
SetCreatedAt(createdAt string) SettingInterface
GetID() string
SetID(id string) SettingInterface
GetKey() string
SetKey(key string) SettingInterface
GetSoftDeletedAt() string
GetSoftDeletedAtCarbon() *carbon.Carbon
SetSoftDeletedAt(deletedAt string) SettingInterface
GetUpdatedAt() string
GetUpdatedAtCarbon() *carbon.Carbon
SetUpdatedAt(updatedAt string) SettingInterface
GetValue() string
SetValue(value string) SettingInterface
}
SettingInterface defines the interface for a setting record.
func NewSetting ¶
func NewSetting() SettingInterface
func NewSettingFromExistingData ¶
func NewSettingFromExistingData(data map[string]string) SettingInterface
type SettingQueryInterface ¶
type SettingQueryInterface interface {
Validate() error
IsCountOnly() bool
Columns() []string
SetColumns(columns []string) SettingQueryInterface
HasCreatedAtGte() bool
CreatedAtGte() string
SetCreatedAtGte(createdAtGte string) SettingQueryInterface
HasCreatedAtLte() bool
CreatedAtLte() string
SetCreatedAtLte(createdAtLte string) SettingQueryInterface
HasID() bool
ID() string
SetID(id string) SettingQueryInterface
HasIDIn() bool
IDIn() []string
SetIDIn(idIn []string) SettingQueryInterface
HasKey() bool
Key() string
SetKey(key string) SettingQueryInterface
HasOffset() bool
Offset() int
SetOffset(offset int) SettingQueryInterface
HasLimit() bool
Limit() int
SetLimit(limit int) SettingQueryInterface
HasSortOrder() bool
SortOrder() string
SetSortOrder(sortOrder string) SettingQueryInterface
HasOrderBy() bool
OrderBy() string
SetOrderBy(orderBy string) SettingQueryInterface
HasCountOnly() bool
SetCountOnly(countOnly bool) SettingQueryInterface
HasSoftDeletedIncluded() bool
SoftDeletedIncluded() bool
SetSoftDeletedIncluded(withSoftDeleted bool) SettingQueryInterface
}
SettingQueryInterface defines the interface for querying settings.
func NewSettingQuery ¶
func NewSettingQuery() SettingQueryInterface
NewSettingQuery creates a new setting query
func SettingQuery ¶
func SettingQuery() SettingQueryInterface
SettingQuery is a shortcut version of NewSettingQuery to create a new query
type StoreInterface ¶
type StoreInterface interface {
MigrateDown(ctx context.Context, tx ...*sql.Tx) error
MigrateUp(ctx context.Context, tx ...*sql.Tx) error
EnableDebug(debug bool)
SettingCount(ctx context.Context, query SettingQueryInterface) (int64, error)
SettingCreate(ctx context.Context, setting SettingInterface) error
SettingDelete(ctx context.Context, setting SettingInterface) error
SettingDeleteByID(ctx context.Context, settingID string) error
SettingFindByID(ctx context.Context, settingID string) (SettingInterface, error)
SettingFindByKey(ctx context.Context, settingKey string) (SettingInterface, error)
SettingList(ctx context.Context, query SettingQueryInterface) ([]SettingInterface, error)
SettingSoftDelete(ctx context.Context, setting SettingInterface) error
SettingSoftDeleteByID(ctx context.Context, settingID string) error
SettingUpdate(ctx context.Context, setting SettingInterface) error
Delete(ctx context.Context, settingKey string) error
Get(ctx context.Context, settingKey string, valueDefault string) (string, error)
GetAny(ctx context.Context, key string, valueDefault any) (any, error)
GetMap(ctx context.Context, key string, valueDefault map[string]any) (map[string]any, error)
Has(ctx context.Context, settingKey string) (bool, error)
MergeMap(ctx context.Context, key string, mergeMap map[string]any) error
Set(ctx context.Context, settingKey string, value string) error
SetAny(ctx context.Context, key string, value interface{}, seconds int64) error
SetMap(ctx context.Context, key string, value map[string]any) error
SettingDeleteByKey(ctx context.Context, settingKey string) error
}
StoreInterface defines the interface for a setting store.
func NewStore ¶
func NewStore(opts NewStoreOptions) (StoreInterface, error)
NewStore creates a new setting store
Click to show internal directories.
Click to hide internal directories.