db

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB *gorm.DB
)

Functions

func AddRepositories

func AddRepositories(dbRepositories ...Repository)

func Init

func Init() error

func IsRecordFound

func IsRecordFound(e error) (found bool, err error)

Types

type Model

type Model struct {
	ID        int64 `json:"id" gorm:"primary_key"`
	CreatedAt int64 `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt int64 `json:"updated_at" gorm:"autoUpdateTime"`
}

type Page

type Page struct {
	Total int64
	Data  interface{}
}

type Repository

type Repository interface {
	TableName() string
	BeforeCreate(db *gorm.DB) error
	BeforeSave(db *gorm.DB) error
	AfterCreate(db *gorm.DB) error
	AfterSave(db *gorm.DB) error
}

Jump to

Keyboard shortcuts

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