orm

package
v0.0.0-...-41a006c Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfig

func GetConfig(container goframe.IContainer) *contract.DbConfig

func NewOrmService

func NewOrmService(params ...any) (any, error)

func WithConfigPath

func WithConfigPath(path string) contract.DbOption

func WithDryRun

func WithDryRun() contract.DbOption

func WithFullSaveAssociations

func WithFullSaveAssociations() contract.DbOption

func WithGormConfig

func WithGormConfig(fn func(options *contract.DbConfig)) contract.DbOption

Types

type OrmLogger

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

func NewOrmLogger

func NewOrmLogger(logger contract.ILog) *OrmLogger

func (*OrmLogger) Error

func (l *OrmLogger) Error(ctx context.Context, msg string, val ...any)

func (*OrmLogger) Info

func (l *OrmLogger) Info(ctx context.Context, msg string, val ...any)

func (*OrmLogger) LogMode

func (l *OrmLogger) LogMode(level logger.LogLevel) logger.Interface

func (*OrmLogger) Trace

func (l *OrmLogger) Trace(ctx context.Context, begin time.Time, fn func() (string, int64), err error)

func (*OrmLogger) Warn

func (l *OrmLogger) Warn(ctx context.Context, msg string, val ...any)

type OrmProvider

type OrmProvider struct{}

func (*OrmProvider) Boot

func (p *OrmProvider) Boot(container goframe.IContainer) error

func (*OrmProvider) Inject

func (p *OrmProvider) Inject(container goframe.IContainer) goframe.Handler

func (*OrmProvider) IsDefer

func (p *OrmProvider) IsDefer() bool

func (*OrmProvider) Name

func (p *OrmProvider) Name() string

func (*OrmProvider) Params

func (p *OrmProvider) Params(container goframe.IContainer) []any

type OrmService

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

func (*OrmService) Get

func (s *OrmService) Get(option ...contract.DbOption) (*gorm.DB, error)

func (*OrmService) GetTableColumns

func (s *OrmService) GetTableColumns(ctx context.Context, db *gorm.DB, table string) ([]contract.TableColumn, error)

func (*OrmService) GetTables

func (s *OrmService) GetTables(ctx context.Context, db *gorm.DB) ([]string, error)

func (*OrmService) HasTable

func (s *OrmService) HasTable(ctx context.Context, db *gorm.DB, table string) (bool, error)

Jump to

Keyboard shortcuts

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