mongo

package
v0.0.0-...-9a83fbb Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const FollowCollectionName = "follow"
View Source
const IdCollectionName = "id"
View Source
const InterestsCollectionName = "interests"
View Source
const Q11eCollectionName = "q11e"
View Source
const ResumeCollectionName = "resume"

Variables

This section is empty.

Functions

func AddMongoClient

func AddMongoClient(builder *app.AppBuilder)

func AddRepositories

func AddRepositories(builder *app.AppBuilder)

func MongoStore

func MongoStore(builder *app.AppBuilder)

func NewMongoFollowRepository

func NewMongoFollowRepository(c *di.Container) *hackathon.FollowRepository

func NewMongoIdRepository

func NewMongoIdRepository(c *di.Container) *hackathon.IdRepository

func NewMongoInterestRepository

func NewMongoInterestRepository(c *di.Container) *interest.Repository

func NewMongoProjectRepository

func NewMongoProjectRepository(c *di.Container) *resume.ProjectRepository

func NewMongoQ11eRepository

func NewMongoQ11eRepository(c *di.Container) *hackathon.Q11eRepository

func NewMongoResumeRepository

func NewMongoResumeRepository(c *di.Container) *hackathon.ResumeRepository

func NewMongoRoleRepository

func NewMongoRoleRepository(c *di.Container) *resume.RoleRepository

func NewMongoUserRecommendRepository

func NewMongoUserRecommendRepository(c *di.Container) *hackathon.UserRecommendationRepository

func NewMongoUserRepository

func NewMongoUserRepository(c *di.Container) *identity2.UserRepository

Types

type MongoFollowRepository

type MongoFollowRepository struct {
	*MongoRepositoryBase[hackathon.Follow]
}

func (*MongoFollowRepository) CheckExistsByToAndFromAddr

func (r *MongoFollowRepository) CheckExistsByToAndFromAddr(ctx context.Context, fromUser primitive.ObjectID, toUser primitive.ObjectID) bool

func (*MongoFollowRepository) CheckIsFollowing

func (r *MongoFollowRepository) CheckIsFollowing(ctx context.Context, userId primitive.ObjectID, ids []primitive.ObjectID) map[primitive.ObjectID]bool

func (*MongoFollowRepository) CountUsers

func (r *MongoFollowRepository) CountUsers(ctx context.Context, userIds []primitive.ObjectID, isTo bool) map[primitive.ObjectID]int

func (*MongoFollowRepository) DeleteByToAndFrom

func (r *MongoFollowRepository) DeleteByToAndFrom(ctx context.Context, fromUser primitive.ObjectID, toUser primitive.ObjectID) bool

func (*MongoFollowRepository) GetFollowerCount

func (r *MongoFollowRepository) GetFollowerCount(ctx context.Context, userIds []primitive.ObjectID) map[primitive.ObjectID]int

func (*MongoFollowRepository) GetFollowingCount

func (r *MongoFollowRepository) GetFollowingCount(ctx context.Context, userIds []primitive.ObjectID) map[primitive.ObjectID]int

GetFollowingCount 获取关注数

func (*MongoFollowRepository) GetFollowingUsers

func (r *MongoFollowRepository) GetFollowingUsers(ctx context.Context, userId primitive.ObjectID) []primitive.ObjectID

func (*MongoFollowRepository) GetListByFilter

func (r *MongoFollowRepository) GetListByFilter(ctx context.Context, userId primitive.ObjectID, key string) []hackathon.Follow

type MongoIdRepository

type MongoIdRepository struct {
	*MongoRepositoryBase[hackathon.Id]
}

func (*MongoIdRepository) CheckAddrs

func (r *MongoIdRepository) CheckAddrs(ctx context.Context, addrs []string) []string

func (*MongoIdRepository) CheckExistsByAddrBaseAddrAndPltfm

func (r *MongoIdRepository) CheckExistsByAddrBaseAddrAndPltfm(ctx context.Context, address string, baseAddr string, platform hackathon.PlatformType) bool

func (*MongoIdRepository) GetListByAddress

func (r *MongoIdRepository) GetListByAddress(ctx context.Context, address string) []hackathon.Id

func (*MongoIdRepository) GetListByBaseAddr

func (r *MongoIdRepository) GetListByBaseAddr(ctx context.Context, baseAddr string) []hackathon.Id

func (*MongoIdRepository) GetTen

func (r *MongoIdRepository) GetTen(ctx context.Context) []hackathon.Id

type MongoInterestRepository

type MongoInterestRepository struct {
	*MongoRepositoryBase[interest.Interest]
}

