kursussalon

package module
v1.1.36 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddedBlog

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

func AddedComment added in v0.0.10

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

commment

func AddedQuestionAndAnswer added in v0.0.6

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

func AddedQuestionAnswerAndVidieo added in v1.1.6

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

find answerd and video

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 CekAnswer added in v0.0.6

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

func CekAnswerVidio added in v1.1.27

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

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func CheckUserAccess added in v1.1.13

func CheckUserAccess(mconn *mongo.Database, username string, contentID int) 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 DeleteAnswer added in v0.0.6

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

func DeleteAnswerVidio added in v1.1.34

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

func DeleteAnswerdb added in v0.0.6

func DeleteAnswerdb(mconn *mongo.Database, collname string, dataquestion QuestionAndAnswer) interface{}

func DeleteAnswerdbVidio added in v1.1.33

func DeleteAnswerdbVidio(mconn *mongo.Database, collname string, dataquestion VidioQuestion) interface{}

func DeleteBlog

func DeleteBlog(mconn *mongo.Database, collname string, datablog Blog) interface{}

func DeleteComment added in v0.0.10

func DeleteComment(mconn *mongo.Database, collname string, datacomment Comment) interface{}

func DeleteContent added in v0.0.8

func DeleteContent(mconn *mongo.Database, collname string, datacontent Content) interface{}

func DeleteUser

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

func DeletedBlog

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

func DeletedCertificate

func DeletedCertificate(mconn *mongo.Database, collname string, datacertificate Certificate) interface{}

func DeletedComment added in v0.0.10

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

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 FindBlog

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

func FindComment added in v0.0.10

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

func GenerateCertificate added in v1.1.23

func GenerateCertificate(username string, correctCount int, totalQuestions int, nomorRandom string) string

func GenerateKey

func GenerateKey() (privatekey, publickey string)

func GenerateRandomNumber

func GenerateRandomNumber() string

generate nomor random

func GetFindAll added in v0.0.6

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

func GetFindAllVideo added in v1.1.32

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

func GetQuestionAndAnswer added in v0.0.6

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

func GetVideoWithAccessCheck added in v1.1.13

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

func GrantAccess added in v1.1.13

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

func HapusUser

