Documentation
¶
Index ¶
- func ErrorIsNoRows(err error) bool
- func StableSearch[T any](ctx context.Context, workMan workerpool.Manager, query *SearchQuery, ...) (workerpool.JobResultPipe[[]T], error)
- type BaseModel
- func (model *BaseModel) BeforeCreate(db *gorm.DB) error
- func (model *BaseModel) BeforeSave(db *gorm.DB) error
- func (model *BaseModel) BeforeUpdate(_ *gorm.DB) error
- func (model *BaseModel) CopyPartitionInfo(parent *BaseModel)
- func (model *BaseModel) GenID(ctx context.Context)
- func (model *BaseModel) GetID() string
- func (model *BaseModel) GetVersion() uint
- func (model *BaseModel) ValidXID(id string) bool
- type BaseModelI
- type Paginator
- type SearchQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorIsNoRows ¶
ErrorIsNoRows validate if supplied error is because of record missing in DB.
func StableSearch ¶
func StableSearch[T any]( ctx context.Context, workMan workerpool.Manager, query *SearchQuery, searchFunc func(ctx context.Context, query *SearchQuery) ([]T, error), ) (workerpool.JobResultPipe[[]T], error)
Types ¶
type BaseModel ¶
type BaseModel struct {
ID string `gorm:"type:varchar(50);primary_key"`
CreatedAt time.Time
ModifiedAt time.Time
Version uint `gorm:"DEFAULT 0"`
TenantID string `gorm:"type:varchar(50);index:,composite:base_tenancy"`
PartitionID string `gorm:"type:varchar(50);index:,composite:base_tenancy"`
AccessID string `gorm:"type:varchar(50);index:,composite:base_tenancy"`
DeletedAt gorm.DeletedAt `sql:"index"`
}
BaseModel base table struct to be extended by other models.
func (*BaseModel) BeforeSave ¶
BeforeSave Ensures we update a migrations time stamps.
func (*BaseModel) BeforeUpdate ¶
BeforeUpdate Updates time stamp every time we update status of a migration.
func (*BaseModel) CopyPartitionInfo ¶
func (*BaseModel) GetVersion ¶
type BaseModelI ¶
type Paginator ¶
func (*Paginator) SetBatchSize ¶
type SearchQuery ¶
type SearchQuery struct {
ProfileID string
Query string
QueryFields map[string]string // We query with the value of query but use value as operator: {'id': ' = ?', 'name': ' LIKE ?', 'props': ' @@ plainto_tsquery(?)'}
Fields map[string]any
Pagination *Paginator
}
func NewSearchQuery ¶
func NewSearchQuery(query string, fields map[string]any, resultPage, resultCount int, ) *SearchQuery
Click to show internal directories.
Click to hide internal directories.