func (*MongoInterestRepository) CheckMany

func (r *MongoInterestRepository) CheckMany(ctx context.Context, userIds []primitive.ObjectID, targetId []string, targetType string) []interest.Interest

func (*MongoInterestRepository) DeleteBy

func (r *MongoInterestRepository) DeleteBy(ctx context.Context, address primitive.ObjectID, targetId, targetType string) int

func (*MongoInterestRepository) GetManyByUsers

func (r *MongoInterestRepository) GetManyByUsers(ctx context.Context, users []primitive.ObjectID, targetType string) []interest.Interest

func (*MongoInterestRepository) GetUsers

func (r *MongoInterestRepository) GetUsers(ctx context.Context, targetId []string, targetType string) []interest.Interest

func (*MongoInterestRepository) SetInterest

func (r *MongoInterestRepository) SetInterest(ctx context.Context, ins *interest.Interest) int

type MongoQ11eRepository

type MongoQ11eRepository struct {
	*MongoRepositoryBase[hackathon.Q11e]
}

func (*MongoQ11eRepository) CheckAndGetExistsByUser

func (r *MongoQ11eRepository) CheckAndGetExistsByUser(ctx context.Context, userId primitive.ObjectID) (bool, *hackathon.Q11e)

func (*MongoQ11eRepository) GetByUserId

func (r *MongoQ11eRepository) GetByUserId(ctx context.Context, userId primitive.ObjectID) *hackathon.Q11e

func (*MongoQ11eRepository) GetManyByUsers

func (r *MongoQ11eRepository) GetManyByUsers(ctx context.Context, userIds []primitive.ObjectID) []hackathon.Q11e

type MongoRepositoryBase

type MongoRepositoryBase[TEntity any] struct {
	Options        *mongodb.MongoOptions
	CollectionName string
}

func MongoRepositoryResolver

func MongoRepositoryResolver[TEntity any](collectionName string) *MongoRepositoryBase[TEntity]

func NewMongoRepositoryBase

func NewMongoRepositoryBase[TEntiy any](collectionName string) *MongoRepositoryBase[TEntiy]

func (*MongoRepositoryBase[TEntity]) Collection

func (mr *MongoRepositoryBase[TEntity]) Collection(ctx context.Context) *mongodb.Collection[TEntity]

func (*MongoRepositoryBase[TEntity]) Count

func (mr *MongoRepositoryBase[TEntity]) Count(ctx context.Context) int64

Count count

func (*MongoRepositoryBase[TEntity]) Delete

func (mr *MongoRepositoryBase[TEntity]) Delete(ctx context.Context, id primitive.ObjectID) int

func (*MongoRepositoryBase[TEntity]) DeleteMany

func (mr *MongoRepositoryBase[TEntity]) DeleteMany(ctx context.Context, ids []primitive.ObjectID) int

func (*MongoRepositoryBase[TEntity]) Exists

func (mr *MongoRepositoryBase[TEntity]) Exists(ctx context.Context, id primitive.ObjectID) bool

func (*MongoRepositoryBase[TEntity]) ExistsByField

func (mr *MongoRepositoryBase[TEntity]) ExistsByField(ctx context.Context, field string, v any) bool

func (*MongoRepositoryBase[TEntity]) FilterCount

func (mr *MongoRepositoryBase[TEntity]) FilterCount(ctx context.Context, filter bson.D) int64

FilterCount count

func (*MongoRepositoryBase[TEntity]) Find

func (mr *MongoRepositoryBase[TEntity]) Find(ctx context.Context, filter bson.D, opts ...*options.FindOptions) []TEntity

func (*MongoRepositoryBase[TEntity]) FindByRegex

func (mr *MongoRepositoryBase[TEntity]) FindByRegex(ctx context.Context, field, regex string, p *x.PageAndSort) []TEntity

FindByRegex 通过string类型字段进行字符串匹配

func (*MongoRepositoryBase[TEntity]) FindOne

func (mr *MongoRepositoryBase[TEntity]) FindOne(ctx context.Context, filter bson.D, opts ...*options.FindOneOptions) *TEntity

func (*MongoRepositoryBase[TEntity]) FirstOrDefault

func (mr *MongoRepositoryBase[TEntity]) FirstOrDefault(ctx context.Context, id primitive.ObjectID) *TEntity

func (*MongoRepositoryBase[TEntity]) Get

func (mr *MongoRepositoryBase[TEntity]) Get(ctx context.Context, id primitive.ObjectID) *TEntity

func (*MongoRepositoryBase[TEntity]) GetAll

func (mr *MongoRepositoryBase[TEntity]) GetAll(ctx context.Context) []TEntity

