edumasbackend

package module
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 16 Imported by: 0

README

edumasbackend

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareHashPass

func CompareHashPass(password, hash string) bool

func CreateAdmin added in v0.0.7

func CreateAdmin(mongoconn *mongo.Database, collection string, admindata Admin) interface{}

func CreateAdminAndAddToken added in v0.0.7

func CreateAdminAndAddToken(privateKeyEnv string, mongoconn *mongo.Database, collection string, admindata Admin) error

admin

func CreateNewAdminRole added in v0.0.7

func CreateNewAdminRole(mongoconn *mongo.Database, collection string, admindata Admin) interface{}

Admin

func CreateNewReport

func CreateNewReport(mongoconn *mongo.Database, collection string, reportdata Report) interface{}

Report

func CreateNewTanggapan added in v0.1.1

func CreateNewTanggapan(mongoconn *mongo.Database, collection string, tanggapandata Tanggapan) interface{}

Tanggapan

func CreateNewUserRole

func CreateNewUserRole(mongoconn *mongo.Database, collection string, userdata User) interface{}

User

func CreateNewUserRoleNew added in v0.1.9

func CreateNewUserRoleNew(mongoconn *mongo.Database, collection string, userdata UserNew) interface{}

func CreateReport added in v0.0.3

func CreateReport(mongoconn *mongo.Database, collection string, reportdata Report) interface{}

Report function

func CreateUser

func CreateUser(mongoconn *mongo.Database, collection string, userdata User) interface{}

func CreateUserAndAddToken

func CreateUserAndAddToken(privateKeyEnv string, mongoconn *mongo.Database, collection string, userdata User) error

user

func DecodeGetReport added in v0.0.8

func DecodeGetReport(PublicKey, tokenStr string) (pay string, err error)

func DecodeGetRole added in v0.3.4

func DecodeGetRole(publickey string, tokenstring string) string

func DecodeGetUser added in v0.1.5

func DecodeGetUser(PublicKey, tokenStr string) (pay string, err error)

func DecodeGetUsername added in v0.3.4

func DecodeGetUsername(publickey string, tokenstring string) string

func DeleteOneDoc

func DeleteOneDoc(_id primitive.ObjectID, db *mongo.Database, col string) error

func DeleteReport

func DeleteReport(mongoconn *mongo.Database, collection string, reportdata Report) interface{}

func DeleteTanggapan added in v0.1.1

func DeleteTanggapan(mongoconn *mongo.Database, collection string, tanggapandata Tanggapan) interface{}

func DeleteUser

func DeleteUser(mongoconn *mongo.Database, collection string, userdata User) interface{}

func Deleteuser added in v0.2.6

func Deleteuser(mongoconn *mongo.Database, collection string, userdata2 UserNew) interface{}

func EditUser added in v0.3.4

func EditUser(mongoenv *mongo.Database, collname string, datauser UserNew) interface{}

func GCFDeleteReportForAdmin added in v0.0.9

func GCFDeleteReportForAdmin(publickey, MONGOCONNSTRINGENV, dbname, colladmin, collreport string, r *http.Request) string

Delete Report For Admin

func GCFDeleteUserForAdmin added in v0.2.6

func GCFDeleteUserForAdmin(publickey, MONGOCONNSTRINGENV, dbname, colladmin, colluser string, r *http.Request) string

func GCFFindUserByName added in v0.2.2

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

func GCFGetAllReport

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

get all report

func GCFGetAllReportID

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

get all report by Nik

func GCFInsertReport

func GCFInsertReport(publickey, MONGOCONNSTRINGENV, dbname, colluser, collreport string, r *http.Request) string

Insert Report post

func GCFInsertTanggapan added in v0.1.1

func GCFInsertTanggapan(publickey, MONGOCONNSTRINGENV, dbname, colladmin, colltanggapan string, r *http.Request) string

func GCFReturnStruct

func GCFReturnStruct(DataStuct any) string

return struct

func GCFUpdateReportForAdmin added in v0.0.9

func GCFUpdateReportForAdmin(publickey, MONGOCONNSTRINGENV, dbname, colladmin, collreport string, r *http.Request) string

Update report for admin

func GCFUpdateReportForUser added in v0.3.6

func GCFUpdateReportForUser(publickey, MONGOCONNSTRINGENV, dbname, colluser, collreport string, r *http.Request) string

Update report for User

func GCFUpdateUserForAdmin added in v0.2.6