func HapusUser(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 InsertAccessControl added in v1.1.13

func InsertAccessControl(mconn *mongo.Database, collname string, access AccessControl) error

func InsertBlog

func InsertBlog(mconn *mongo.Database, collname string, datablog Blog) interface{}

func InsertCertificate

func InsertCertificate(mconn *mongo.Database, collname string, datacertificate Certificate) interface{}

func InsertComment added in v0.0.10

func InsertComment(mconn *mongo.Database, collname string, datacomment Comment) interface{}

func InsertContent added in v0.0.8

func InsertContent(mconn *mongo.Database, collname string, datacontent Content) interface{}

func InsertQuestionAndAnswer added in v0.0.6

func InsertQuestionAndAnswer(mconn *mongo.Database, collname string, dataquestion QuestionAndAnswer) interface{}

func InsertQuestionAndAnswerVidieo added in v1.1.6

func InsertQuestionAndAnswerVidieo(mconn *mongo.Database, collname string, dataquestion VidioQuestion) 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 UpdateBlog

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

func UpdateComment added in v0.0.10

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

func UpdatePassword

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

func UpdateUser

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

func UpdatedAnswer added in v0.0.6

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

func UpdatedAnswerVidio added in v1.1.33

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

func UpdatedAnswerdb added in v0.0.6

func UpdatedAnswerdb(mconn *mongo.Database, collname string, dataquestion QuestionAndAnswer) interface{}

func UpdatedAnswerdbVidio added in v1.1.33

func UpdatedAnswerdbVidio(mconn *mongo.Database, collname string, dataquestion VidioQuestion) interface{}

func UpdatedBlog

func UpdatedBlog(mconn *mongo.Database, collname string, datablog Blog) interface{}

func UpdatedComment added in v0.0.10

func UpdatedComment(mconn *mongo.Database, collname string, datacomment Comment) interface{}

func UpdatedContent added in v0.0.8

func UpdatedContent(mconn *mongo.Database, collname string, datacontent Content) interface{}

func UsernameExists

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

Types

type AccessControl added in v1.1.13

type AccessControl struct {
	Username  string `json:"username" bson:"username"`
	ContentID []int  `json:"content_id" bson:"content_id"`
	HasAccess bool   `json:"has_access" bson:"has_access"`
}

type Blog

type Blog struct {
	ID                int    `json:"id" bson:"id"`
	Content           string `json:"content_one" bson:"content_one"`
	Content_two       string `json:"content_two" bson:"content_two"`
	Image             string `json:"image" bson:"image"`
	Title             string `json:"title" bson:"title"`
	Title_two         string `json:"title_two" bson:"title_two"`
	Description       string `json:"description" bson:"description"`
	Description_twoo  string `json:"description_two" bson:"description_two"`
	Description_three string `json:"description_3" bson:"description_3"`
	Status            bool   `json:"status" bson:"status"`
}

func FindallBlog

func FindallBlog(mconn *mongo.Database, collname string) []Blog

type Certificate

type Certificate struct {
	Nama             string `json:"nama" bson:"nama"`
	Nomorcertificate string `json:"nomorcertificate" bson:"nomorcertificate"`
	Tanggal          string `json:"tanggal" bson:"tanggal"`
	Expired          string `json:"expired" bson:"expired"`
	Jurusan          string `json:"jurusan" bson:"jurusan"`
	Status           bool   `json:"status" bson:"status"`
	Nomor            string `json:"nomor" bson:"nomor"`
	Ttd              string `json:"ttd" bson:"ttd"`
}

func FindallCertificate

func FindallCertificate(mconn *mongo.Database, collname string) []Certificate

find all sertificate

type Comment added in v0.0.8

type Comment struct {
	ID        int    `json:"id" bson:"id"`
	Username  string `json:"username" bson:"username"`
	Answer    string `json:"comment" bson:"comment"`
	Questions string `json:"questions" bson:"questions"`
	Tanggal   string `json:"tanggal" bson:"tanggal"`
	Status    bool   `json:"status" bson:"status"`
}

func FindallComment added in v0.0.10

func FindallComment(mconn *mongo.Database, collname string) []Comment

type Content added in v0.0.8

type Content struct {
	ID          int    `json:"id" bson:"id"`
	Content     string `json:"content" bson:"content"`
	Image       string `json:"image" bson:"image"`
	Description string `json:"description" bson:"description"`
	Status      bool   `json:"status" bson:"status"`
}

func FindallContent added in v0.0.8

func FindallContent(mconn *mongo.Database, collname string) []Content

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 PesanAnswer added in v1.1.20

type PesanAnswer struct {
	Status         bool             `json:"status"`
	Message        string           `json:"message"`
	CorrectCount   int              `json:"correct_count"`
	IncorrectCount int              `json:"incorrect_count"`
	Details        []QuestionDetail `json:"details"`
	UserDetails    User             `json:"user_details,omitempty"`
	Certificate    string           `json:"certificate,omitempty"`
	Nomor          string           `json:"nomor,omitempty"`
}

type QuestionAndAnswer added in v0.0.6

type QuestionAndAnswer struct {
	ID            int      `json:"id" bson:"id"`
	Question      string   `json:"question" bson:"question"`
	Answers       []string `json:"answers" bson:"answers"`
	CorrectAnswer string   `json:"correct_answer" bson:"correct_answer"`
	Status        bool     `json:"status" bson:"status"`
	Username      string   `json:"username"`
}

func CheckAnswerdb added in v0.0.6

func CheckAnswerdb(mconn *mongo.Database, collname string, dataquestion QuestionAndAnswer) QuestionAndAnswer

func FindallQuestionAndAnswer added in v0.0.6

func FindallQuestionAndAnswer(mconn *mongo.Database, collname string) []QuestionAndAnswer

type QuestionDetail added in v1.1.20

type QuestionDetail struct {
	QuestionID string `json:"question_id"`
	IsCorrect  bool   `json:"is_correct"`
}

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 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"`
	Ispaid    bool   `json:"ispaid" bson:"ispaid"`       // Indicates whether the user has paid
	Hasaccess bool   `json:"hasaccess" bson:"hasaccess"` // Indicates whether access has been granted by admin
}

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 VidioQuestion added in v1.1.6

type VidioQuestion struct {
	ID            int      `json:"id" bson:"id"`
	Question      string   `json:"question" bson:"question"`
	Answers       []string `json:"answers" bson:"answers"`
	CorrectAnswer string   `json:"correct_answer" bson:"correct_answer"`
	Status        bool     `json:"status" bson:"status"`
	Video         []string `json:"video" bson:"video"`
	ContentID     []int    `json:"content_id" bson:"content_id"` // Added to link with AccessControl
	Username      string   `json:"username"`
	Nomor         string   `json:"nomor" bson:"nomor"`
}

func CheckAnswerdbVidio added in v1.1.27

func CheckAnswerdbVidio(mconn *mongo.Database, collname string, dataquestion VidioQuestion) VidioQuestion

func FindVideoByID added in v1.1.13

func FindVideoByID(mdb *mongo.Database, collname string, contentID int) (VidioQuestion, error)

func FindallQuestionAndAnswerVideo added in v1.1.32

func FindallQuestionAndAnswerVideo(mconn *mongo.Database, collname string) []VidioQuestion

Jump to

Keyboard shortcuts

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