dbquery

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: MIT Imports: 4 Imported by: 0

README

dbquery

Documentation

Index

Constants

View Source
const (
	OrderAsc  = Order("ASC")
	OrderDesc = Order("DESC")
)
View Source
const (
	Equal          = Operator(" = ?")
	Greater        = Operator(" >= ?")
	GreaterOrEqual = Operator(" > ?")
	LessOrEqual    = Operator(" <= ?")
	Less           = Operator(" < ?")
	NotEqual       = Operator(" != ?")
)

Variables

View Source
var (
	ErrCastingError = errors.New("cannot cast")
)

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder() *Builder

func (*Builder) Build

func (b *Builder) Build() Query

func (*Builder) Count

func (b *Builder) Count(countingResult *int64) *Builder

func (*Builder) Equal

func (b *Builder) Equal(fieldName string, value interface{}) *Builder

func (*Builder) Find

func (b *Builder) Find(findingResult interface{}) *Builder

func (*Builder) First

func (b *Builder) First(firstResult interface{}) *Builder

func (*Builder) Greater

func (b *Builder) Greater(fieldName string, value interface{}) *Builder

func (*Builder) GreaterOrEqual

func (b *Builder) GreaterOrEqual(fieldName string, value interface{}) *Builder

func (*Builder) InList

func (b *Builder) InList(fieldName string, list []interface{}) *Builder

func (*Builder) Less

func (b *Builder) Less(fieldName string, value interface{}) *Builder

func (*Builder) LessOrEqual

func (b *Builder) LessOrEqual(fieldName string, value interface{}) *Builder

func (*Builder) Limit

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

func (*Builder) Model

func (b *Builder) Model(model interface{}) *Builder

func (*Builder) Not

func (b *Builder) Not(fieldName string, value interface{}) *Builder

func (*Builder) NotEqual

func (b *Builder) NotEqual(fieldName string, value interface{}) *Builder

func (*Builder) Offset

func (b *Builder) Offset(offset int) *Builder

func (*Builder) Preload

func (b *Builder) Preload(column string, condition ...interface{}) *Builder

func (*Builder) Sort

func (b *Builder) Sort(fieldName string, order Order) *Builder

func (*Builder) TableName

func (b *Builder) TableName(tableName string) *Builder

type ComparingObject

type ComparingObject struct {
	QueryKeyValue
	// contains filtered or unexported fields
}

type Executor

type Executor interface {
	Execute(q Query) (*gorm.DB, error)
}

func WithGorm

func WithGorm(db *gorm.DB) Executor

type Operator

type Operator string

type Order

type Order string

type Query

type Query struct {
	// contains filtered or unexported fields
}

func (Query) Builder

func (q Query) Builder() *Builder

type QueryKeyValue

type QueryKeyValue struct {
	// contains filtered or unexported fields
}

type Values

type Values struct {
	Operator Operator
	Value    interface{}
}

func New

func New(value interface{}) *Values

func NewWithOperator

func NewWithOperator(operator Operator, value interface{}) *Values

Jump to

Keyboard shortcuts

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