model

package
v0.0.0-...-63c9515 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATE_OPEN  = 1
	STATE_CLOSE = 0
)

Variables

This section is empty.

Functions

func NewDBEngine

func NewDBEngine(databaseSetting *setting.DatabaseSettingS) (*gorm.DB, error)

Types

type Article

type Article struct {
	*Model
	Title         string `json:"title"`
	Desc          string `json:"desc"`
	Content       string `json:"content"`
	CoverImageUrl string `json:"cover_image_url"`
	State         uint8  `json:"state"`
}

func (Article) CountByTagID

func (a Article) CountByTagID(db *gorm.DB, tagID uint32) (int, error)

func (Article) Create

func (a Article) Create(db *gorm.DB) (*Article, error)

func (Article) Delete

func (a Article) Delete(db *gorm.DB) error

func (Article) Get

func (a Article) Get(db *gorm.DB) (Article, error)

func (Article) ListByTagID

func (a Article) ListByTagID(db *gorm.DB, tagID uint32, pageOffset, pageSize int) ([]*ArticleRow, error)

func (Article) TableName

func (a Article) TableName() string

func (Article) Update

func (a Article) Update(db *gorm.DB, values interface{}) error

type ArticleRow

type ArticleRow struct {
	ArticleID     uint32
	TagID         uint32
	TagName       string
	ArticleTitle  string
	ArticleDesc   string
	CoverImageUrl string
	Content       string
}

type ArticleSwagger

type ArticleSwagger struct {
	List  []*Article
	Pager *app.Pager
}

type ArticleTag

type ArticleTag struct {
	*Model
	TagID     uint32 `json:"tag_id"`
	ArticleID uint32 `json:"article_id"`
}

func (ArticleTag) Create

func (a ArticleTag) Create(db *gorm.DB) error

func (ArticleTag) Delete

func (a ArticleTag) Delete(db *gorm.DB) error

func (ArticleTag) DeleteOne

func (a ArticleTag) DeleteOne(db *gorm.DB) error

func (ArticleTag) GetByAID

func (a ArticleTag) GetByAID(db *gorm.DB) (ArticleTag, error)

func (ArticleTag) ListByAIDs

func (a ArticleTag) ListByAIDs(db *gorm.DB, articleIDs []uint32) ([]*ArticleTag, error)

func (ArticleTag) ListByTID

func (a ArticleTag) ListByTID(db *gorm.DB) ([]*ArticleTag, error)

func (ArticleTag) TableName

func (a ArticleTag) TableName() string

func (ArticleTag) UpdateOne

func (a ArticleTag) UpdateOne(db *gorm.DB, values interface{}) error

type Auth

type Auth struct {
	*Model
	AppKey    string `json:"app_key"`
	AppSecret string `json:"app_secret"`
}

func (Auth) Get

func (a Auth) Get(db *gorm.DB) (Auth, error)

func (Auth) TableName

func (a Auth) TableName() string

type Model

type Model struct {
	ID         uint32 `gorm:"primary_key" json:"id"`
	CreatedBy  string `json:"created_by"`
	ModifiedBy string `json:"modified_by"`
	CreatedOn  uint32 `json:"created_on"`
	ModifiedOn uint32 `json:"modified_on"`
	DeletedOn  uint32 `json:"deleted_on"`
	IsDel      uint8  `json:"is_del"`
}

type Tag

type Tag struct {
	*Model
	Name  string `json:"name"`
	State uint8  `json:"state"`
}

func (Tag) Count

func (t Tag) Count(db *gorm.DB) (int, error)

func (Tag) Create

func (t Tag) Create(db *gorm.DB) error

func (Tag) Delete

func (t Tag) Delete(db *gorm.DB) error

func (Tag) Get

func (t Tag) Get(db *gorm.DB) (Tag, error)

func (Tag) List

func (t Tag) List(db *gorm.DB, pageOffset, pageSize int) ([]*Tag, error)

func (Tag) ListByIDs

func (t Tag) ListByIDs(db *gorm.DB, ids []uint32) ([]*Tag, error)

func (Tag) TableName

func (t Tag) TableName() string

func (Tag) Update

func (t Tag) Update(db *gorm.DB, values interface{}) error

type TagSwagger

type TagSwagger struct {
	List  []*Tag
	Pager *app.Pager
}

Jump to

Keyboard shortcuts

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