file

package
v0.0.0-...-9c5febd Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

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

Storage object for file db

func New

func New() *Storage

New create storage instance

func (Storage) Close

func (s Storage) Close()

Close defer db.Close()

func (Storage) DeleteItem

func (s Storage) DeleteItem(item core.Item) bool

DeleteItem remove file from storage

func (Storage) DeleteOrder

func (s Storage) DeleteOrder(order core.Order) bool

DeleteOrder remove order from storage

func (Storage) FindCustomerByID

func (s Storage) FindCustomerByID(id int) (core.Customer, bool)

FindCustomerByID get client from storage

func (Storage) FindCustomerChatID

func (s Storage) FindCustomerChatID(customer core.Customer, messengerName string) (int, bool)

FindCustomerChatID get customer's chat id

func (Storage) FindItemByID

func (s Storage) FindItemByID(id int) (core.Item, bool)

FindItemByID get file from storage

func (Storage) FindOrderByID

func (s Storage) FindOrderByID(id int) (core.Order, bool)

FindOrderByID get bucket from storage

func (s Storage) FindOrderByLink(link string) (core.Order, bool)

FindOrderByLink get bucket from storage by link

func (Storage) GetOrderedItems

func (s Storage) GetOrderedItems(order core.Order) ([]core.Item, bool)

GetOrderedItems takes all ordered items by selected order

func (Storage) GetOrders

func (s Storage) GetOrders(strategy func() string) ([]core.Order, error)

GetOrders takes orders from db

func (*Storage) Init

func (s *Storage) Init(args ...string)

Init db and create connection. Do migration if needed.

func (Storage) IsRegisteredChatID

func (s Storage) IsRegisteredChatID(chatID int, messengerName string) (int, bool)

IsRegisteredChatID get customer's id if chat already registered

func (Storage) StoreCustomer

func (s Storage) StoreCustomer(customer core.Customer) (int, error)

StoreCustomer save client to storage

func (Storage) StoreCustomerMessenger

func (s Storage) StoreCustomerMessenger(customer core.Customer, messengerName string, chatID int) error

StoreCustomerMessenger save chat id to storage by customer

func (Storage) StoreItem

func (s Storage) StoreItem(item core.Item) (int, error)

StoreItem save file to storage

func (Storage) StoreOrder

func (s Storage) StoreOrder(order core.Order) (int, error)

StoreOrder save bucket to storage

func (Storage) String

func (s Storage) String() string

Jump to

Keyboard shortcuts

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