torm

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

TypeGrom

use gorm's DB anywhere

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GlobalDB = make(map[string]*DB)
)

Functions

func ChangeParser

func ChangeParser(p Reflect.Parser[[]string], alias ...Reflect.Alias)

func Close

func Close() error

func Exist

func Exist[T any](conds ...any) bool

func Find

func Find[T any](conds ...any) ([]T, bool)

func First

func First[T any](conds ...any) (*T, bool)

func FirstOrCreate

func FirstOrCreate[T any](first, create func(), x *T, conds ...any)

func MFind

func MFind[T any](conds ...any) []T

func MFirst

func MFirst[T any](conds ...any) *T

func MPreload

func MPreload[T any](conds ...any) *T

func MPreloads

func MPreloads[T any](conds ...any) []T

func MSelect

func MSelect[T any](fields []string, conds ...any) *T

func Preload

func Preload[T any](conds ...any) (*T, bool)

func Preloads

func Preloads[T any](conds ...any) ([]T, bool)

func Select

func Select[T any](fields []string, conds ...any) (*T, bool)

Types

type DB

type DB struct {
	*gorm.DB
	// contains filtered or unexported fields
}

func AutoMigrate

func AutoMigrate(dst ...any) *DB

func CFind

func CFind[T any](conds ...any) ([]T, *DB)

func CFirst

func CFirst[T any](conds ...any) (*T, *DB)

func CPreload

func CPreload[T any](conds ...any) (*T, *DB)

func CPreloads

func CPreloads[T any](conds ...any) ([]T, *DB)

func CSelect

func CSelect[T any](fields []string, conds ...any) (*T, *DB)

func Get

func Get() *DB

func SetDB

func SetDB(gormDB *gorm.DB) (db *DB)

func SetDialector

func SetDialector(dialector gorm.Dialector) *DB

func SetSqlite

func SetSqlite(file string) *DB

func Where

func Where(relative string) *DB

func (*DB) AutoMigrate

func (db *DB) AutoMigrate(dst ...any) *DB

func (*DB) CFind

func (db *DB) CFind(dest any, conds ...any) *DB

func (*DB) CFirst

func (db *DB) CFirst(dest any, conds ...any) *DB

func (*DB) CPreload

func (db *DB) CPreload(t any, conds ...any) *DB

func (*DB) CPreloads

func (db *DB) CPreloads(t any, conds ...any) *DB

func (*DB) CSelect

func (db *DB) CSelect(dest any, fields []string, conds ...any) *DB

func (*DB) Close

func (db *DB) Close() error

func (*DB) Error

func (db *DB) Error() error

func (*DB) Find

func (db *DB) Find(dest any, conds ...any) bool

func (*DB) First

func (db *DB) First(dest any, conds ...any) bool

func (*DB) FirstOrCreate

func (db *DB) FirstOrCreate(first, create func(), x any, conds ...any)

func (*DB) NoRecord

func (db *DB) NoRecord() bool

func (*DB) Preload

func (db *DB) Preload(t any, conds ...any) bool

func (*DB) PreloadDB

func (db *DB) PreloadDB(in any) *gorm.DB

func (*DB) Preloads

func (db *DB) Preloads(t any, conds ...any) bool

func (*DB) Select

func (db *DB) Select(dest any, fields []string, conds ...any) bool

type Model

type Model struct {
	ID uint64 `gorm:"primaryKey;autoIncrement" form:"-" json:"-"`
}

type Parser

type Parser int

func (Parser) Parse

func (Parser) Parse(ref *Reflect.Map[[]string], elem reflect.Type) (r []string)

Jump to

Keyboard shortcuts

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