belajarmahya

package module
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AmbilSemuaUser

func AmbilSemuaUser(publickeykatalogfilm, mongoenvkatalogfilm, dbname, collname string, r *http.Request) string

func Authorization

func Authorization(publickeykatalogfilm, mongoenvkatalogfilm, dbname, collname string, r *http.Request) string

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func DecodeGetName

func DecodeGetName(publickey string, tokenstring string) string

func DecodeGetNomor

func DecodeGetNomor(publickey string, tokenstring string) string

func DecodeGetRole

func DecodeGetRole(publickey string, tokenstring string) string

func DecodeGetUsername

func DecodeGetUsername(publickey string, tokenstring string) string

func DeleteProductOnlineCourse

func DeleteProductOnlineCourse(mconn *mongo.Database, collname string, data ProductOnlineCourse) interface{}

func DeleteUser

func DeleteUser(mconn *mongo.Database, collname string, userdata User) interface{}

func EditProductOnlineCourse

func EditProductOnlineCourse(mconn *mongo.Database, collname string, data ProductOnlineCourse) interface{}

func EditUser

func EditUser(mconn *mongo.Database, collname string, datauser User) interface{}

func Encode

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

func ForgotPassword

func ForgotPassword(mconn *mongo.Database, collname string, userdata User) interface{}

func GenerateKey

func GenerateKey() (privatekey, publickey string)

func GenerateRandomNumber

func GenerateRandomNumber() string

generate nomor random

func HapusUser

func HapusUser(publickeykatalogfilm, mongoenvkatalogfilm, dbname, collname string, r *http.Request) string

func HashPassword

func HashPassword(password string) (string, error)

func HashPasswordd

func HashPasswordd(password string) (string, error)

func InsertProductOnlineCourse

func InsertProductOnlineCourse(mconn *mongo.Database, collname string, data ProductOnlineCourse) interface{}

func InsertUser

func InsertUser(mconn *mongo.Database, collname string, datauser User) interface{}

func IsPasswordValid

func IsPasswordValid(mconn *mongo.Database, collname string, userdata User) bool

func Login

func Login(privatekeykatalogfilm, mongoenvkatalogfilm, dbname, collname string, r *http.Request) string

func Registrasi

func Registrasi(mongoenvkatalogfilm, dbname, collname string, r *http.Request) string

func ReturnStruct

func ReturnStruct(DataStuct any) string

func SetConnection

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

func UnHashPassowrd

func UnHashPassowrd(password string) string

func UpdatePassword

func UpdatePassword(publickeykatalogfilm, mongoenvkatalogfilm, dbname, collname string, r *http.Request) string

func UpdateUser

func UpdateUser(mongoenvkatalogfilm, dbname, collname string, r *http.Request) string

func UsernameExists

func UsernameExists(mongoenvkatalogfilm, dbname string, userdata User) bool

Types

type CredentialUser

type CredentialUser struct {
	Status bool `json:"status" bson:"status"`
	Data   struct {
		Name     string `json:"name" bson:"name"`
		Username string `json:"username" bson:"username"`
		Role     string `json:"role" bson:"role"`
		Nomor    string `json:"nomor" bson:"nomor"`
	} `json:"data" bson:"data"`
	Message string `json:"message,omitempty" bson:"message,omitempty"`
}

type Payload

type Payload struct {
	Name     string    `json:"name"`
	Username string    `json:"username"`
	Role     string    `json:"role"`
	Nomor    string    `json:"nomor"`
	Exp      time.Time `json:"exp"`
	Iat      time.Time `json:"iat"`
	Nbf      time.Time `json:"nbf"`
}

func Decode

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

type Pesan

type Pesan struct {
	Status  bool        `json:"status" bson:"status"`
	Message string      `json:"message" bson:"message"`
	Data    interface{} `json:"data,omitempty" bson:"data,omitempty"`
	Role    string      `json:"role,omitempty" bson:"role,omitempty"`
	Token   string      `json:"token,omitempty" bson:"token,omitempty"`
	Nomor   string      `json:"nomor,omitempty" bson:"nomor,omitempty"`
}

type ProductOnlineCourse

type ProductOnlineCourse struct {
	ID            string `json:"id" bson:"id"`
	Name          string `json:"name" bson:"name"`
	Description   string `json:"description" bson:"description"`
	List          string `json:"list" bson:"list"`
	Price         int    `json:"price" bson:"price"`
	Authorization string `json:"authorization" bson:"authorization"`
}

func FindProductOnlineCourse

func FindProductOnlineCourse(mconn *mongo.Database, collname string, data ProductOnlineCourse) ProductOnlineCourse

func GetAllProductOnlineCourse

func GetAllProductOnlineCourse(mconn *mongo.Database, collname string) []ProductOnlineCourse

type Response

type Response struct {
	Status  bool        `json:"status" bson:"status"`
	Message string      `json:"message" bson:"message"`
	Data    interface{} `json:"data" bson:"data"`
}

type User

type User struct {
	Name     string `json:"name" bson:"name"`
	Username string `json:"username" bson:"username"`
	Password string `json:"password" bson:"password"`
	Role     string `json:"role" bson:"role"`
	Nomor    string `json:"nomor" bson:"nomor"`
}

func FindPassword

func FindPassword(mconn *mongo.Database, collname string, userdata User) User

func FindUser

func FindUser(mconn *mongo.Database, collname string, userdata User) User

func GetAllUser

func GetAllUser(mconn *mongo.Database, collname string) []User

type UserNew

type UserNew struct {
	ID        string `json:"id" bson:"id"`
	Name      string `json:"name" bson:"name"`
	Passoword string `json:"password" bson:"password"`
	Role      string `json:"role" bson:"role"`
	Username  string `json:"username" bson:"username"`
}

Jump to

Keyboard shortcuts

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