sql

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SqlNullString

func SqlNullString(value string) sql.NullString

Types

type Builder

type Builder struct {
	SelectColumns []string
	WhereParams   []WhereParams
	OrderParams   []OrderParams
	Pages         *Pages
	Db            *gorm.DB
}

func NewBuilder added in v1.0.3

func NewBuilder(selectColumns ...string) *Builder

func (*Builder) Asc

func (b *Builder) Asc(column string) *Builder

func (*Builder) Build

func (b *Builder) Build(count bool) *gorm.DB

func (*Builder) DB

func (b *Builder) DB(db *gorm.DB) *Builder

func (*Builder) Desc

func (b *Builder) Desc(column string) *Builder

func (*Builder) Limit

func (b *Builder) Limit(limit int) *Builder

func (*Builder) Page

func (b *Builder) Page(page, perPage int) *Builder

func (*Builder) Where

func (b *Builder) Where(query string, args ...interface{}) *Builder

where(" = ?", args) where(" <> ?", args) where(" > ?", args) where(" >= ?", args) where(" < ?", args) where(" <= ?", args) where(" in (?)", args) where(" LIKE ?", args)

type OrderParams

type OrderParams struct {
	Column string
	Asc    bool
}

type PageResult

type PageResult struct {
	Page   *Pages      `json:"page"`
	Result interface{} `json:"result"`
}

type Pages

type Pages struct {
	Page    int `json:"page"`
	PerPage int `json:"per_page"`
	Total   int `json:"total"`
}

func (*Pages) Offset

func (p *Pages) Offset() (offset int)

func (*Pages) TotalPage

func (p *Pages) TotalPage() (totalPage int)

type WhereParams

type WhereParams struct {
	Query interface{}
	Args  []interface{}
}

Jump to

Keyboard shortcuts

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