Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //StoryDraftStatus provide a uniform way to use draft status instead of literal string StoryDraftStatus = "Draft" //StoryDeletedStatus provide a uniform way to use deleted status instead of literal string StoryDeletedStatus = "Deleted" //StoryPublishStatus provide a uniform way to use publish status instead of literal string StoryPublishStatus = "Publish" )
Functions ¶
Types ¶
type CacheKeyBuilder ¶
type CacheKeyBuilder interface {
BuildKey(obj interface{}) string
}
type CacheService ¶
type PagingOptions ¶
PagingOptions is a struct used as pagination option to get entities
type Story ¶
type Story struct {
ID int
Media json.RawMessage
Title string
Slug string
Excerpt string
Content string
Reporter string
Editor string
Author string
Status string
Topics Topics
// stats
Likes int
Views int
CreatedAt time.Time
UpdatedAt time.Time
}
Story is domain entity
type StoryFilterOptions ¶
StoryFilterOptions struct used as parameter to filter story by status and its topic
type StoryRepository ¶
type StoryRepository interface {
Find(id int) (Story, error)
FindBySlug(slug string) (Story, error)
FindByStatus(status string, option PagingOptions) (stories Stories, storiesCount int, err error)
FindByTopicAndStatus(topic int, status string, option PagingOptions) (stories Stories, storiesCount int, err error)
All(option PagingOptions) (stories Stories, storiesCount int, err error)
Insert(story Story) (createdStory Story, err error)
Update(story Story) (updatedStory Story, err error)
Delete(id int) error
}
StoryRepository provide an interface to get story entities
type TopicRepository ¶
type TopicRepository interface {
Find(id int) (Topic, error)
FindBySlug(slug string) (Topic, error)
All(option PagingOptions) (topics Topics, topicsCount int, err error)
Insert(topic Topic) (createdTopic Topic, err error)
Update(topic Topic) (updatedTopic Topic, err error)
Delete(id int) error
}
TopicRepository provide an interface to get topic entities
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
server
command
|
|
|
script
|
|
|
generate_access_token
command
|
|
|
run_migration
command
|
|
|
storage
|
|
Click to show internal directories.
Click to hide internal directories.