func GCFUpdateUserForAdmin(publickey, MONGOCONNSTRINGENV, dbname, colladmin, colluser string, r *http.Request) string

Update data user for admin

func GCFUpdateUserForUser added in v0.3.3

func GCFUpdateUserForUser(publickey, MONGOCONNSTRINGENV, dbname, colluser string, r *http.Request) string

Update data user for User

func GetAllDataReports added in v0.0.8

func GetAllDataReports(PublicKey, MongoEnv, dbname, colname string, r *http.Request) string

Get All data report For Admin

func GetAllDataUser added in v0.1.5

func GetAllDataUser(PublicKey, MongoEnv, dbname, colname string, r *http.Request) string

GetAllUser

func GetAllDocs

func GetAllDocs(db *mongo.Database, col string, docs interface{}) interface{}

crud

func GetOneDataReport added in v0.2.8

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

func GetOneDataReports added in v0.3.0

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

func GetOneDataUser added in v0.3.1

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

Get satu data User

func GetOneTanggapan added in v0.1.1

func GetOneTanggapan(mongoconn *mongo.Database, collection string, tanggapandata Tanggapan) interface{}

func HashPass

func HashPass(password string) (string, error)

func InsertAdmindata added in v0.0.7

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

func InsertOneDoc

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

func InsertUserdata

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

func InsertUserdataNew added in v0.1.7

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

func IsExist added in v0.1.1

func IsExist(Tokenstr, PublicKey string) bool

func IsPasswordValid

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

func IsPasswordValidAdmin added in v0.0.7

func IsPasswordValidAdmin(mongoconn *mongo.Database, collection string, admindata Admin) bool

func IsPasswordValidUserNew added in v0.1.7

func IsPasswordValidUserNew(mongoconn *mongo.Database, collection string, userdata2 UserNew) bool

func Login

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

func LoginAdmin added in v0.0.7

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

Function Admin

func LoginUserNew added in v0.1.7

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

func MongoCreateConnection

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

func Register

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

func RegisterNew added in v0.1.7

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

func ReturnStringStruct

func ReturnStringStruct(Data any) string

func ReturnStruct added in v0.3.4

func ReturnStruct(DataStuct any) string

func SetConnection

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

func UpdateOneDoc

func UpdateOneDoc(id primitive.ObjectID, db *mongo.Database, col string, doc interface{}) (err error)

func UpdateUserByUser added in v0.3.4

func UpdateUserByUser(publickey, mongoenv, dbname, collname string, r *http.Request) string

func UpdatedReport

func UpdatedReport(mongoconn *mongo.Database, collection string, filter bson.M, reportdata Report) interface{}

func UpdatedTanggapan added in v0.1.1

func UpdatedTanggapan(mongoconn *mongo.Database, collection string, filter bson.M, tanggapandata Tanggapan) interface{}

func UpdatedUser added in v0.2.6

func UpdatedUser(mongoconn *mongo.Database, collection string, filter bson.M, userdata2 UserNew) interface{}

Types

type Admin added in v0.0.7

type Admin struct {
	Username string `json:"username" bson:"username"`
	Password string `json:"password" bson:"password"`
	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"`
}

func FindAdmin added in v0.0.7

func FindAdmin(mongoconn *mongo.Database, collection string, admindata Admin) Admin

func GetOneAdmin added in v0.0.7

func GetOneAdmin(MongoConn *mongo.Database, colname string, admindata Admin) Admin

type Contact

type Contact struct {
	ID      int    `json:"id" bson:"id"`
	Name    string `json:"title" bson:"title"`
	Subject string `json:"description" bson:"description"`
	Alamat  string `json:"alamat" bson:"alamat"`
	Website string `json:"website" bson:"website"`
	Message string `json:"image" bson:"image"`
	Email   string `json:"email" bson:"email"`
	Phone   string `json:"phone" bson:"phone"`
	Status  bool   `json:"status" bson:"status"`
}

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"`
	Data    []Report  `bson:"data,omitempty" json:"data,omitempty"`
	Datas   []UserNew `bson:"datas,omitempty" json:"datas,omitempty"`
}

type Payload

type Payload struct {
	Id        primitive.ObjectID `json:"id"`
	Admin     string             `json:"admin"`
	User      string             `json:"user"`
	UserNew   string             `json:"usernew`
	Username  string             `json:"username`
	Tanggapan string             `json:"tanggapan"`
	Report    string             `json:"report"`
	Role      string             `json:"role"`
	Exp       time.Time          `json:"exp"`
	Iat       time.Time          `json:"iat"`
	Nbf       time.Time          `json:"nbf"`
}

