backren

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 11 Imported by: 0

README

backren

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(username, privateKey string) (string, error)

func GCFReturnStruct

func GCFReturnStruct(DataStuct any) string

return json string

func GenerateKey

func GenerateKey() (privateKey, publicKey string)

func GetUsername

func GetUsername(r *http.Request) string

get id

func GetuserByAdmin

func GetuserByAdmin(PASETOPUBLICKEYENV string, r *http.Request) string

func InsertUserApp

func InsertUserApp(PASETOPUBLICKEYENV string, r *http.Request) string

func InsertUserStore

func InsertUserStore(r *http.Request) string

func LogIn

func LogIn(PASETOPRIVATEKEYENV string, r *http.Request) string

func SqlConn

func SqlConn() (*sql.DB, error)

Types

type Payload

type Payload struct {
	Username string    `json:"username"`
	Exp      time.Time `json:"exp"`
	Iat      time.Time `json:"iat"`
	Nbf      time.Time `json:"nbf"`
}

func Decode

func Decode(publicKey string, tokenstring string) (payload Payload, err error)

func GetUserLogin

func GetUserLogin(PASETOPUBLICKEYENV string, r *http.Request) (Payload, error)

get user login

type Response

type Response struct {
	Status  int    `json:"status" bson:"status"`
	Message string `json:"message,omitempty" bson:"message,omitempty"`
}

type User

type User struct {
	Name        string `bson:"name,omitempty" json:"name,omitempty"`
	Username    string `bson:"username,omitempty" json:"username,omitempty"`
	Email       string `bson:"email,omitempty" json:"email,omitempty"`
	PhoneNumber string `bson:"phone_number,omitempty" json:"phone_number,omitempty"`
	License     string `bson:"license,omitempty" json:"license,omitempty"`
	Password    string `bson:"password,omitempty" json:"password,omitempty"`
}

Jump to

Keyboard shortcuts

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