domain

package
v0.0.0-...-e041085 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JSONTagRegex = regexp.MustCompile("json:\"(.*?)\"")

JSONTagRegex const regex for json tag in db struct

View Source
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

func GetMetadataMap(i interface{}) map[string]Metadata

GetMetadataMap get metadata map from table struct

func GetRecordTimestampSQLField

func GetRecordTimestampSQLField(jsonField string) string

GetRecordTimestampSQLField ...

func GetSQLFieldsFromMap

func GetSQLFieldsFromMap(i interface{}, m map[string]interface{}) []string

GetSQLFieldsFromMap ...

func InvalidateNullBool

func InvalidateNullBool() sql.NullBool

InvalidateNullBool ...

func RemoveField

func RemoveField(fields []string, fieldName string) []string

RemoveField ...

func ValidateIsNullInt64

func ValidateIsNullInt64(input int) sql.NullInt64

ValidateIsNullInt64 ...

func ValidateIsNullString

func ValidateIsNullString(input string) sql.NullString

ValidateIsNullString ...

func ValidateNullBool

func ValidateNullBool(input bool) sql.NullBool

ValidateNullBool ...

func ValidateNullBoolFromPointer

func ValidateNullBoolFromPointer(input *bool) sql.NullBool

ValidateNullBoolFromPointer ...

func WithPaging

func WithPaging(query *orm.Query, paging *Paging) (*orm.Query, error)

WithPaging ...

func WithSorter

func WithSorter(query *orm.Query, sorter string) *orm.Query

WithSorter ...

func WithTableListParams

func WithTableListParams(query *orm.Query, tableListParams *TableListParams) (*orm.Query, error)

WithTableListParams ...

Types

type Metadata

type Metadata struct {
	SQLTag string
}

Metadata Struct

type Paging

type Paging struct {
	Total       int `json:"total"`
	PageSize    int `json:"pageSize"`
	CurrentPage int `json:"currentPage"`
}

Paging represents sorter, paging

func (*Paging) GetCurrentPage

func (s *Paging) GetCurrentPage() int

GetCurrentPage ...

func (*Paging) GetOffset

func (s *Paging) GetOffset() int

GetOffset ...

func (*Paging) GetPageSize

func (s *Paging) GetPageSize() int

GetPageSize ...

func (*Paging) Norm

func (s *Paging) Norm()

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

func (r *RecordTimestamp) BeforeInsert(ctx context.Context) (context.Context, error)

BeforeInsert ...

func (*RecordTimestamp) BeforeUpdate

func (r *RecordTimestamp) BeforeUpdate(ctx context.Context) (context.Context, error)

BeforeUpdate ...

type TableInterface

type TableInterface interface {
	// contains filtered or unexported methods
}

TableInterface ...

type TableListParams

type TableListParams struct {
	Sorter string `json:"sorter"`
	Paging
}

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 ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL