Documentation
¶
Index ¶
Constants ¶
View Source
const COLUMN_CREATED_AT = "created_at"
View Source
const COLUMN_ID = "id"
View Source
const COLUMN_METAS = "metas"
View Source
const COLUMN_SEARCH_VALUE = "search_value"
View Source
const COLUMN_SOFT_DELETED_AT = "soft_deleted_at"
View Source
const COLUMN_SOURCE_REFERENCE_ID = "source_reference_id"
View Source
const COLUMN_UPDATED_AT = "updated_at"
View Source
const SEARCH_TYPE_CONTAINS = "contains"
View Source
const SEARCH_TYPE_ENDS_WITH = "ends_with"
View Source
const SEARCH_TYPE_EQUALS = "equals"
View Source
const SEARCH_TYPE_STARTS_WITH = "starts_with"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NewStoreOptions ¶
type NewStoreOptions struct {
TableName string
DB *sql.DB
DbDriverName string
AutomigrateEnabled bool
DebugEnabled bool
Transformer TransformerInterface
}
NewStoreOptions define the options for creating a new session store
type NoChangeTransformer ¶
type NoChangeTransformer struct{}
Example transformer not doing anything (do not use in production)
func (*NoChangeTransformer) Transform ¶
func (t *NoChangeTransformer) Transform(v string) string
type Rot13Transformer ¶
type Rot13Transformer struct{}
Example transformer using ROT13 (do not use in production)
func (*Rot13Transformer) Transform ¶
func (t *Rot13Transformer) Transform(v string) string
type SearchValueInterface ¶ added in v1.6.0
type SearchValueInterface interface {
Data() map[string]string
DataChanged() map[string]string
MarkAsNotDirty()
CreatedAt() string
SetCreatedAt(createdAt string) SearchValueInterface
CreatedAtCarbon() *carbon.Carbon
SearchValue() string
SetSearchValue(value string) SearchValueInterface
SourceReferenceID() string
SetSourceReferenceID(sourceReferenceID string) SearchValueInterface
ID() string
SetID(id string) SearchValueInterface
Metas() (map[string]string, error)
SetMetas(data map[string]string) (SearchValueInterface, error)
HasMeta(key string) (bool, error)
Meta(key string) (string, error)
SetMeta(key string, value string) (SearchValueInterface, error)
DeleteMeta(key string) (SearchValueInterface, error)
SoftDeletedAt() string
SetSoftDeletedAt(softDeletedAt string) SearchValueInterface
SoftDeletedAtCarbon() *carbon.Carbon
UpdatedAt() string
SetUpdatedAt(updatedAt string) SearchValueInterface
UpdatedAtCarbon() *carbon.Carbon
}
SearchValueInterface defines the methods for a SearchValue entity This interface can be implemented by any SearchValue struct for flexibility and testability.
func NewSearchValue ¶
func NewSearchValue() SearchValueInterface
func NewSearchValueFromExistingData ¶
func NewSearchValueFromExistingData(data map[string]string) SearchValueInterface
type SearchValueQueryInterface ¶ added in v1.6.0
type SearchValueQueryInterface interface {
ToSelectDataset(store StoreInterface) (*goqu.SelectDataset, []any, error)
Validate() error
ID() string
HasID() bool
SetID(id string) SearchValueQueryInterface
IDIn() []string
HasIDIn() bool
SetIDIn(idIn []string) SearchValueQueryInterface
SourceReferenceID() string
HasSourceReferenceID() bool
SetSourceReferenceID(sourceReferenceID string) SearchValueQueryInterface
SearchValue() string
HasSearchValue() bool
SetSearchValue(searchValue string) SearchValueQueryInterface
SearchType() string
HasSearchType() bool
SetSearchType(searchType string) SearchValueQueryInterface
Offset() int
HasOffset() bool
SetOffset(offset int) SearchValueQueryInterface
Limit() int
HasLimit() bool
SetLimit(limit int) SearchValueQueryInterface
OrderBy() string
HasOrderBy() bool
SetOrderBy(orderBy string) SearchValueQueryInterface
OrderDirection() string
HasOrderDirection() bool
SetOrderDirection(orderByDirection string) SearchValueQueryInterface
CountOnly() bool
HasCountOnly() bool
SetCountOnly(countOnly bool) SearchValueQueryInterface
WithSoftDeleted() bool
HasWithSoftDeleted() bool
SetWithSoftDeleted(withSoftDeleted bool) SearchValueQueryInterface
Columns() []any
HasColumns() bool
SetColumns(columns []any) SearchValueQueryInterface
}
func NewSearchValueQuery ¶ added in v1.6.0
func NewSearchValueQuery() SearchValueQueryInterface
func SearchValueQuery ¶ added in v1.6.0
func SearchValueQuery() SearchValueQueryInterface
type Sha256Transformer ¶
type Sha256Transformer struct{}
Example transformer using SHA256
func (*Sha256Transformer) Transform ¶
func (t *Sha256Transformer) Transform(v string) string
type StoreInterface ¶
type StoreInterface interface {
AutoMigrate() error
Search(ctx context.Context, needle, searchType string) (refIDs []string, err error)
SearchValueCreate(ctx context.Context, value SearchValueInterface) error
SearchValueDelete(ctx context.Context, value SearchValueInterface) error
SearchValueDeleteByID(ctx context.Context, valueID string) error
SearchValueFindByID(ctx context.Context, id string) (SearchValueInterface, error)
SearchValueFindBySourceReferenceID(ctx context.Context, sourceReferenceID string) (SearchValueInterface, error)
SearchValueList(ctx context.Context, query SearchValueQueryInterface) ([]SearchValueInterface, error)
SearchValueSoftDelete(ctx context.Context, discount SearchValueInterface) error
SearchValueSoftDeleteByID(ctx context.Context, discountID string) error
SearchValueUpdate(ctx context.Context, value SearchValueInterface) error
Truncate(ctx context.Context) error
// IsAutomigrateEnabled returns whether automigrate is enabled
IsAutomigrateEnabled() bool
}
func NewStore ¶
func NewStore(opts NewStoreOptions) (StoreInterface, error)
NewStore creates a new entity store
type TransformerInterface ¶
type UniTransformer ¶
type UniTransformer struct{}
Example custom transformer (do not use in production)
func (*UniTransformer) Transform ¶
func (t *UniTransformer) Transform(v string) string
Click to show internal directories.
Click to hide internal directories.