Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultPageTTL time.Duration = 24 * time.Hour
)
Variables ¶
View Source
var ( ErrInvalidUserID = errors.New(errors.BadRequest, "userID should be greater than 0") ErrInvalidListKey = errors.New(errors.BadRequest, "listKey can not be empty") ErrListAlreadyExists = errors.New(errors.ResourceAlreadyExist, "list already exist") ErrListNotFound = errors.New(errors.ResourceNotFound, "list not found") ErrInternal = errors.New(errors.Internal, "Internal Server Error") ErrPageNotFound = errors.New(errors.ResourceNotFound, "page not found") )
Errors defined by our domain
Functions ¶
This section is empty.
Types ¶
type ListKey ¶
type ListKey string
func GenerateListKeyByUserID ¶
GenerateListKeyByUserID generates pageList (sorted set) redis key by listKey, userID, and have format pageList:{<listKey>:<userID>}
type Page ¶
type Page struct { Key PageKey `json:"key"` Content string `json:"content"` Next PageKey `json:"next"` }
func (*Page) GetJSONContent ¶
func (*Page) SetContent ¶
type PageMetaKey ¶
type PageMetaKey string
func GenerateListMetaKeyByUserID ¶
func GenerateListMetaKeyByUserID(listKey ListKey, userID int64) PageMetaKey
GenerateListKeyByUserID generates pageList (sorted set) redis key by listKey, userID, and have format pageList:{<listKey>:<userID>}
type PageRepo ¶
type PageRepo interface { GetPage(ctx context.Context, uesrID int64, listKey ListKey, pageKey PageKey) (Page, error) GetHead(ctx context.Context, userID int64, listKey ListKey) (PageKey, error) SetPage(ctx context.Context, userID int64, listkey ListKey, page Page) (PageKey, error) NewList(ctx context.Context, userID int64, listKey ListKey) error }
type PageUsecase ¶
type PageUsecase interface { GetPage(ctx context.Context, userID int64, listKey ListKey, pageKey PageKey) (Page, error) GetHead(ctx context.Context, userID int64, listKey ListKey) (PageKey, error) SetPage(ctx context.Context, userID int64, listKey ListKey, page Page) (PageKey, error) NewList(ctx context.Context, userID int64, listKey ListKey) error }
Click to show internal directories.
Click to hide internal directories.