gPlus

package
v0.1.76 Latest Latest
Warning

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

Go to latest
Published: May 15, 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]) In added in v0.1.17

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

func (*Querier[T]) ItemByField

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

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]) 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]) 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]) 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)

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

	Count(params FieldMap) (int64, error)

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

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

	Where(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 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