database

package
v0.0.0-...-0966096 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOrderLogic

func NewOrderLogic(Db SqliteDatabase) models.ManupilatorOrder

func NewShopLogic

func NewShopLogic(Db SqliteDatabase) models.ManipulatorShop

func NewUserLogic

func NewUserLogic(Db SqliteDatabase) models.ManipulatorUser

Types

type Database

type Database struct {
	Database *gorm.DB
}

func (*Database) Add

func (db *Database) Add(ctx context.Context, Input interface{}) *gorm.DB

func (*Database) AppendTo

func (db *Database) AppendTo(field string, Model interface{}, Paylod interface{}, ctx context.Context) error

func (*Database) CreateTable

func (db *Database) CreateTable(Model interface{}) error

func (*Database) DeleteRecordById

func (db *Database) DeleteRecordById(ctx context.Context, Model interface{}, Id uint) *gorm.DB

func (*Database) FindAll

func (db *Database) FindAll(limit int, RespPayload interface{}) (interface{}, error)

func (*Database) FindAllByCol

func (db *Database) FindAllByCol(limit int, RespPayload interface{}, Col string, Input any, ctx context.Context) (interface{}, error)

func (*Database) FindOneByCol

func (db *Database) FindOneByCol(ctx context.Context, VarToAssign interface{}, Col string, Input string) *gorm.DB

func (*Database) FindOneById

func (db *Database) FindOneById(ctx context.Context, VarToAssign interface{}, Id uint) *gorm.DB

func (*Database) Init

func (db *Database) Init(location string) error

func (*Database) UpdateRow

func (db *Database) UpdateRow(ctx context.Context, Model interface{}, Col string, NewVal interface{}) *gorm.DB

type OrderLogic

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

func (OrderLogic) GetOrderById

func (ol OrderLogic) GetOrderById(ctx context.Context, Id uint) (models.Order, error)

func (*OrderLogic) PostOrder

func (ol *OrderLogic) PostOrder(ctx context.Context, Products []models.Product, ParentShop models.Shop, Orderer models.User) []error

type ProductLogic

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

func (*ProductLogic) AddProducts

func (pl *ProductLogic) AddProducts(ctx context.Context, products []models.Product, shop *models.Shop) error

func (*ProductLogic) GetProductById

func (pl *ProductLogic) GetProductById(ctx context.Context, Id uint) (models.Product, error)

func (*ProductLogic) GetProducts

func (pl *ProductLogic) GetProducts(ctx context.Context, shop models.Shop, limit int) ([]models.Product, error)

type ShopLogic

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

func (*ShopLogic) CreateShop

func (sl *ShopLogic) CreateShop(ctx context.Context, shop models.Shop, user *models.User) error

func (*ShopLogic) DeleteShop

func (sl *ShopLogic) DeleteShop(ctx context.Context, Shop *models.Shop) error

func (*ShopLogic) FetchAll

func (sl *ShopLogic) FetchAll(ctx context.Context, limit int) ([]models.Shop, error)

func (*ShopLogic) FetchAllByFilter

func (sl *ShopLogic) FetchAllByFilter(ctx context.Context, limit int, filter string, filterVal string) ([]models.Shop, error)

func (*ShopLogic) GetShopByID

func (sl *ShopLogic) GetShopByID(ctx context.Context, ID uint) (models.Shop, error)

func (*ShopLogic) GetShopByName

func (sl *ShopLogic) GetShopByName(ctx context.Context, Name string) (models.Shop, error)

func (*ShopLogic) UpdateShop

func (sl *ShopLogic) UpdateShop(ctx context.Context, Shop *models.Shop, field string, value interface{}) error

type SqliteDatabase

type SqliteDatabase interface {
	Init(location string) error
	CreateTable(Model interface{}) error
	Add(ctx context.Context, Input interface{}) *gorm.DB
	FindOneById(ctx context.Context, VarToAssign interface{}, id uint) *gorm.DB
	FindOneByCol(ctx context.Context, VarToAssign interface{}, Col string, Input string) *gorm.DB
	AppendTo(field string, Model interface{}, Paylod interface{}, ctx context.Context) error
	FindAll(limit int, RespPayload interface{}) (interface{}, error)
	FindAllByCol(limit int, RespPayload interface{}, Col string, Input any, ctx context.Context) (interface{}, error)
	UpdateRow(ctx context.Context, Model interface{}, Col string, NewVal interface{}) *gorm.DB
	DeleteRecordById(ctx context.Context, Model interface{}, Id uint) *gorm.DB
}

type UserLogic

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

func (*UserLogic) CreateUser

func (um *UserLogic) CreateUser(ctx context.Context, usr *models.User) error

func (UserLogic) GetByEmail

func (um UserLogic) GetByEmail(ctx context.Context, Email string) (models.User, error)

func (UserLogic) GetById

func (um UserLogic) GetById(ctx context.Context, ID uint) (models.User, error)

Jump to

Keyboard shortcuts

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