Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrVideoNotFound = errors.New("video not found")
)
Functions ¶
func NewMongoVideoDAO ¶
func NewMongoVideoDAO(collection *mongo.Collection) *mongoVideoDAO
func NewRedisVideoDAO ¶
func NewRedisVideoDAO(client *rediskit.RedisClient, baseDAO VideoDAO) *redisVideoDAO
Types ¶
type Video ¶
type Video struct { ID primitive.ObjectID `bson:"_id,omitempty"` Width uint32 `bson:"width,omitempty"` Height uint32 `bson:"height,omitempty"` Size uint64 `bson:"size,omitempty"` Duration float64 `bson:"duration,omitempty"` URL string `bson:"url,omitempty"` Status VideoStatus `bson:"status,omitempty"` Variants map[string]string `bson:"variants,omitempty"` CreatedAt time.Time `bson:"created_at,omitempty"` UpdatedAt time.Time `bson:"updated_at,omitempty"` }
func NewFakeVideo ¶
func NewFakeVideo() *Video
NewFakeVideo returns a fake video instance with random id that is useful for testing
type VideoDAO ¶
type VideoDAO interface { Get(ctx context.Context, id primitive.ObjectID) (*Video, error) List(ctx context.Context, limit, skip int64) ([]*Video, error) Create(ctx context.Context, video *Video) error Update(ctx context.Context, video *Video) error UpdateVariant(ctx context.Context, id primitive.ObjectID, variant string, url string) error Delete(ctx context.Context, id primitive.ObjectID) error }
type VideoStatus ¶
type VideoStatus string
const ( VideoStatusUploaded VideoStatus = "uploaded" VideoStatusEncoding VideoStatus = "encoding" VideoStatusFailed VideoStatus = "failed" VideoStatusSuccess VideoStatus = "success" )
func (VideoStatus) String ¶
func (s VideoStatus) String() string
Click to show internal directories.
Click to hide internal directories.