gPlus

package
v0.1.58 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

gPlus gorm封装

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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[M]) Count added in v0.1.16

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

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

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

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

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

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

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

func (q *Querier[T]) Update(params FieldMap) 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]

	Update(params FieldMap) error

	Delete(params FieldMap) error

	Del(params FieldMap) error
}

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