Documentation ¶
Index ¶
- Variables
- func Init() error
- type Comment
- type CommentsStore
- type CreateCommentOptions
- type CreateStatisticOptions
- type CreateVideoOptions
- type ListVideoOptions
- type Member
- type MembersStore
- type Statistic
- type StatisticsStore
- type UpdateVideoOptions
- type UpsertMemberOptions
- type Video
- type VideoStatus
- type VideoURL
- type VideoURLsStore
- type VideosStore
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCommentExists = errors.New("comment exists")
View Source
var ErrMemberNotFound = errors.New("member dose not exist")
View Source
var ErrVideoExists = errors.New("duplicate video")
View Source
var ErrVideoNotFound = errors.New("video dose not exist")
View Source
var ErrVideoURLExists = errors.New("duplicate video url")
Functions ¶
Types ¶
type Comment ¶
type Comment struct { Cid string `db:"cid" json:"cid"` VideoID string `db:"video_id" json:"video_id"` DiggCount int64 `db:"digg_count" json:"digg_count"` Text string `db:"text" json:"text"` TextClean string `db:"text_clean" json:"text_clean"` TextExtra json.RawMessage `db:"text_extra" json:"text_extra"` UserNickname string `db:"user_nickname" json:"user_nickname"` UserAvatarURI string `db:"user_avatar_uri" json:"user_avatar_uri"` UserSecUID string `db:"user_sec_uid" json:"user_sec_uid"` CreatedAt time.Time `db:"created_at" json:"created_at"` }
type CommentsStore ¶
type CommentsStore interface { // Create creates a new comment with the given options. // If the comment already exists, it returns ErrCommentExists. Create(ctx context.Context, cid string, opts CreateCommentOptions) error }
var Comments CommentsStore
func NewCommentsStore ¶
func NewCommentsStore(db sqlbuilder.Database) CommentsStore
type CreateCommentOptions ¶
type CreateStatisticOptions ¶
type CreateVideoOptions ¶
type ListVideoOptions ¶
type Member ¶
type Member struct { SecUID model.MemberSecUID `db:"sec_uid" json:"sec_uid"` UID string `db:"uid" json:"uid"` UniqueID string `db:"unique_id" json:"unique_id"` ShortUID string `db:"short_id" json:"short_uid"` Name string `db:"name" json:"name"` AvatarURL string `db:"avatar_url" json:"avatar_url"` Signature string `db:"signature" json:"signature"` }
type MembersStore ¶
type MembersStore interface { // Upsert creates a new member profile record with the given options, // it updates the `name` `avatar_url` `signature` field if the member is exists. Upsert(ctx context.Context, opts UpsertMemberOptions) error // GetBySecID returns the latest member profile with the given SecUID. GetBySecID(ctx context.Context, secUID model.MemberSecUID) (*Member, error) // GetBySecIDs returns the members' profile with the given SecUIDs. // It will be ignored if the member does not exist. GetBySecIDs(ctx context.Context, secUIDs ...model.MemberSecUID) ([]*Member, error) // List returns all the members. List(ctx context.Context) ([]*Member, error) }
var Members MembersStore
func NewMembersStore ¶
func NewMembersStore(db sqlbuilder.Database) MembersStore
type StatisticsStore ¶
type StatisticsStore interface { // Create creates a new statistic record with the given options. Create(ctx context.Context, id string, opts CreateStatisticOptions) error }
var Statistics StatisticsStore
func NewStatisticsStore ¶
func NewStatisticsStore(db sqlbuilder.Database) StatisticsStore
type UpdateVideoOptions ¶
type UpsertMemberOptions ¶
type Video ¶
type Video struct { ID string `db:"id" json:"id"` VID string `db:"vid" json:"vid"` AuthorSecUID model.MemberSecUID `db:"author_sec_id" json:"author_sec_uid"` Author *Member `db:",inline" json:"author"` Statistic model.Statistic `db:",inline" json:"statistic"` Description string `db:"description" json:"description"` TextExtra []string `db:"text_extra" json:"text_extra"` OriginCoverURLs []string `db:"origin_cover_urls" json:"origin_cover_urls"` DynamicCoverURLs []string `db:"dynamic_cover_urls" json:"dynamic_cover_urls"` IsDynamicCover bool `db:"is_dynamic_cover" json:"is_dynamic_cover"` FacePoints *dbutil.JSON `db:"face_points" json:"face_points"` CoverHeight int `db:"cover_height" json:"cover_height"` CoverWidth int `db:"cover_width" json:"cover_width"` VideoHeight int `db:"video_height" json:"video_height"` VideoWidth int `db:"video_width" json:"video_width"` VideoDuration int64 `db:"video_duration" json:"video_duration"` VideoRatio string `db:"video_ratio" json:"video_ratio"` CreatedAt time.Time `db:"created_at" json:"created_at"` }
type VideoURLsStore ¶
type VideoURLsStore interface { // Create creates a new video url with the given video ID and url. Create(ctx context.Context, videoID, url string) error // GetByVideoID returns the available video urls with the given video ID. GetByVideoID(ctx context.Context, videoID string) ([]string, error) // GetAvailableVideoURLs returns all the available video urls. GetAvailableVideoURLs(ctx context.Context) ([]string, error) // SetStatus set the video url status. SetStatus(ctx context.Context, videoURL string, status VideoStatus) error }
var VideoURLs VideoURLsStore
func NewVideoURLsStore ¶
func NewVideoURLsStore(db sqlbuilder.Database) VideoURLsStore
type VideosStore ¶
type VideosStore interface { // Create creates a new video record with the given options. Create(ctx context.Context, id string, opts CreateVideoOptions) error // Update updates the video with the given options. Update(ctx context.Context, id string, opts UpdateVideoOptions) error // GetByID returns video with the given id, it returns `ErrVideoNotFound` error if video does not exist. GetByID(ctx context.Context, id string) (*Video, error) // List returns the video list. List(ctx context.Context, opts ListVideoOptions) ([]*Video, error) // ListIDs returns all the video IDs. ListIDs(ctx context.Context) ([]string, error) // Random returns a video randomly. Random(ctx context.Context) (*Video, error) // Refresh refreshes the materialized view. Refresh(ctx context.Context) error }
var Videos VideosStore
func NewVideosStore ¶
func NewVideosStore(db sqlbuilder.Database) VideosStore
Click to show internal directories.
Click to hide internal directories.