Documentation ¶
Index ¶
- func Connect(dbMode string) (*gorm.DB, error)
- func Instance(c *gin.Context) *gorm.DB
- func IsIpv4AddressIncluding(baseCIDR, targetCIDR string) bool
- func SetupCustomDBFunctions()
- type Parameter
- func (parameter *Parameter) DefaultQuery(query url.Values, key string, defaultValue string) string
- func (parameter *Parameter) FilterFields(db *gorm.DB) *gorm.DB
- func (parameter *Parameter) GetRawFilterQuery() string
- func (parameter *Parameter) Paginate(db *gorm.DB) (*gorm.DB, error)
- func (parameter *Parameter) SetHeaderLink(c *gin.Context, index int) error
- func (parameter *Parameter) SetPreloads(db *gorm.DB) *gorm.DB
- func (parameter *Parameter) SortRecords(db *gorm.DB) *gorm.DB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsIpv4AddressIncluding ¶
IsIpv4AddressIncluding checks if left includes right network address, used in sqlite3
func SetupCustomDBFunctions ¶
func SetupCustomDBFunctions()
SetupCustomDBFunctions setups custom sql functions
Types ¶
type Parameter ¶
type Parameter struct { Filters map[string]string Preloads string PreloadsFilterMap map[string]map[string]string Sort string Limit int Page int LastID int Order string IsLastID bool IsPaginationEnabled bool }
Parameter is the struct what contains parameters related to db
func NewParameter ¶
NewParameter creates a new Parameter instance
func (*Parameter) DefaultQuery ¶
DefaultQuery get a query parameter. If key does not exist, it returns defaultValue
func (*Parameter) FilterFields ¶
FilterFields filters fields
func (*Parameter) GetRawFilterQuery ¶
GetRawFilterQuery generates a filter query string
func (*Parameter) SetHeaderLink ¶
SetHeaderLink sets the header links to HTTP header
func (*Parameter) SetPreloads ¶
SetPreloads configures the preload settings of the connected db
Click to show internal directories.
Click to hide internal directories.