repository

package
v0.0.0-...-40b14c1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	ID       uint32 `gorm:"AUTO_INCREMENT;primary_key;type:int(11)"`
	Title    string `gorm:"type:varchar(225)"`
	Slug     string `gorm:"type:varchar(225)"`
	Content  string `gorm:"type:text"`
	AuthorID uint32 `grom:"type:int(11)`
	TopicID  uint32 `grom:"type:int(11)`
	Status   string `gorm:"type:varchar(225)"`

	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time
}

type Service

type Service interface {
	FetchArticles() ([]*Article, error)
	CreateArticle(ctx context.Context, req *pb.Article) error
	DeleteArticle(ctx context.Context, req *pb.Article) error
	UpdateArticle(ctx context.Context, req *pb.Article) error

	FetchTopics(ctx context.Context, req *pb.ListRequest) ([]*Topic, error)
	CreateTopic(ctx context.Context, req *pb.Topic) error
	GetTopic(ctx context.Context, req *pb.Topic) error

	Migrate()
	Close() error
}

func New

func New(dbHost, dbName, dbUser, dbPass, dbPort string) (Service, error)

type Topic

type Topic struct {
	ID    uint32 `gorm:"primary_key;type:int(11)"`
	Title string `gorm:"type:varchar(225)"`
	Slug  string `gorm:"type:varchar(225)"`
	Tag   string `gorm:"type:varchar(225)"`
	Color string `gorm:"type:varchar(8)"`

	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time
}

Jump to

Keyboard shortcuts

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