Versions in this module Expand all Collapse all v1 v1.1.3 Feb 13, 2023 v1.1.2 Sep 5, 2022 v1.1.1 Sep 5, 2022 Changes in this version + var ErrAKTokenEmpty = CustomError("ErrFbTokenEmpty", "AccountKit token cannot be empty") + var ErrAccessTokenInactivated = CustomError("ErrAccessTokenInactivated", "access token is disabled") + var ErrAccessTokenInvalid = CustomError("ErrAccessTokenInvalid", "invalid access token") + var ErrActionTwice = CustomError("ErrActionTwice", "you have done before") + var ErrAppleTokenEmpty = CustomError("ErrAppleTokenEmpty", "apple token cannot be empty") + var ErrCannotCreateRoom = CustomError("ErrCannotCreateRoom", "cannot create room") + var ErrCannotCreateUser = CustomError("ErrCannotCreateUser", "cannot create new user") + var ErrCannotCreateUserTopic = CustomError("ErrCannotCreateUserTopic", "cannot create user topic") + var ErrCannotDislikeUser = CustomError("ErrCannotDislikeUser", "cannot dislike user") + var ErrCannotDoYourself = CustomError("ErrCannotDoYourself", "cannot action on yourself") + var ErrCannotFetchData = func(err error) AppError + var ErrCannotLikeUser = CustomError("ErrCannotLikeUser", "cannot like user") + var ErrCannotLoginWithApple = CustomError("ErrCannotLoginWithApple", "cannot login with Apple") + var ErrCannotLoginWithFB = CustomError("ErrCannotLoginWithFB", "cannot login with Facebook") + var ErrCannotProcessImage = CustomError("ErrCannotProcessImage", "cannot process image") + var ErrCannotUpdateData = CustomError("ErrCannotUpdateData", "cannot update data") + var ErrCannotUploadImage = CustomError("ErrCannotUploadImage", "cannot upload image") + var ErrCreateEmptyRoom = CustomError("ErrCreateEmptyRoom", "you cannot create an empty room") + var ErrCreateRoomWithYourself = CustomError("ErrCreateRoomWithYourself", "you cannot create room has yourself") + var ErrCreateUserDeviceToken = CustomError("ErrCreateUserDeviceToken", "cannot create user device token") + var ErrCustom = func(root error, err ErrorWithKey) AppError + var ErrDB = func(err error) AppError + var ErrDataNotFound = errors.New("data not found") + var ErrDeleteUserDeviceToken = CustomError("ErrDeleteUserDeviceToken", "cannot delete user device token") + var ErrFbTokenEmpty = CustomError("ErrFbTokenEmpty", "facebook token cannot be empty") + var ErrFileIsNotImage = CustomError("ErrFileIsNotImage", "file is not image") + var ErrImageFileTooBig = CustomError("ErrImageFileTooBig", "image file is too big, limit 1MB") + var ErrImageIsRequired = CustomError("ErrImageIsRequired", "image file is required") + var ErrInvalidRequest = func(err error) AppError + var ErrInvalidRequestWithMessage = func(err error, message string) AppError + var ErrInvalidUserDeviceToken = CustomError("ErrInvalidUserDeviceToken", "user device token invalid") + var ErrNoPermission = CustomError("ErrNoPermission", "you don't have permission to access") + var ErrNoPermissionOnChatRoom = CustomError("ErrNoPermissionOnChatRoom", "you don't have permission on this chat room") + var ErrPasswordMinMaxLength = CustomError("ErrPasswordMinMaxLength", ...) + var ErrRequestDataInvalid = func(s string) *customError + var ErrRoomNotFound = CustomError("ErrRoomNotFound", "room not found") + var ErrTokenLength = CustomError("ErrTokenLength", "token cannot empty") + var ErrTopicNotFound = CustomError("ErrTopicNotFound", "topic not found") + var ErrUnauthorized = func(root error, err ErrorWithKey) AppError + var ErrUserNameMinMaxLength = CustomError("ErrUserNameMinMaxLength", ...) + var ErrUserNotFound = CustomError("ErrUserNotFound", "user not found or deactivated") + var ErrUsernamePasswordBlank = CustomError("ErrUsernamePasswordBlank", "username and password cannot be blank") + var ErrWithMessage = func(root error, err ErrorWithKey) AppError + var ResponseWithPaging = func(data, param interface{}, other interface{}) Response + var SimpleSuccessResponse = func(data interface{}) Response + func AllSysRoles() []string + func CurrentUser(t OAuth, u User) *currentUser + func CustomError(k, v string) *customError + func NewMongo(key string, sc SC) *mongo + func NewSQLGorm(key string, sc SC) *sqlGorm + func SetDateFormat(layout string) + func SetTimeFormat(layout string) + func SetTimeZone(zone int64) + type AppError struct + Code string + Log string + Message string + RootCause error + StatusCode int + func NewAppErr(err error, statusCode int, msg string) AppError + func (ae AppError) Error() string + func (ae AppError) RootError() error + func (ae AppError) WithCode(code string) AppError + type AudioInfo struct + BitRate string + ChannelLayout string + Channels int + Codec string + Frequency int + type ErrorWithKey interface + Key func() string + type GormManager interface + DB func() *gorm.DB + type Image struct + CloudId string + CloudName string + DominantColor string + FakeID *UID + FileName string + FileSize uint32 + ID uint32 + OriginHeight int + OriginUrl string + OriginWidth int + RequestId string + Url string + func (i *Image) Fulfill(domain string) + func (i *Image) HideSomeInfo() *Image + func (i *Image) Scan(value interface{}) error + func (i *Image) Value() (driver.Value, error) + type Images []Image + func (is *Images) Scan(value interface{}) error + func (is *Images) Value() (driver.Value, error) + type JSON []byte + func (j *JSON) MarshalJSON() ([]byte, error) + func (j *JSON) Scan(value interface{}) error + func (j *JSON) UnmarshalJSON(data []byte) error + func (j JSON) IsNull() bool + func (j JSON) Value() (driver.Value, error) + type JSONDate time.Time + func (d *JSONDate) Scan(value interface{}) error + func (d *JSONDate) UnmarshalJSON(data []byte) error + func (d *JSONDate) Value() (driver.Value, error) + func (d JSONDate) GetBSON() (interface{}, error) + func (d JSONDate) MarshalJSON() ([]byte, error) + type JSONTime time.Time + func (t *JSONTime) GetBSON() (interface{}, error) + func (t *JSONTime) Scan(value interface{}) error + func (t *JSONTime) SetBSON(raw bson.Raw) error + func (t *JSONTime) String() string + func (t *JSONTime) UnmarshalJSON(data []byte) error + func (t *JSONTime) Value() (driver.Value, error) + func (t JSONTime) MarshalJSON() ([]byte, error) + type Media struct + Audio *AudioInfo + BitRate int + CloudId string + CloudName string + DominantColor string + Duration float64 + FakeID *UID + FileName string + FileSize uint32 + Format string + FrameRate float64 + ID uint32 + OriginHeight int + OriginUrl string + OriginWidth int + RequestId string + Thumbnail *Image + Type string + Url string + Video *VideoInfo + func (i *Media) Fulfill(domain string) + func (i *Media) Scan(value interface{}) error + func (i *Media) Value() (driver.Value, error) + type Medias []Media + func (i *Medias) Scan(value interface{}) error + func (i *Medias) Value() (driver.Value, error) + type MgoManager interface + Session func() *mgo.Session + type MgoModel struct + CreatedAt *JSONTime + DeletedAt *JSONTime + PK bson.ObjectId + Status int + UpdatedAt *JSONTime + func (md *MgoModel) PrepareForInsert(status int) + type OAuth interface + OAuthID func() string + type OrderBy struct + IsDesc bool + Key string + type Paging struct + Cursor *UID + CursorIsUID bool + CursorStr string + HasNext bool + Limit int + NextCursor string + OB []OrderBy + OrderBy string + Page int + Total int + func (p *Paging) FullFill() + type Requester interface + type Response struct + Code int + Data interface{} + Paging interface{} + Param interface{} + type SC interface + MustGet func(key string) interface{} + type SQLModel struct + CreatedAt *JSONTime + FakeID UID + ID uint32 + Status *int + UpdatedAt *JSONTime + func NewSQLModelWithStatus(status int) *SQLModel + func (sm *SQLModel) GenUID(objType int, shardID uint32) *SQLModel + func (sm *SQLModel) ToID() *SQLModel + type SQLModelCreate struct + CreatedAt *JSONTime + FakeID UID + ID uint32 + Status int + UpdatedAt *JSONTime + func NewSQLModelCreateWithStatus(status int) SQLModelCreate + func (sm *SQLModelCreate) GenUID(objType int, shardID uint32) + type SystemRole int + const SysRoleAdmin + const SysRoleGuest + const SysRoleModerator + const SysRoleRoot + const SysRoleUser + func ParseSystemRole(role string) SystemRole + func (sr SystemRole) String() string + type UID struct + func DecomposeUID(s string) (UID, error) + func FromBase58(s string) (UID, error) + func NewUID(localID uint32, objType int, shardID uint32) UID + func (uid *UID) GetBSON() (interface{}, error) + func (uid *UID) Scan(value interface{}) error + func (uid *UID) SetBSON(raw bson.Raw) error + func (uid *UID) UnmarshalJSON(data []byte) error + func (uid *UID) Value() (driver.Value, error) + func (uid UID) GetLocalID() uint32 + func (uid UID) GetObjectType() int + func (uid UID) GetShardID() uint32 + func (uid UID) MarshalJSON() ([]byte, error) + func (uid UID) String() string + type User interface + GetSystemRole func() string + GetUser func() interface{} + UserID func() uint32 + type Video struct + Audio AudioInfo + BitRate int + CloudId string + CloudName string + DominantColor string + Duration float64 + FakeID *UID + FileSize uint32 + Format string + FrameRate float64 + ID uint32 + OriginHeight int + OriginUrl string + OriginWidth int + RequestId string + Url string + Video VideoInfo + func (i *Video) Fulfill(domain string) + func (i *Video) HideSomeInfo() *Video + func (i *Video) Scan(value interface{}) error + func (i *Video) Value() (driver.Value, error) + type VideoInfo struct + BitRate string + Codec string + Level int + PixFormat string + type Videos []Video + func (is *Videos) Scan(value interface{}) error + func (is *Videos) Value() (driver.Value, error)