func Decoder added in v0.0.8

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

type Report

type Report struct {
	ID           primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	Nik          int                `json:"nik" bson:"nik" json:"nik,omitempty`
	Nama         string             `json:"nama" bson:"nama" json:"nama,omitempty`
	Title        string             `json:"title" bson:"title" json:"title,omitempty`
	Description  string             `json:"description" bson:"description" json:"description,omitempty`
	DateOccurred string             `json:"dateOccurred" bson:"dateOccured" json:"dataOccurred,omitempty`
	Image        string             `json:"image" bson:"image" json:"image,omitempty`
	Tanggapan    string             `json:"tanggapan" bson:"tanggapan" json:"tanggapan,omitempty`
	Status       bool               `json:"status" bson:"status" json:"status,omitempty`
	PihakTerkait string             `json:"pihakterkait" bson:"pihakterkait" json:"pihakterkait,omitempty`
}

func FindOneReport added in v0.2.6

func FindOneReport(mongoconn *mongo.Database, collection string, reportdata Report) Report

func FindReport added in v0.2.0

func FindReport(mongoconn *mongo.Database, collection string, reportdata Report) Report

func GetAllReport

func GetAllReport(mongoconn *mongo.Database, collection string) []Report

func GetAllReportID

func GetAllReportID(mongoconn *mongo.Database, collection string, reportdata Report) Report

func GetOneReport added in v0.2.0

func GetOneReport(mongoconn *mongo.Database, collection string, reportdata Report) Report

func GetOneReportData added in v0.1.9

func GetOneReportData(mongoconn *mongo.Database, collname string, reportdata Report) Report

func GetOneReportNik added in v0.2.2

func GetOneReportNik(mongoconn *mongo.Database, collection string, reportdata Report) Report

func GetReportFromID added in v0.2.8

func GetReportFromID(db *mongo.Database, col string, _id primitive.ObjectID) (*Report, error)

func GetReportFromIDs added in v0.3.0

func GetReportFromIDs(db *mongo.Database, col string, _id int) (*Report, error)

type Response

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

func CreateResponse

func CreateResponse(status bool, message string, data interface{}) Response

type ResponseDataUser

type ResponseDataUser struct {
	Status  bool   `json:"status" bson:"status"`
	Message string `json:"message,omitempty" bson:"message,omitempty"`
	Data    []User `json:"data,omitempty" bson:"data,omitempty"`
}

type ResponseEncode

type ResponseEncode struct {
	Message string `json:"message,omitempty" bson:"message,omitempty"`
	Token   string `json:"token,omitempty" bson:"token,omitempty"`
}

type Tanggapan added in v0.1.1

type Tanggapan struct {
	ID          primitive.ObjectID `bson:"_id,omitempty"`
	Nik         int                `json:"nik" bson:"nik"`
	Description string             `json:"description"`
	DateRespons string             `json:"daterespons"`
}

func GetAllTanggapan added in v0.1.1

func GetAllTanggapan(mongoconn *mongo.Database, collection string) []Tanggapan

func GetAllTanggapanID added in v0.1.1

func GetAllTanggapanID(mongoconn *mongo.Database, collection string, tanggapandata Tanggapan) Tanggapan

type User

type User struct {
	Username string `json:"username" bson:"username"`
	Password string `json:"password" bson:"password"`
	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"`
}

func FindUser

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

func FindUserUser added in v0.2.2

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

func GetOneUser

func GetOneUser(MongoConn *mongo.Database, colname string, userdata User) User

type UserNew added in v0.1.7

type UserNew struct {
	ID       primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	Username string             `json:"username" bson:"username,omitempty"`
	Password string             `json:"password" bson:"password,omitempty"`
	Notelp   string             `json:"notelp" bson:"notelp,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"`
}

func FindUserNew added in v0.3.3

func FindUserNew(mongoconn *mongo.Database, collection string, userdata UserNew) UserNew

func FindUserNews added in v0.3.4

func FindUserNews(mongoenv *mongo.Database, collname string, userdata UserNew) UserNew

func GetAllUser added in v0.1.5

func GetAllUser(mongoconn *mongo.Database, collection string) []UserNew

func GetUserFromID added in v0.3.1

func GetUserFromID(db *mongo.Database, col string, _id primitive.ObjectID) (*UserNew, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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