controller

package
v0.0.0-...-188702c Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupDB

func SetupDB() (*gorm.DB, error)

Types

type Book

type Book struct{}

func (*Book) CreateBook

func (b *Book) CreateBook(title, author string, year int) (model.Book, error)

func (*Book) DeleteBook

func (b *Book) DeleteBook(id uint) error

func (*Book) GetBooks

func (b *Book) GetBooks() ([]model.Book, error)

func (*Book) ReadBook

func (b *Book) ReadBook(id uint) (model.Book, error)

func (*Book) UpdateBook

func (b *Book) UpdateBook(id uint, title, author string, year int) (model.Book, error)

type IController

type IController interface {
	GetBooks() ([]model.Book, error)
	CreateBook(title, author string, year int) (model.Book, error)
	ReadBook(id uint) (model.Book, error)
	UpdateBook(id uint, title, author string, year int) (model.Book, error)
	DeleteBook(id uint) error
}
var BC IController

type IGormDB

type IGormDB interface {
	AutoMigrate(dst ...interface{}) error
	Find(dst interface{}, conds ...interface{}) *gorm.DB
	Create(dst interface{}) *gorm.DB
	First(dst interface{}, conds ...interface{}) *gorm.DB
	Save(dst interface{}) *gorm.DB
	Delete(dst interface{}, conds ...interface{}) *gorm.DB
}
var DB IGormDB

Jump to

Keyboard shortcuts

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