func (*MongoRepositoryBase[TEntity]) GetCollection

func (mr *MongoRepositoryBase[TEntity]) GetCollection(ctx context.Context, name string) *mongo.Collection

func (*MongoRepositoryBase[TEntity]) GetList

func (mr *MongoRepositoryBase[TEntity]) GetList(ctx context.Context, filter bson.D, page int64, pageSize int64, opt *options.FindOptions) ([]TEntity, int64)

func (*MongoRepositoryBase[TEntity]) GetMany

func (mr *MongoRepositoryBase[TEntity]) GetMany(ctx context.Context, ids []primitive.ObjectID) []TEntity

func (*MongoRepositoryBase[TEntity]) GetPagedList

func (mr *MongoRepositoryBase[TEntity]) GetPagedList(ctx context.Context, p *x.PageAndSort) ([]TEntity, int64)

func (*MongoRepositoryBase[TEntity]) Insert

func (mr *MongoRepositoryBase[TEntity]) Insert(ctx context.Context, entity *TEntity) primitive.ObjectID

func (*MongoRepositoryBase[TEntity]) InsertMany

func (mr *MongoRepositoryBase[TEntity]) InsertMany(ctx context.Context, entitis []TEntity, ignoreErr bool) []primitive.ObjectID

func (*MongoRepositoryBase[TEntiy]) MaxOrder

func (mr *MongoRepositoryBase[TEntiy]) MaxOrder(ctx context.Context, field string, v any) float64

func (*MongoRepositoryBase[TEntity]) MaxOrderMany

func (mr *MongoRepositoryBase[TEntity]) MaxOrderMany(ctx context.Context, field string, v any) map[any]float64

func (*MongoRepositoryBase[TEntity]) ParseSort

func (mr *MongoRepositoryBase[TEntity]) ParseSort(p *x.PageAndSort) bson.D

func (*MongoRepositoryBase[TEntity]) Set

func (mr *MongoRepositoryBase[TEntity]) Set(ctx context.Context, id primitive.ObjectID, enitty *TEntity) int

func (*MongoRepositoryBase[TEntity]) Update

func (mr *MongoRepositoryBase[TEntity]) Update(ctx context.Context, id primitive.ObjectID, entity *TEntity) int

func (*MongoRepositoryBase[TEntity]) UpsertByField

func (mr *MongoRepositoryBase[TEntity]) UpsertByField(ctx context.Context, field string, fieldValue any, newObj *TEntity) primitive.ObjectID

Upsert By Field

type MongoResumeProjectRepository

type MongoResumeProjectRepository struct {
	*MongoRepositoryBase[resume.Project]
}

type MongoResumeRepository

type MongoResumeRepository struct {
	*MongoRepositoryBase[hackathon.Resume]
}

func (*MongoResumeRepository) CheckExists

func (r *MongoResumeRepository) CheckExists(ctx context.Context, userId primitive.ObjectID) bool

func (*MongoResumeRepository) GetByUserId

type MongoResumeRoleRepository

type MongoResumeRoleRepository struct {
	*MongoRepositoryBase[resume.Role]
}

type MongoTransactionContext

type MongoTransactionContext struct {
	// contains filtered or unexported fields
}

func NewMongoTransactionContext

func NewMongoTransactionContext(ctx mongo.SessionContext) MongoTransactionContext

type MongoUserRecommendRepository

type MongoUserRecommendRepository struct {
	*MongoRepositoryBase[hackathon.UserRecommendation]
}

func (*MongoUserRecommendRepository) GetUsers

type MongoUserRepository

type MongoUserRepository struct {
	*MongoRepositoryBase[identity2.User]
}

func (*MongoUserRepository) Find

func (*MongoUserRepository) GetManyByAddr

func (m *MongoUserRepository) GetManyByAddr(ctx context.Context, addresses []common.Address) []identity2.User

func (*MongoUserRepository) GetManyPlatforms

func (m *MongoUserRepository) GetManyPlatforms(ctx context.Context, userIds []primitive.ObjectID) []identity2.UserPlatform

func (*MongoUserRepository) GetPlatforms

func (*MongoUserRepository) GetUsers

func (*MongoUserRepository) LinkPlatform

func (m *MongoUserRepository) LinkPlatform(ctx context.Context, p *identity2.UserPlatform)

func (*MongoUserRepository) UnlinkPlatform

func (m *MongoUserRepository) UnlinkPlatform(ctx context.Context, userId primitive.ObjectID, address common.Address, handle string, platform identity2.UserPlatformType) int

Jump to

Keyboard shortcuts

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