entity

package
v0.0.0-...-1202c29 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package entity defines main entities for business logic (services), data base mapping and HTTP response objects if suitable. Each logic group entities in own file.

Package entity defines main entities for business logic (services), data base mapping and HTTP response objects if suitable. Each logic group entities in own file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	common.Model
	Slug string `json:"slug" gorm:"column:slug;uniqueIndex"`
	Name string `json:"name" gorm:"column:name"`
}

Translation -.

func (*Author) BeforeCreate

func (e *Author) BeforeCreate(tx *gorm.DB) (err error)

func (Author) TableName

func (Author) TableName() string

type Category

type Category struct {
	common.Model
	Slug        string `json:"slug" gorm:"column:slug;uniqueIndex"`
	Name        string `json:"name" gorm:"column:name"`
	Description string `json:"description" gorm:"column:description"`
}

Translation -.

func (*Category) BeforeCreate

func (e *Category) BeforeCreate(tx *gorm.DB) (err error)

func (Category) TableName

func (Category) TableName() string

type Chapter

type Chapter struct {
	common.Model
	CID     string `json:"cid" gorm:"column:cid;uniqueIndex"`
	StoryID int    `json:"story_id" gorm:"column:story_id"`
	Slug    string `json:"slug" gorm:"column:slug"`
	Name    string `json:"name" gorm:"column:name"`
	Content string `json:"content" gorm:"column:content"`
}

Translation -.

func (*Chapter) BeforeCreate

func (e *Chapter) BeforeCreate(tx *gorm.DB) (err error)

func (Chapter) TableName

func (Chapter) TableName() string

type Story

type Story struct {
	common.Model
	TID         string     `json:"tid" gorm:"column:tid;uniqueIndex"`
	Slug        string     `json:"slug" gorm:"column:slug;uniqueIndex"`
	Name        string     `json:"name" gorm:"column:name"`
	Thumbnail   string     `json:"thumbnail" gorm:"column:thumbnail"`
	AuthorId    int        `json:"author_id" gorm:"column:author_id"`
	Author      Author     `json:"author" gorm:"foreignkey:author_id"`
	Categories  []Category `json:"categories" gorm:"many2many:stories_categories;"`
	Source      string     `json:"source" gorm:"column:source"`
	Status      string     `json:"status" gorm:"column:status"`
	Rate        StoryRate  `json:"rate" gorm:"foreignkey:story_id"`
	Description string     `json:"description" gorm:"column:description"`
	Chapters    []Chapter  `json:"chapters" gorm:"foreignkey:story_id"`
}

Translation -.

func (*Story) BeforeCreate

func (e *Story) BeforeCreate(tx *gorm.DB) (err error)

func (Story) TableName

func (Story) TableName() string

type StoryList

type StoryList struct {
	common.Model
	Slug        string `json:"slug" gorm:"column:slug;uniqueIndex"`
	Name        string `json:"name" gorm:"column:name"`
	Description string `json:"description" gorm:"column:description"`
}

Translation -.

func (*StoryList) BeforeCreate

func (e *StoryList) BeforeCreate(tx *gorm.DB) (err error)

func (StoryList) TableName

func (StoryList) TableName() string

type StoryRate

type StoryRate struct {
	common.Model
	StoryID   int     `json:"story_id" gorm:"column:story_id;uniqueIndex"`
	Value     float32 `json:"value" gorm:"column:value"`
	BestValue float32 `json:"best_value" gorm:"column:best_value"`
	Count     int     `json:"count" gorm:"column:count"`
}

func (*StoryRate) BeforeCreate

func (e *StoryRate) BeforeCreate(tx *gorm.DB) (err error)

func (StoryRate) TableName

func (StoryRate) TableName() string

type Translation

type Translation struct {
	common.Model
	Source      string `json:"source"       example:"auto"`
	Destination string `json:"destination"  example:"en"`
	Original    string `json:"original"     example:"текст для перевода"`
	Translation string `json:"translation"  example:"text for translation"`
}

Translation -.

func (Translation) TableName

func (Translation) TableName() string

Jump to

Keyboard shortcuts

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