article

package
v0.0.0-...-a8b6b34 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 17 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               int    `json:"ID,omitempty"`
	Code             string `json:"code,omitempty"`
	Title            string
	Link             string
	Date             string    `json:"Date,omitempty"`
	Author           string    `json:"Author,omitempty"`
	Comments         Comments  `json:"comments,omitempty"`
	LastPushDateTime time.Time `json:"lastPushDateTime,omitempty"`
	Board            string    `json:"board,omitempty"`
	PushSum          int       `json:"pushSum,omitempty"`
	// contains filtered or unexported fields
}

func NewArticle

func NewArticle(drive Driver) *Article

func (Article) AddSubscriber

func (a Article) AddSubscriber(account string) error

func (Article) Destroy

func (a Article) Destroy() error

func (Article) Exist

func (a Article) Exist() (bool, error)

Exist check article exist or not

func (Article) Find

func (a Article) Find(code string) Article

func (Article) MatchKeyword

func (a Article) MatchKeyword(keyword string) bool

func (Article) ParseID

func (a Article) ParseID(Link string) (id int)

func (Article) RemoveSubscriber

func (a Article) RemoveSubscriber(sub string) error

func (Article) Save

func (a Article) Save() error

func (Article) String

func (a Article) String() string

func (Article) StringWithPushSum

func (a Article) StringWithPushSum() string

func (Article) Subscribers

func (a Article) Subscribers() ([]string, error)

type Articles

type Articles []Article

func (Articles) List

func (as Articles) List() []string

func (Articles) String

func (as Articles) String() string

func (Articles) StringWithPushSum

func (as Articles) StringWithPushSum() string

type Comment

type Comment struct {
	Tag      string
	UserID   string
	Content  string
	DateTime time.Time
}

func (Comment) String

func (c Comment) String() string

type Comments

type Comments []Comment

func (Comments) String

func (cs Comments) String() string

type Driver

type Driver interface {
	Find(code string, article *Article)
	Save(a Article) error
	Delete(code string) error
}

type DynamoDB

type DynamoDB struct{}

table: code, board, content

func (DynamoDB) Delete

func (DynamoDB) Delete(code string) error

func (DynamoDB) Find

func (DynamoDB) Find(code string, a *Article)

func (DynamoDB) Save

func (DynamoDB) Save(a Article) error

type Redis

type Redis struct{}

func (Redis) Delete

func (Redis) Delete(articleCode string) error

func (Redis) Find

func (Redis) Find(code string, a *Article)

func (Redis) Save

func (Redis) Save(a Article) error

Jump to

Keyboard shortcuts

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