service

package
v0.0.0-...-bcbb06c Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DB_NAME = "./data/risiti.db"
)
View Source
const (
	RECEIPTS_PATH = "./data/"
)
View Source
const (
	TOKEN_EXPIRATION_TIME = 24 * time.Hour
)
View Source
const (
	YYYYMMDD = "2006-01-02"
)

Variables

This section is empty.

Functions

func NewDB

func NewDB() *sql.DB

Types

type AuthService

type AuthService struct {
	JWTAuth *jwtauth.JWTAuth
	// contains filtered or unexported fields
}

func NewAuthService

func NewAuthService(secretKey []byte) AuthService

func (*AuthService) Authorize

func (a *AuthService) Authorize(r *http.Request) error

func (*AuthService) SignIn

func (a *AuthService) SignIn(w *http.ResponseWriter, user *model.User) error

func (*AuthService) SignOut

func (a *AuthService) SignOut(w *http.ResponseWriter)

type FileStorage

type FileStorage struct{}

func NewFileStorage

func NewFileStorage() *FileStorage

func (*FileStorage) SaveFile

func (fs *FileStorage) SaveFile(file multipart.File, filename string) error

type IFileStorage

type IFileStorage interface {
	SaveFile(file multipart.File, filename string) error
}

type IReceiptService

type IReceiptService interface {
	Create(receipt model.Receipt) (model.Receipt, error)
	ReadAll() ([]model.Receipt, error)
	ReadByText(text string) ([]model.Receipt, error)
	ReadByName(name string) (model.Receipt, error)
}

type IUserService

type IUserService interface {
	Create(user model.User) (model.User, error)
	Read(email string) (model.User, error)
	AnyExists() (bool, error)
}

type ReceiptService

type ReceiptService struct {
	DB *sql.DB
}

func NewReceiptService

func NewReceiptService(db *sql.DB) *ReceiptService

func (*ReceiptService) Create

func (s *ReceiptService) Create(receipt model.Receipt) (model.Receipt, error)

func (*ReceiptService) ReadAll

func (s *ReceiptService) ReadAll() ([]model.Receipt, error)

func (*ReceiptService) ReadByName

func (s *ReceiptService) ReadByName(name string) (model.Receipt, error)

func (*ReceiptService) ReadByText

func (s *ReceiptService) ReadByText(text string) ([]model.Receipt, error)

type UserService

type UserService struct {
	DB *sql.DB
}

func NewUserService

func NewUserService(db *sql.DB) *UserService

func (*UserService) AnyExists

func (s *UserService) AnyExists() (bool, error)

func (*UserService) Create

func (s *UserService) Create(user model.User) (model.User, error)

func (*UserService) Read

func (s *UserService) Read(email string) (model.User, error)

Jump to

Keyboard shortcuts

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