Documentation ¶
Index ¶
- Constants
- type Album
- type Cat
- type IMongoMapper
- type MongoMapper
- func (m *MongoMapper) Delete(ctx context.Context, id string) error
- func (m *MongoMapper) FindMany(ctx context.Context, skip int64, count int64) ([]*Album, int64, error)
- func (m *MongoMapper) FindManyByCreatorId(ctx context.Context, creatorId string, skip int64, count int64) ([]*Album, int64, error)
- func (m *MongoMapper) FindOne(ctx context.Context, id string) (*Album, error)
- func (m *MongoMapper) FindOneNoCache(ctx context.Context, id string) (*Album, error)
- func (m *MongoMapper) Insert(ctx context.Context, data *Album) error
- func (m *MongoMapper) Upsert(ctx context.Context, data *Album) error
Constants ¶
View Source
const (
CollectionName = "user"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Album ¶
type Album struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` OwnerType int32 `bson:"type,omitempty" json:"type,omitempty"` CreatorId string `bson:"creatorId,omitempty" json:"creatorId,omitempty"` AlbumName string `bson:"albumName,omitempty" json:"albumName,omitempty"` Visibility int32 `bson:"visibility,omitempty" json:"visibility,omitempty"` TotalPhotos int32 `bson:"totalPhotos,omitempty" json:"totalPhotos,omitempty"` AvailablePhotos int32 `bson:"availablePhotos,omitempty" json:"availablePhotos,omitempty"` UpdatedAt time.Time `bson:"updatedAt,omitempty" json:"updatedAt,omitempty"` DeletedAt time.Time `bson:"deletedAt,omitempty" json:"deletedAt,omitempty"` CreatedAt time.Time `bson:"createdAt,omitempty" json:"createdAt,omitempty"` CreatedLocation string `bson:"createdLocation,omitempty" json:"createdLocation,omitempty"` CreatedLocationLongitude float64 `bson:"createdLocationLongitude,omitempty" json:"createdLocationLongitude,omitempty"` CreatedLocationLatitude float64 `bson:"createdLocationLatitude,omitempty" json:"createdLocationLatitude,omitempty"` CatInfo *Cat `bson:"catInfo,omitempty" json:"catInfo,omitempty"` }
type IMongoMapper ¶
type IMongoMapper interface { Insert(ctx context.Context, data *Album) error FindOne(ctx context.Context, id string) (*Album, error) Upsert(ctx context.Context, data *Album) error Delete(ctx context.Context, id string) error FindOneNoCache(ctx context.Context, id string) (*Album, error) FindMany(ctx context.Context, skip int64, count int64) ([]*Album, int64, error) FindManyByCreatorId(ctx context.Context, creatorId string, skip int64, count int64) ([]*Album, int64, 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 MongoMapper ¶
type MongoMapper struct {
// contains filtered or unexported fields
}
func (*MongoMapper) FindManyByCreatorId ¶
func (*MongoMapper) FindOneNoCache ¶
Click to show internal directories.
Click to hide internal directories.