user

package
v0.0.0-...-efe2576 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2024 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

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 Cat

type Cat struct {
	CoverUrl  string    `bson:"coverUrl,omitempty" json:"coverUrl,omitempty"`
	Color     string    `bson:"color,omitempty" json:"color,omitempty"`
	Gender    string    `bson:"gender,omitempty" json:"gender,omitempty"`
	BirthDate time.Time `bson:"birthDate,omitempty" json:"birthDate,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) Delete

func (m *MongoMapper) Delete(ctx context.Context, id string) error

func (*MongoMapper) FindMany

func (m *MongoMapper) FindMany(ctx context.Context, skip int64, count int64) ([]*Album, int64, error)

func (*MongoMapper) FindManyByCreatorId

func (m *MongoMapper) FindManyByCreatorId(ctx context.Context, creatorId string, skip int64, count int64) ([]*Album, int64, error)

func (*MongoMapper) FindOne

func (m *MongoMapper) FindOne(ctx context.Context, id string) (*Album, error)

func (*MongoMapper) FindOneNoCache

func (m *MongoMapper) FindOneNoCache(ctx context.Context, id string) (*Album, error)

func (*MongoMapper) Insert

func (m *MongoMapper) Insert(ctx context.Context, data *Album) error

func (*MongoMapper) Upsert

func (m *MongoMapper) Upsert(ctx context.Context, data *Album) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL