repo

package
v0.0.0-...-2eb6bad Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreatePoemArgs

type CreatePoemArgs struct {
	Poem
}

func (*CreatePoemArgs) BeforeCreate

func (args *CreatePoemArgs) BeforeCreate(tx *gorm.DB) error

func (*CreatePoemArgs) BeforeSave

func (args *CreatePoemArgs) BeforeSave(tx *gorm.DB) error

type Poem

type Poem struct {
	ID         int64          `json:"id" gorm:"id"`
	ResourceID string         `json:"resource_id" gorm:"resource_id"`
	Title      string         `json:"title" gorm:"title" validate:"required,lte=255"`
	Dynasty    string         `json:"dynasty" gorm:"dynasty" validate:"required,lte=32"`
	Author     string         `json:"author" gorm:"author" validate:"required,lte=32"`
	Content    string         `json:"content" gorm:"content" validate:"required"`
	Translate  string         `json:"translate" gorm:"translate"`
	DeletedAt  gorm.DeletedAt `json:"deleted_at" gorm:"deleted_at"`
	CreatedAt  time.Time      `json:"created_at" gorm:"created_at"`
	UpdatedAt  time.Time      `json:"updated_at" gorm:"updated_at"`
}

type Repo

type Repo interface {
	CreatePoem(ctx context.Context, args *CreatePoemArgs) (int64, error)
	GetPoemByID(ctx context.Context, id int) (*Poem, error)
}

func NewRepo

func NewRepo(cli *gorm.DB) Repo

Jump to

Keyboard shortcuts

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