helpers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func Create2dsphere

func Create2dsphere(mconn models.DBInfo) (db *mongo.Database)

func Decode

func Decode(publickey, tokenstr string) (payload models.Payload, err error)

func DecodeGetName

func DecodeGetName(publickey string, tokenstring string) string

func DecodeGetRole

func DecodeGetRole(publickey string, tokenstring string) string

func DecodeGetUsername

func DecodeGetUsername(publickey string, tokenstring string) string

func DeleteDoc

func DeleteDoc(db *mongo.Database, collection string, filter bson.M) (result *mongo.DeleteResult)

func DeleteOneDoc

func DeleteOneDoc(db *mongo.Database, collection string, filter bson.M) (result *mongo.DeleteResult)

func DocExists

func DocExists[T any](db *mongo.Database, collname string, filter bson.M, doc T) (result bool)

func Encode

func Encode(name, username, role, privatekey string) (string, error)

func GenerateKey

func GenerateKey() (privatekey, publickey string)

func GetAllDistinctDoc

func GetAllDistinctDoc(db *mongo.Database, filter bson.M, fieldname, collection string) (doc []any)

func GetAllDoc

func GetAllDoc[T any](db *mongo.Database, collection string) (doc T)

func GetAllDocByFilter

func GetAllDocByFilter[T any](db *mongo.Database, collection string, filter bson.M) (doc T)

func GetBoxDoc

func GetBoxDoc(db *mongo.Database, collname string, coordinates models.Polyline) (result string)

func GetGeoIntersectsDoc

func GetGeoIntersectsDoc(db *mongo.Database, collname string, coordinates models.Point) (result string)

func GetGeoWithinDoc

func GetGeoWithinDoc(db *mongo.Database, collname string, coordinates models.Polygon) (result string)

func GetNearDoc

func GetNearDoc(db *mongo.Database, collname string, coordinates models.Point) (result string)

func GetNearSphereDoc

func GetNearSphereDoc(db *mongo.Database, collname string, coordinates models.Point) (result string)

func GetOneDoc

func GetOneDoc[T any](db *mongo.Database, collection string, filter bson.M) (doc T)

func GetOneLatestDoc

func GetOneLatestDoc[T any](db *mongo.Database, collection string, filter bson.M) (doc T, err error)

func GetRandomDoc

func GetRandomDoc[T any](db *mongo.Database, collection string, size uint) (result []T, err error)

func HashPassword

func HashPassword(password string) (string, error)

func InsertOneDoc

func InsertOneDoc(db *mongo.Database, collection string, doc interface{}) (insertedID interface{})

func MongoConnect

func MongoConnect(mconn models.DBInfo) (db *mongo.Database)

func ReplaceOneDoc

func ReplaceOneDoc(db *mongo.Database, collection string, filter bson.M, doc interface{}) (updatereseult *mongo.UpdateResult)

Types

This section is empty.

Jump to

Keyboard shortcuts

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