model

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model[t any] struct {
	Db *gorm.DB
}

func (*Model[t]) Count

func (m *Model[t]) Count() (total int64, err error)

func (*Model[t]) Create added in v0.2.1

func (m *Model[t]) Create(data any) (int64, error)

func (*Model[t]) DB

func (m *Model[t]) DB() *gorm.DB

func (*Model[t]) Dec added in v0.3.22

func (m *Model[t]) Dec(column string, values ...int) (int64, error)

func (*Model[t]) Delete

func (m *Model[t]) Delete() (int64, error)

func (*Model[t]) Distinct

func (m *Model[t]) Distinct(args ...any) *Model[t]

func (*Model[t]) Exists added in v0.1.24

func (m *Model[t]) Exists() (bool, error)

func (*Model[t]) Find

func (m *Model[t]) Find() ([]t, error)

func (*Model[t]) First

func (m *Model[t]) First() (*t, error)

func (*Model[t]) Inc added in v0.3.22

func (m *Model[t]) Inc(column string, values ...int) (int64, error)

func (*Model[t]) Limit

func (m *Model[t]) Limit(offset int) *Model[t]

func (*Model[t]) Offset

func (m *Model[t]) Offset(offset int) *Model[t]

func (*Model[t]) Omit

func (m *Model[t]) Omit(columns ...string) *Model[t]

func (*Model[t]) Order

func (m *Model[t]) Order(order string) *Model[t]

func (*Model[t]) Paginate

func (m *Model[t]) Paginate(page int, limit int) *PaginateData[t]

func (*Model[t]) Pluck

func (m *Model[t]) Pluck(column string, dest any) error

func (*Model[t]) Select

func (m *Model[t]) Select(fields []string) *Model[t]

func (*Model[t]) SetDB

func (m *Model[t]) SetDB(db *gorm.DB) *Model[t]

func (*Model[t]) Unscoped

func (m *Model[t]) Unscoped() *Model[t]

func (*Model[t]) Update

func (m *Model[t]) Update(column string, value any) (int64, error)

func (*Model[t]) Updates

func (m *Model[t]) Updates(values any) (int64, error)

func (*Model[t]) Where

func (m *Model[t]) Where(where any, args ...any) *Model[t]

type PaginateData

type PaginateData[t any] struct {
	Page     int `json:"page"`
	LastPage int `json:"last_page"`
	Limit    int `json:"limit"`
	Total    int `json:"total"`
	Lists    []t `json:"lists"`
}

Jump to

Keyboard shortcuts

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