orm

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 12 Imported by: 9

Documentation

Index

Constants

View Source
const Associations = clause.Associations
View Source
const BindingOrm = "goravel.orm"

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	ID uint `gorm:"primaryKey" json:"id"`
	Timestamps
}

type Orm added in v1.15.0

type Orm struct {
	// contains filtered or unexported fields
}

func BuildOrm added in v1.15.0

func BuildOrm(ctx context.Context, config config.Config, connection string, log log.Log, refresh func(key any)) (*Orm, error)

func NewOrm added in v1.15.0

func NewOrm(
	ctx context.Context,
	config config.Config,
	connection string,
	query contractsorm.Query,
	queries map[string]contractsorm.Query,
	log log.Log,
	modelToObserver []contractsorm.ModelToObserver,
	refresh func(key any),
) *Orm

func (*Orm) Connection added in v1.15.0

func (r *Orm) Connection(name string) contractsorm.Orm

func (*Orm) DB added in v1.15.0

func (r *Orm) DB() (*sql.DB, error)

func (*Orm) DatabaseName added in v1.15.0

func (r *Orm) DatabaseName() string

func (*Orm) Factory added in v1.15.0

func (r *Orm) Factory() contractsorm.Factory

func (*Orm) Name added in v1.15.0

func (r *Orm) Name() string

func (*Orm) Observe added in v1.15.0

func (r *Orm) Observe(model any, observer contractsorm.Observer)

func (*Orm) Query added in v1.15.0

func (r *Orm) Query() contractsorm.Query

func (*Orm) Refresh added in v1.15.0

func (r *Orm) Refresh()

func (*Orm) SetQuery added in v1.15.0

func (r *Orm) SetQuery(query contractsorm.Query)

func (*Orm) Transaction added in v1.15.0

func (r *Orm) Transaction(txFunc func(tx contractsorm.Query) error) error

func (*Orm) WithContext added in v1.15.0

func (r *Orm) WithContext(ctx context.Context) contractsorm.Orm

type SoftDeletes

type SoftDeletes struct {
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"`
}

type Timestamps added in v1.0.0

type Timestamps struct {
	CreatedAt carbon.DateTime `gorm:"autoCreateTime;column:created_at" json:"created_at"`
	UpdatedAt carbon.DateTime `gorm:"autoUpdateTime;column:updated_at" json:"updated_at"`
}

Jump to

Keyboard shortcuts

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