Documentation ¶
Index ¶
- Constants
- type IMongoMapper
- type Membership
- type MongoMapper
- func (m *MongoMapper) Delete(ctx context.Context, id string) error
- func (m *MongoMapper) FindOne(ctx context.Context, id string) (*User, error)
- func (m *MongoMapper) FindOneNoCache(ctx context.Context, id string) (*User, error)
- func (m *MongoMapper) Insert(ctx context.Context, data *User) error
- func (m *MongoMapper) Update(ctx context.Context, data *User) error
- func (m *MongoMapper) UpsertUser(ctx context.Context, data *User) error
- type StorageInfo
- type User
- type UserPreview
Constants ¶
View Source
const (
CollectionName = "user"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IMongoMapper ¶
type IMongoMapper interface { Insert(ctx context.Context, data *User) error FindOne(ctx context.Context, id string) (*User, error) Update(ctx context.Context, data *User) error Delete(ctx context.Context, id string) error UpsertUser(ctx context.Context, data *User) error FindOneNoCache(ctx context.Context, id string) (*User, error) }
IMongoMapper is an interface to be customized, add more methods here, and implement the added methods in MongoMapper.
func NewMongoMapper ¶
func NewMongoMapper(config *config.Config) IMongoMapper
type Membership ¶
type MongoMapper ¶
type MongoMapper struct {
// contains filtered or unexported fields
}
func (*MongoMapper) FindOneNoCache ¶
func (*MongoMapper) UpsertUser ¶
func (m *MongoMapper) UpsertUser(ctx context.Context, data *User) error
type StorageInfo ¶
type StorageInfo struct { AvailablePhotos int32 `bson:"availablePhotos,omitempty" json:"availablePhotos,omitempty"` UsedPhotos int32 `bson:"usedPhotos,omitempty" json:"usedPhotos,omitempty"` AvailableMemory int64 `bson:"availableMemory,omitempty" json:"availableMemory,omitempty"` UsedMemory int64 `bson:"usedMemory,omitempty" json:"usedMemory,omitempty"` AvailableAlbums int32 `bson:"availableAlbums,omitempty" json:"availableAlbums,omitempty"` UsedAlbums int32 `bson:"usedAlbums,omitempty" json:"usedAlbums,omitempty"` }
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` Nickname string `bson:"username,omitempty" json:"username,omitempty"` Bio string `bson:"bio,omitempty" json:"bio,omitempty"` Avatar string `bson:"avatar,omitempty" json:"avatar,omitempty"` UpdatedAt time.Time `bson:"updatedAt,omitempty" json:"updatedAt,omitempty"` CreatedAt time.Time `bson:"createdAt,omitempty" json:"createdAt,omitempty"` DeletedAt time.Time `bson:"deletedAt,omitempty" json:"deletedAt,omitempty"` Membership *Membership `bson:"membership,omitempty" json:"membership,omitempty"` TeamCount int32 `bson:"teamCount,omitempty" json:"teamCount,omitempty"` TeamIds []string `bson:"teamIds,omitempty" json:"teamIds,omitempty"` MyAlbumCount int32 `bson:"myAlbumCount,omitempty" json:"myAlbumCount,omitempty"` MyAlbumIds []int32 `bson:"myAlbumIds,omitempty" json:"myAlbumIds,omitempty"` FollowedAlbumCount int32 `bson:"followedAlbumCount,omitempty" json:"followedAlbumCount,omitempty"` FollowedAlbumIds []int32 `bson:"followedAlbumIds,omitempty" json:"followedAlbumIds,omitempty"` StorageInfo *StorageInfo `bson:"storageInfo,omitempty" json:"storageInfo,omitempty"` Points int32 `bson:"points,omitempty" json:"points,omitempty"` Achievements []string `bson:"achievements,omitempty" json:"achievements,omitempty"` }
Click to show internal directories.
Click to hide internal directories.