gPlus

package
v0.1.101 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

gPlus gorm封装

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Column added in v0.1.64

func Column(name string) column

func Initialization added in v0.1.75

func Initialization(c mysql.Configure2) error

func Initialize

func Initialize(c mysql.Configure) error

Types

type FieldMap

type FieldMap map[string]any

type Option

type Option[M T] func(*Querier[M])

type Querier

type Querier[M T] struct {
	// contains filtered or unexported fields
}

func New

func New[M T](opts ...Option[M]) *Querier[M]

func (*Querier[T]) Between added in v0.1.68

func (q *Querier[T]) Between(c column, start, end any) *Querier[T]

func (*Querier[M]) Count added in v0.1.16

func (q *Querier[M]) Count(params FieldMap) (int64, error)

func (*Querier[T]) Debug added in v0.1.65

func (q *Querier[T]) Debug() *Querier[T]

func (*Querier[T]) Del added in v0.1.38

func (q *Querier[T]) Del(params FieldMap) error

func (*Querier[T]) Delete added in v0.1.36

func (q *Querier[T]) Delete(params FieldMap) error

func (*Querier[T]) GroupBy added in v0.1.78

func (q *Querier[T]) GroupBy(col string) *Querier[T]

func (*Querier[T]) Having added in v0.1.92

func (q *Querier[T]) Having(params FieldMap) *Querier[T]

func (*Querier[T]) In added in v0.1.17

func (q *Querier[T]) In(params FieldMap) ([]T, error)

func (*Querier[T]) In2 added in v0.1.84

func (q *Querier[T]) In2(c column, data any) *Querier[T]

func (*Querier[T]) Item added in v0.1.89

func (q *Querier[T]) Item() (*T, error)

func (*Querier[T]) ItemByField

func (q *Querier[T]) ItemByField(params FieldMap) (*T, error)

func (*Querier[T]) Join added in v0.1.77

func (q *Querier[T]) Join(joins string, args ...any) *Querier[T]

func (*Querier[T]) Limit added in v0.1.55

func (q *Querier[T]) Limit(limit int) *Querier[T]

func (*Querier[T]) List added in v0.1.14

func (q *Querier[T]) List(params FieldMap) ([]T, error)

func (*Querier[T]) ListByField added in v0.1.15

func (q *Querier[T]) ListByField(params FieldMap) (T, error)

func (*Querier[T]) Lists added in v0.1.89

func (q *Querier[T]) Lists() ([]T, error)

func (*Querier[T]) OR added in v0.1.87

func (q *Querier[T]) OR(params FieldMap) *Querier[T]

func (*Querier[T]) OffSet added in v0.1.55

func (q *Querier[T]) OffSet(offSet int) *Querier[T]

func (*Querier[T]) OrderBy added in v0.1.55

func (q *Querier[T]) OrderBy(orderBy string) *Querier[T]

func (*Querier[T]) Paging added in v0.1.27

func (q *Querier[T]) Paging(page, limit int, params FieldMap) ([]T, int, error)

func (*Querier[T]) Raw added in v0.1.91

func (q *Querier[T]) Raw(sql string, values ...interface{}) *Querier[T]

func (*Querier[T]) SQL added in v0.1.64

func (q *Querier[T]) SQL() string

func (*Querier[T]) Save

func (q *Querier[T]) Save(m *T) error

func (*Querier[T]) Select added in v0.1.55

func (q *Querier[T]) Select(columns ...expr) *Querier[T]

==========================================================================

func (*Querier[T]) Table added in v0.1.86

func (q *Querier[T]) Table(table string) *Querier[T]

func (*Querier[T]) Update added in v0.1.35

func (q *Querier[T]) Update(params FieldMap) error

func (*Querier[T]) Updates added in v0.1.76

func (q *Querier[T]) Updates(p T) error

func (*Querier[T]) Where added in v0.1.35

func (q *Querier[T]) Where(params FieldMap) *Querier[T]

func (*Querier[T]) WithTxOption

func (q *Querier[T]) WithTxOption(tx *gorm.DB) *Querier[T]

type Query

type Query[T any] interface {
	Save(m *T) error // 保存model或[]model

	ItemByField(params FieldMap) (*T, error)

	Item() (*T, error) // 获取单个

	Lists() ([]T, error) // 获取多个

	List(params FieldMap) ([]T, error)

	Count(params FieldMap) (int64, error)

	In(params FieldMap) ([]T, error)

	Paging(page, limit int, params FieldMap) ([]T, int, error)

	Table(table string) *Querier[T]

	Where(params FieldMap) *Querier[T]

	Having(params FieldMap) *Querier[T]

	OR(params FieldMap) *Querier[T]

	Between(c column, start, end any) *Querier[T]

	Raw(sql string, values ...interface{}) *Querier[T]

	SQL() string

	Update(params FieldMap) error

	Delete(params FieldMap) error

	Del(params FieldMap) error

	In2(c column, data any) *Querier[T]

	Debug() *Querier[T]
}

type T added in v0.1.14

type T interface {
	any
}

Jump to

Keyboard shortcuts

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