backendgcf

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 12 Imported by: 0

README

backendgcf

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func GCFPostHandler

func GCFPostHandler(PASETOPRIVATEKEYENV, MONGOCONNSTRINGENV, dbname, collectionname string, r *http.Request) string

func GCFReturnStruct

func GCFReturnStruct(DataStuct any) string

func GetConnectionMongo added in v0.0.2

func GetConnectionMongo(MongoString, dbname string) *mongo.Database

func HashPassword

func HashPassword(password string) (string, error)

func InsertOneDoc added in v0.0.3

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

func InsertUser

func InsertUser(db *mongo.Database, collection string, userdata User) string

func InsertUserdata added in v0.0.2

func InsertUserdata(MongoConn *mongo.Database, username, password string) (InsertedID interface{})

func IsExist added in v0.0.2

func IsExist(Tokenstr, PublicKey string) bool

func IsPasswordValid

func IsPasswordValid(mongoconn *mongo.Database, collection string, userdata User) bool

func Login added in v0.0.2

func Login(Privatekey, MongoEnv, dbname, Colname string, r *http.Request) string

func Register added in v0.0.2

func Register(Mongoenv, dbname string, r *http.Request) string

func ReturnStringStruct added in v0.0.3

func ReturnStringStruct(Data any) string

func SetConnection

func SetConnection(MONGOCONNSTRINGENV, dbname string) *mongo.Database

Types

type Credential

type Credential struct {
	Status  bool   `json:"status" bson:"status"`
	Token   string `json:"token,omitempty" bson:"token,omitempty"`
	Message string `json:"message,omitempty" bson:"message,omitempty"`
}

type RegisterStruct added in v0.0.2

type RegisterStruct struct {
	Username string `json:"username" bson:"username"`
	Password string `json:"password" bson:"password"`
}

type User

type User struct {
	ID       primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	Username string             `json:"username" bson:"username"`
	Password string             `json:"password" bson:"password"`
}

Jump to

Keyboard shortcuts

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