common_mongo

package
v0.0.0-...-a9ce3c6 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChatroomCollection *mongo.Collection

Collections: Add your collection global var here

View Source
var UserCollection *mongo.Collection

Functions

func ChangeChatroomOwner

func ChangeChatroomOwner(newOwnerId string, chatroomId string) error

func DeleteOneChatroomCollection

func DeleteOneChatroomCollection(chatroomID string) error

func FindOneChatroomCollection

func FindOneChatroomCollection(chatroomID string) (*models.Chatroom, error)

func FindOneUserCollection

func FindOneUserCollection(id string) (*models.UserMongo, error)

func InsertOneChatroomCollection

func InsertOneChatroomCollection(chatroomMongo models.Chatroom) (*mongo.InsertOneResult, error)

func InsertOneUserCollection

func InsertOneUserCollection(user_mongo models.UserMongo) (*mongo.InsertOneResult, error)

func IsChatroomOwner

func IsChatroomOwner(userID string, chatroomID string) (bool, error)

func PopChatroomInUserCollection

func PopChatroomInUserCollection(userID string, chatroomID string) error

func PopUserInChatroomCollection

func PopUserInChatroomCollection(userID string, chatroomID string) error

func SetupMongoDB

func SetupMongoDB() error

Types

type MongoEntity

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

func (*MongoEntity) CheckConnectivity

func (collection *MongoEntity) CheckConnectivity() error

func (*MongoEntity) ORMFindOneById

func (collection *MongoEntity) ORMFindOneById(id interface{}) (*mongo.SingleResult, error)

func (*MongoEntity) ORMInsertOne

func (collection *MongoEntity) ORMInsertOne(document interface{}) (*mongo.InsertOneResult, error)

type MongoORM

type MongoORM interface {
	ORMInsertOne(document interface{}) (*mongo.InsertOneResult, error)
	ORMFindOneById(id interface{}) (*mongo.SingleResult, error)
	CheckConnectivity() error
}

Jump to

Keyboard shortcuts

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