Documentation
¶
Index ¶
- Variables
- func DeleteTokenFromMongoDB(db *mongo.Database, col string, token string) error
- func DeleteUserByID(_id primitive.ObjectID, db *mongo.Database, col string) error
- func GenerateConnote() string
- func GetAllTransaction(db *mongo.Database, col string) (data []model.Transaction)
- func GetAllUser(db *mongo.Database, col string) ([]model.User, error)
- func GetByAddress(address string, db *mongo.Database, col string) ([]model.Transaction, error)
- func GetByPhoneNumber(phone string, db *mongo.Database, col string) ([]model.Transaction, error)
- func GetByUsername(db *mongo.Database, col string, username string) (*model.User, error)
- func GetRoleByAdmin(db *mongo.Database, collection string, role string) (*model.User, error)
- func GetTransactionByConnote(connote string, db *mongo.Database, col string) ([]model.Transaction, error)
- func GetUserByID(_id primitive.ObjectID, db *mongo.Database, col string) (model.User, error)
- func InsertOneDoc(db string, collection string, doc interface{}) (insertedID interface{})
- func InsertTransaction(db *mongo.Database, col string, sender string, sender_phone string, ...) (insertedID primitive.ObjectID, connote string, err error)
- func InsertUser(db *mongo.Database, col string, name string, phone string, username string, ...) (insertedID primitive.ObjectID, err error)
- func InsertUsers(db *mongo.Database, col string, fullname string, phonenumber string, ...) (insertedID primitive.ObjectID, err error)
- func MongoConnect(dbname string) (db *mongo.Database)
- func SaveTokenToDatabase(db *mongo.Database, col string, adminID string, token string) error
- func UpdateUser(ctx context.Context, db *mongo.Database, col string, _id primitive.ObjectID, ...) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var MongoConn = atdb.MongoConnect(MongoInfo)
View Source
var MongoInfo = atdb.DBInfo{ DBString: MongoString, DBName: "Internship1", }
View Source
var MongoString string = os.Getenv("MONGOINTERN")
Functions ¶
func DeleteTokenFromMongoDB ¶
func DeleteUserByID ¶
DeleteUserByID deletes a menu item from the database by its ID
func GenerateConnote ¶
func GenerateConnote() string
func GetAllTransaction ¶
func GetAllTransaction(db *mongo.Database, col string) (data []model.Transaction)
GetAllTransaction retrieves all transaction from the database
func GetAllUser ¶
GetAllUser retrieves all users from the database
func GetByAddress ¶
GetTransactionByAddress retrieves transactions by address GetTransactionByAddress retrieves transactions by address (sender or receiver) using regex search
func GetByPhoneNumber ¶
GetTransactionByPhoneNumber retrieves transactions by phone number
func GetByUsername ¶
func GetRoleByAdmin ¶
func GetTransactionByConnote ¶
func GetTransactionByConnote(connote string, db *mongo.Database, col string) ([]model.Transaction, error)
GetTransactionByConnote retrieves transactions by consignment note
func GetUserByID ¶
FUNCTION USER GetUserByID retrieves a user from the database by its ID
func InsertOneDoc ¶
func InsertTransaction ¶
func InsertUser ¶
func InsertUser(db *mongo.Database, col string, name string, phone string, username string, password string, role string) (insertedID primitive.ObjectID, err error)
InsertUser creates a new order in the database
func InsertUsers ¶
func MongoConnect ¶
func SaveTokenToDatabase ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.