module

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2025 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MongoInfo = atdb.DBInfo{
	DBString: MongoString,
	DBName:   "Internship1",
}
View Source
var MongoString string = os.Getenv("MONGOINTERN")

Functions

func DeleteTokenFromMongoDB

func DeleteTokenFromMongoDB(db *mongo.Database, col string, token string) error

func DeleteUserByID

func DeleteUserByID(_id primitive.ObjectID, db *mongo.Database, col string) error

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

func GetAllUser(db *mongo.Database, col string) ([]model.User, error)

GetAllUser retrieves all users from the database

func GetByAddress

func GetByAddress(address string, db *mongo.Database, col string) ([]model.Transaction, error)

GetTransactionByAddress retrieves transactions by address GetTransactionByAddress retrieves transactions by address (sender or receiver) using regex search

func GetByPhoneNumber

func GetByPhoneNumber(phone string, db *mongo.Database, col string) ([]model.Transaction, error)

GetTransactionByPhoneNumber retrieves transactions by phone number

func GetByUsername

func GetByUsername(db *mongo.Database, col string, username string) (*model.User, error)

func GetRoleByAdmin

func GetRoleByAdmin(db *mongo.Database, collection string, role string) (*model.User, error)

func GetTransactionByConnote

func GetTransactionByConnote(connote string, db *mongo.Database, col string) ([]model.Transaction, error)

GetTransactionByConnote retrieves transactions by consignment note

func GetUserByID

func GetUserByID(_id primitive.ObjectID, db *mongo.Database, col string) (model.User, error)

FUNCTION USER GetUserByID retrieves a user from the database by its ID

func InsertOneDoc

func InsertOneDoc(db string, collection string, doc interface{}) (insertedID interface{})

func InsertTransaction

func InsertTransaction(db *mongo.Database, col string, sender string, sender_phone string, receiver string, addressReceiver string, receiver_phone string, item string, status string, codValue float64) (insertedID primitive.ObjectID, connote string, err error)

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 InsertUsers(db *mongo.Database, col string, fullname string, phonenumber string, username string, password string, role string) (insertedID primitive.ObjectID, err error)

func MongoConnect

func MongoConnect(dbname string) (db *mongo.Database)

func SaveTokenToDatabase

func SaveTokenToDatabase(db *mongo.Database, col string, adminID string, token string) error

func UpdateUser

func UpdateUser(ctx context.Context, db *mongo.Database, col string, _id primitive.ObjectID, name string, phone string, username string, password string, role string) (err error)

UpdateUser updates an existing user in the database

Types

This section is empty.

Jump to

Keyboard shortcuts

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