orm

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: MIT Imports: 2 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Association added in v1.8.0

type Association interface {
	Find(out any, conds ...any) error
	Append(values ...any) error
	Replace(values ...any) error
	Delete(values ...any) error
	Clear() error
	Count() int64
}

type DispatchesEvents added in v1.11.0

type DispatchesEvents interface {
	DispatchesEvents() map[EventType]func(Event) error
}

type Driver added in v1.2.3

type Driver string
const (
	DriverMysql      Driver = "mysql"
	DriverPostgresql Driver = "postgresql"
	DriverSqlite     Driver = "sqlite"
	DriverSqlserver  Driver = "sqlserver"
)

func (Driver) String added in v1.2.3

func (d Driver) String() string

type Event added in v1.11.0

type Event interface {
	Context() context.Context
	GetAttribute(key string) any
	GetOriginal(key string, def ...any) any
	IsDirty(columns ...string) bool
	IsClean(columns ...string) bool
	Query() Query
	SetAttribute(key string, value any)
}

type EventType added in v1.11.0

type EventType string
const EventCreated EventType = "created"
const EventCreating EventType = "creating"
const EventDeleted EventType = "deleted"
const EventDeleting EventType = "deleting"
const EventForceDeleted EventType = "force_deleted"
const EventForceDeleting EventType = "force_deleting"
const EventRetrieved EventType = "retrieved"
const EventSaved EventType = "saved"
const EventSaving EventType = "saving"
const EventUpdated EventType = "Updated"
const EventUpdating EventType = "updating"

type Observer added in v1.11.0

type Observer interface {
	Retrieved(Event) error
	Creating(Event) error
	Created(Event) error
	Updating(Event) error
	Updated(Event) error
	Saving(Event) error
	Saved(Event) error
	Deleting(Event) error
	Deleted(Event) error
	ForceDeleting(Event) error
	ForceDeleted(Event) error
}

type Orm

type Orm interface {
	Connection(name string) Orm
	DB() (*sql.DB, error)
	Query() Query
	Observe(model any, observer Observer)
	Transaction(txFunc func(tx Transaction) error) error
	WithContext(ctx context.Context) Orm
}

type Query

type Query interface {
	Association(association string) Association
	Begin() (Transaction, error)
	Driver() Driver
	Count(count *int64) error
	Create(value any) error
	Delete(value any, conds ...any) (*Result, error)
	Distinct(args ...any) Query
	Exec(sql string, values ...any) (*Result, error)
	Find(dest any, conds ...any) error
	FindOrFail(dest any, conds ...any) error
	First(dest any) error
	FirstOrCreate(dest any, conds ...any) error
	FirstOr(dest any, callback func() error) error
	FirstOrFail(dest any) error
	FirstOrNew(dest any, attributes any, values ...any) error
	ForceDelete(value any, conds ...any) (*Result, error)
	Get(dest any) error
	Group(name string) Query
	Having(query any, args ...any) Query
	Join(query string, args ...any) Query
	Limit(limit int) Query
	Load(dest any, relation string, args ...any) error
	LoadMissing(dest any, relation string, args ...any) error
	LockForUpdate() Query
	Model(value any) Query
	Offset(offset int) Query
	Omit(columns ...string) Query
	Order(value any) Query
	OrWhere(query any, args ...any) Query
	Paginate(page, limit int, dest any, total *int64) error
	Pluck(column string, dest any) error
	Raw(sql string, values ...any) Query
	Save(value any) error
	SaveQuietly(value any) error
	Scan(dest any) error
	Scopes(funcs ...func(Query) Query) Query
	Select(query any, args ...any) Query
	SharedLock() Query
	Table(name string, args ...any) Query
	Update(column any, value ...any) (*Result, error)
	UpdateOrCreate(dest any, attributes any, values any) error
	Where(query any, args ...any) Query
	WithoutEvents() Query
	WithTrashed() Query
	With(query string, args ...any) Query
}

type Result added in v1.10.0

type Result struct {
	RowsAffected int64
}

type Transaction

type Transaction interface {
	Query
	Commit() error
	Rollback() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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