db

package
v0.0.0-...-4249d65 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 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 BasicMapper

type BasicMapper[T schema.Tabler] struct {
	*DatabaseSource
}

func NewBasicMapper

func NewBasicMapper[T schema.Tabler](ds *DatabaseSource) (*BasicMapper[T], error)

func (*BasicMapper[T]) Delete

func (d *BasicMapper[T]) Delete(t *T) (int64, error)

func (*BasicMapper[T]) Insert

func (d *BasicMapper[T]) Insert(t *T) (int64, error)

func (*BasicMapper[T]) Select

func (d *BasicMapper[T]) Select(where *T) ([]*T, error)

func (*BasicMapper[T]) SelectBySQL

func (d *BasicMapper[T]) SelectBySQL(sql string, args ...interface{}) ([]*T, error)

func (*BasicMapper[T]) SelectWithPage

func (d *BasicMapper[T]) SelectWithPage(where *T, p *Pagenation) ([]*T, error)

func (*BasicMapper[T]) Update

func (d *BasicMapper[T]) Update(old *T, new *T) (int64, error)

type Config

type Config struct {
	DSN string
}

type DatabaseSource

type DatabaseSource struct {
	DB *gorm.DB
}

func NewDatabaseSource

func NewDatabaseSource(conf *Config) (*DatabaseSource, error)

type Pagenation

type Pagenation struct {
	PageIndex int
	PageSize  int
	OrderBy   []string
	Order     string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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