Documentation
¶
Index ¶
- Variables
- func EnrichQueryWithTableListParams(query *orm.Query, tableParams *TableListParams, i TableInterface) (_ *orm.Query, isOrdered bool, _ error)
- func GetMetadataMap(i interface{}) map[string]Metadata
- func GetRecordTimestampSQLField(jsonField string) string
- func GetSQLFieldsFromMap(i interface{}, m map[string]interface{}) []string
- func InvalidateNullBool() sql.NullBool
- func RemoveField(fields []string, fieldName string) []string
- func ValidateIsNullInt64(input int) sql.NullInt64
- func ValidateIsNullString(input string) sql.NullString
- func ValidateNullBool(input bool) sql.NullBool
- func ValidateNullBoolFromPointer(input *bool) sql.NullBool
- func WithPaging(query *orm.Query, paging *Paging) (*orm.Query, error)
- func WithSorter(query *orm.Query, sorter string) *orm.Query
- func WithTableListParams(query *orm.Query, tableListParams *TableListParams) (*orm.Query, error)
- type Metadata
- type Paging
- type RecordTimestamp
- type TableInterface
- type TableListParams
Constants ¶
This section is empty.
Variables ¶
var JSONTagRegex = regexp.MustCompile("json:\"(.*?)\"")
JSONTagRegex const regex for json tag in db struct
var SQLTagRegex = regexp.MustCompile("sql:\"([a-z].*?)\"")
SQLTagRegex const regex for sql tag in db struct
Functions ¶
func EnrichQueryWithTableListParams ¶
func EnrichQueryWithTableListParams(query *orm.Query, tableParams *TableListParams, i TableInterface) (_ *orm.Query, isOrdered bool, _ error)
EnrichQueryWithTableListParams ...
func GetMetadataMap ¶
GetMetadataMap get metadata map from table struct
func GetRecordTimestampSQLField ¶
GetRecordTimestampSQLField ...
func GetSQLFieldsFromMap ¶
GetSQLFieldsFromMap ...
func ValidateIsNullInt64 ¶
ValidateIsNullInt64 ...
func ValidateIsNullString ¶
func ValidateIsNullString(input string) sql.NullString
ValidateIsNullString ...
func ValidateNullBoolFromPointer ¶
ValidateNullBoolFromPointer ...
func WithPaging ¶
WithPaging ...
func WithTableListParams ¶
WithTableListParams ...
Types ¶
type Paging ¶
type Paging struct {
Total int `json:"total"`
PageSize int `json:"pageSize"`
CurrentPage int `json:"currentPage"`
}
Paging represents sorter, paging
type RecordTimestamp ¶
type RecordTimestamp struct {
CreatedAt time.Time `json:"createdAt"`
LastModifiedAt time.Time `json:"lastModifiedAt"`
LastModifiedBy int `json:"lastModifiedBy"`
DeletedAt time.Time `pg:",soft_delete" json:"deletedAt"`
}
RecordTimestamp ...
func (*RecordTimestamp) BeforeInsert ¶
BeforeInsert ...
func (*RecordTimestamp) BeforeUpdate ¶
BeforeUpdate ...
type TableInterface ¶
type TableInterface interface {
// contains filtered or unexported methods
}
TableInterface ...
type TableListParams ¶
TableListParams represents sorter, paging
func (TableListParams) CreateCopy ¶
func (t TableListParams) CreateCopy() TableListParams
func (*TableListParams) GetSortFieldAndType ¶
func (tableParams *TableListParams) GetSortFieldAndType() (sortField string, sortType string, ok bool)
GetSortFieldAndType ...