Documentation
¶
Index ¶
- func GetDBFieldMap(input any) map[string]string
- func ReleaseConditionsMap(cm ConditionsMap)
- func ReleaseQueryCondition(qc *QueryCondition)
- type ConditionsMap
- func (cm ConditionsMap) AddCondition(key string, condition *QueryCondition) ConditionsMap
- func (cm ConditionsMap) Clone() ConditionsMap
- func (cm ConditionsMap) Release()
- func (cm ConditionsMap) Remove(key string) (*QueryCondition, bool)
- func (cm ConditionsMap) Update(key string, operator sql_enum.QueryOperator, value ...interface{}) ConditionsMap
- func (cm ConditionsMap) UpdateRequired(key string, required bool) (ConditionsMap, bool)
- func (cm ConditionsMap) UpdateRequiredWithPanic(key string, required bool) ConditionsMap
- type PaginatedResult
- type Pagination
- type PreloadCondition
- type QueryCondition
- type QueryOptions
- type QueryTag
- type SortOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDBFieldMap ¶
func ReleaseConditionsMap ¶ added in v0.3.5
func ReleaseConditionsMap(cm ConditionsMap)
Вернуть ConditionsMap в пул
func ReleaseQueryCondition ¶ added in v0.3.5
func ReleaseQueryCondition(qc *QueryCondition)
Вернуть QueryCondition в пул
Types ¶
type ConditionsMap ¶
type ConditionsMap map[string]*QueryCondition
Основные типы остаются прежними
func AcquireConditionsMap ¶ added in v0.3.5
func AcquireConditionsMap() ConditionsMap
Получить ConditionsMap из пула
func GenerateConditionsFor ¶
func GenerateConditionsFor[T any]() (ConditionsMap, []string)
func GenerateConditionsFromEntity ¶
func GenerateConditionsFromEntity(entity interface{}) (ConditionsMap, []string)
func MergeConditions ¶ added in v0.3.3
func MergeConditions(m1, m2 ConditionsMap, keyForM1 string) ConditionsMap
Остальные методы остаются прежними но с небольшими оптимизациями
func NewConditionsMap ¶
func NewConditionsMap() ConditionsMap
func (ConditionsMap) AddCondition ¶
func (cm ConditionsMap) AddCondition(key string, condition *QueryCondition) ConditionsMap
func (ConditionsMap) Clone ¶ added in v0.3.5
func (cm ConditionsMap) Clone() ConditionsMap
Оптимизированное клонирование с использованием пулов
func (ConditionsMap) Release ¶ added in v0.3.5
func (cm ConditionsMap) Release()
Метод для освобождения всех ресурсов
func (ConditionsMap) Remove ¶
func (cm ConditionsMap) Remove(key string) (*QueryCondition, bool)
func (ConditionsMap) Update ¶
func (cm ConditionsMap) Update(key string, operator sql_enum.QueryOperator, value ...interface{}) ConditionsMap
func (ConditionsMap) UpdateRequired ¶
func (cm ConditionsMap) UpdateRequired(key string, required bool) (ConditionsMap, bool)
func (ConditionsMap) UpdateRequiredWithPanic ¶
func (cm ConditionsMap) UpdateRequiredWithPanic(key string, required bool) ConditionsMap
type PaginatedResult ¶
type Pagination ¶
func NewPagination ¶
func NewPagination(page, size int) *Pagination
type PreloadCondition ¶
type QueryCondition ¶
type QueryCondition struct {
Field string
Operator sql_enum.QueryOperator
Value interface{}
Required bool
Transformer utils.ValueTransformer
UniqueIdentifier bool
}
func AcquireQueryCondition ¶ added in v0.3.5
func AcquireQueryCondition() *QueryCondition
Получить QueryCondition из пула
func (*QueryCondition) Clone ¶ added in v0.3.5
func (q *QueryCondition) Clone() *QueryCondition
Копирование QueryCondition из пула
func (*QueryCondition) SetValue ¶
func (q *QueryCondition) SetValue(stringValues ...string) error
type QueryOptions ¶
type QueryOptions struct {
Conditions ConditionsMap
Preloads []string
Sort *SortOption
Pagination *Pagination // Используем указатель для optional параметра
}
func DefaultQueryOptions ¶
func DefaultQueryOptions() *QueryOptions
func (*QueryOptions) ApplyDefaults ¶
func (opts *QueryOptions) ApplyDefaults() *QueryOptions
func (*QueryOptions) SetSort ¶
func (o *QueryOptions) SetSort(field string, direction string) *QueryOptions
type SortOption ¶
func NewSortOption ¶
func NewSortOption(field, direction string) *SortOption
func NewSortOptionWithDefaults ¶
func NewSortOptionWithDefaults() *SortOption
func ParseSortString ¶
func ParseSortString(sortStr string, validFields []string) *SortOption
ParseSortString парсит строку сортировки и валидирует поля
Click to show internal directories.
Click to hide internal directories.