model

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: Apache-2.0 Imports: 5 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)

func (*Model[t]) DB

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

func (*Model[t]) Delete

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

func (*Model[t]) Distinct

func (m *Model[t]) Distinct(args ...interface{}) *Model[t]

func (*Model[t]) Find

func (m *Model[t]) Find() (res []t)

func (*Model[t]) First

func (m *Model[t]) First() (res t)

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)

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 interface{}) int64

func (*Model[t]) Updates

func (m *Model[t]) Updates(values interface{}) int64

func (*Model[t]) Where

func (m *Model[t]) Where(where map[string]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