model

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BLOCKED = "block"
	NEW     = "new"
	STUDY   = "study"
)

Variables

View Source
var ErrBookNotFound = errors.New("Book isn't found ")

Functions

func NewBookService

func NewBookService(repository BookRepository) *bookService

Types

type Book

type Book struct {
	gorm.Model
	Name       string  `gorm: "type: varchar(500)"`
	Complexity float32 `gorm: "type: decimal(2,2)"`
	Path       string  `gorm: "type: varchar(500);"`
	UserID     uint    `gorm: "index:,unique"`
}

type BookRepository

type BookRepository interface {
	FindAll() ([]Book, error)
	Create(file os.File) error
	CalcWord() (int64, error)
	FindByName(name string) (*Book, error)
}

type Language

type Language struct {
	gorm.Model
	Name string `gorm: "type: varchar(255)"`
	Word []Word
}

type LanguageRepository

type LanguageRepository interface {
	GetName() string
}

type LanguageService

type LanguageService interface {
	GetName() string
}

func NewLanguageService

func NewLanguageService(repository LanguageRepository) LanguageService

type User

type User struct {
	gorm.Model
	ChatID    int64  `gorm: "type:bigint"`
	Phone     string `gorm "type: varchar(50)"`
	FirstName string `gorm: "type: varchar(255)"`
	Books     []Book `gorm: "many2many:user_books;foreignKey:BookID;References:UserID"`
	BookID    uint   `gorm: "index:,unique"`
	Status    string `gorm: "type: varchar(50)"`
}

type UserRepository

type UserRepository interface {
	Create(user User) error
	Update(user user.User) error
	GetKnowingWords(limit, offset int) ([]Word, error)
	UploadBook(file os.File) error
}

type UserService

type UserService interface {
	Create(user User) error
	Update(user user.User) error
	GetKnowingWords(limit, offset int) ([]Word, error)
	UploadBook(file os.File) error
}

func NewUserService

func NewUserService(repository UserRepository) UserService

type Word

type Word struct {
	Text       string `gorm: "type: varchar(50)"`
	Frequency  int
	Complexity int
	Lang       string
}

type WordRepository

type WordRepository interface {
	GetTranslations() []Word
	GetSynonyms() []Word
}

type WordService

type WordService interface {
	GetTranslations() []Word
	GetSynonyms() []Word
}

func NewWordService

func NewWordService(repository WordRepository) WordService

Jump to

Keyboard shortcuts

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