Documentation ¶
Index ¶
- func CheckPasswordHash(passwordhash, hash string) bool
- func CreateAdmin(mongoconn *mongo.Database, collection string, admindata Admin) interface{}
- func CreateNewUserRole(mongoconn *mongo.Database, collection string, userdata User) interface{}
- func CreateUser(mongoconn *mongo.Database, collection string, userdata User) interface{}
- func CreateUserAndAddToken(privateKeyEnv string, mongoconn *mongo.Database, collection string, ...) error
- func GCFReturnStruct(DataStuct any) string
- func HashPass(passwordhash string) (string, error)
- func InsertOneDoc(db *mongo.Database, collection string, doc interface{}) (insertedID interface{})
- func InsertUserdata(MongoConn *mongo.Database, ...) (InsertedID interface{})
- func IsPasswordValidEmail(mongoconn *mongo.Database, collection string, userdata User) bool
- func IsPasswordValidEmailAdmin(mongoconn *mongo.Database, collection string, admindata Admin) bool
- func IsPasswordValidNPM(mongoconn *mongo.Database, collection string, userdata User) bool
- func LoginAdmin(PASETOPRIVATEKEYENV, MONGOCONNSTRINGENV, dbname, collectionname string, ...) string
- func LoginUser(PASETOPRIVATEKEYENV, MONGOCONNSTRINGENV, dbname, collectionname string, ...) string
- func MongoCreateConnection(MongoString, dbname string) *mongo.Database
- func Register(Mongoenv, dbname string, r *http.Request) string
- func ReturnStringStruct(Data any) string
- func SetConnection(MONGOCONNSTRINGENV, dbname string) *mongo.Database
- type Admin
- type Credential
- type EmailValidator
- type Payload
- type Response
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPasswordHash ¶
func CreateAdmin ¶
func CreateNewUserRole ¶
Function User
func CreateUser ¶
func CreateUserAndAddToken ¶
func GCFReturnStruct ¶
func InsertOneDoc ¶
func InsertUserdata ¶
func InsertUserdata(MongoConn *mongo.Database, usernameid, username, nohp, password, passwordhash, email, role string) (InsertedID interface{})
Function User
func IsPasswordValidEmail ¶
func IsPasswordValidEmailAdmin ¶
Function Admin
func IsPasswordValidNPM ¶
func LoginAdmin ¶
func LoginAdmin(PASETOPRIVATEKEYENV, MONGOCONNSTRINGENV, dbname, collectionname string, r *http.Request) string
Function Admin
func MongoCreateConnection ¶
func ReturnStringStruct ¶
func SetConnection ¶
Types ¶
type Admin ¶
type Admin struct { UsernameId string `json:"usernameid" bson:"usernameid"` Username string `json:"username" bson:"username"` Password string `json:"password" bson:"password"` PasswordHash string `json:"passwordhash" bson:"passwordhash"` Email string `bson:"email,omitempty" json:"email,omitempty"` Role string `json:"role,omitempty" bson:"role,omitempty"` Token string `json:"token,omitempty" bson:"token,omitempty"` Private string `json:"private,omitempty" bson:"private,omitempty"` Public string `json:"public,omitempty" bson:"public,omitempty"` }
type Credential ¶
type EmailValidator ¶
type EmailValidator struct {
// contains filtered or unexported fields
}
func NewEmailValidator ¶
func NewEmailValidator() *EmailValidator
func (*EmailValidator) IsValid ¶
func (v *EmailValidator) IsValid(email string) bool
IsValid memeriksa apakah email sesuai dengan pola npm@std.ulbi.ac.id
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id,omitempty" ` UsernameId string `json:"usernameid" bson:"usernameid"` Username string `json:"username" bson:"username"` Nohp string `json:"nohp" bson:"nohp"` Password string `json:"password" bson:"password"` PasswordHash string `json:"passwordhash" bson:"passwordhash"` Email string `bson:"email,omitempty" json:"email,omitempty"` Role string `json:"role,omitempty" bson:"role,omitempty"` Token string `json:"token,omitempty" bson:"token,omitempty"` Private string `json:"private,omitempty" bson:"private,omitempty"` Public string `json:"public,omitempty" bson:"public,omitempty"` }
Click to show internal directories.
Click to hide internal directories.