gp

package
v0.1.92 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Column

func Column(name string) column

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

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

func (*Querier[M]) Count

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

func (*Querier[T]) Debug

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

func (*Querier[T]) Del

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

func (*Querier[T]) Delete

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

func (*Querier[T]) In

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

func (*Querier[T]) Item

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

func (*Querier[T]) Limit

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

func (*Querier[T]) List

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

func (*Querier[T]) OffSet

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

func (*Querier[T]) OrderBy

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

func (*Querier[T]) Paging

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

func (*Querier[T]) SQL

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

func (*Querier[T]) Save

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

func (*Querier[T]) Select

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

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

func (*Querier[T]) Update

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

func (*Querier[T]) Where

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

	Item() (*T, error)
	List() (T, error)
	Count() (int64, error)
	Paging(page, limit int, params FieldMap) ([]T, int, error)

	Where(params FieldMap) *Querier[T]
	In(params FieldMap) *Querier[T]
	Between(c column, start, end any) *Querier[T]
	Update(params FieldMap) error
	Delete(params FieldMap) error
	Del(params FieldMap) error

	SQL() string

	Debug() *Querier[T]
}

type T

type T interface {
	any
}

Jump to

Keyboard shortcuts

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