gPlus

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: MIT Imports: 4 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]) 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]) 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]) Save

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

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

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