berkatbepkg

package module
v1.1.5 Latest Latest
Warning

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

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

README

berkat-bepkg - Dokumentasi

Package Backend khusus untuk aplikasi website Berkat Auto.

Update library untuk backend ini

go get -u all
go mod tidy
git tag                                                 # Cek version untuk package ini
git tag v1.0.0                                          # Set version untuk package ini
git push origin --tags                                  # Push Package dengan Version
go list -m github.com/berkatauto/berkat-bepkg@v1.0.0    # Publish Package ke pkg.go.dev

Cara Install Package ini

Untuk menginstal package ini cukup mudah. Buat Project Golangmu dan masukkan command berikut.

go mod init "init kemana nih"
go get github.com/berkatauto/berkat-bepkg
go mod tidy

Package siap langsung pakai.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func ConvertFileToBase64 added in v1.0.7

func ConvertFileToBase64(file Content)

func CreateUserAndAddedToken added in v1.0.3

func CreateUserAndAddedToken(MONGOCONNSTRINGEV *mongo.Database, collection string, datauser User) interface{}

func DecodeBase64String added in v1.0.7

func DecodeBase64String(data string) string

func DeleteArticle added in v1.0.4

func DeleteArticle(mongoconn *mongo.Database, collection string, articleData Article) interface{}

func GCFCreateUserWToken added in v1.0.6

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

func GCFDeleteArticle added in v1.0.4

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

func GCFHandler added in v1.0.1

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

func GCFLoadOneArticle added in v1.0.7

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

func GCFLoginHandler added in v1.0.7

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

func GCFPostArticle added in v1.0.3

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

func GCFReturnStruct

func GCFReturnStruct(DataStuct any) string

func GCFSearchByAuthor added in v1.0.4

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

func GCFSearchByCategory added in v1.0.4

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

func GCFSearchByTags added in v1.0.4

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

func GCFSearchByTitle added in v1.0.4

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

func GCFUpdateArticle added in v1.0.4

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

func GenerateArticleID added in v1.1.4

func GenerateArticleID(randomizer int) string

func GetArticleByLastDate added in v1.0.8

func GetArticleByLastDate(MONGOCONNSTRINGENV, dbname, collectionname string) string

func HashPassword

func HashPassword(password string) (string, error)

func IsPasswordValid

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

func IsUsernameExists added in v1.1.3

func IsUsernameExists(MONGOSTRING, dbname string, datauser User) bool

func PostArticle added in v1.0.3

func PostArticle(mongoconn *mongo.Database, collection string, articleData Article) interface{}

func SetConnection

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

func UpdateArticle added in v1.0.4

func UpdateArticle(mongoconn *mongo.Database, collection string, articleData Article) interface{}

Types

type Article

type Article struct {
	ID       string    `json:"article_id,omitempty" bson:"article_id,omitempty"`
	Author   string    `json:"author" bson:"author"`
	Title    string    `json:"title" bson:"title"`
	Category string    `json:"category" bson:"category"`
	Tags     string    `json:"tags" bson:"tags"`
	Content  Content   `json:"content" bson:"content"`
	Date     time.Time `json:"date" bson:"date"`
}

func GetArticle added in v1.0.1

func GetArticle(mongoconn *mongo.Database, collection string) []Article

func GetByAuthor added in v1.0.8

func GetByAuthor(mongoconn *mongo.Database, collection string, articleData Article) Article

func GetByLastDate added in v1.0.4

func GetByLastDate(mongoconn *mongo.Database, collection string, articleData Article) Article

func GetOneArticle added in v1.0.4

func GetOneArticle(mongoconn *mongo.Database, collection string, articleData Article) Article

func LoadArticle added in v1.0.7

func LoadArticle(mongoconn *mongo.Database, collection string, articleData Article) Article

func LoadByArticleID added in v1.1.4

func LoadByArticleID(mongoconn *mongo.Database, collection string, articleData Article) Article

func SearchByAuthor added in v1.0.4

func SearchByAuthor(mongoconn *mongo.Database, collection string, searchBy Article) Article

func SearchByCategory added in v1.0.4

func SearchByCategory(mongoconn *mongo.Database, collection string, searchBy Article) Article

func SearchByTags added in v1.0.4

func SearchByTags(mongoconn *mongo.Database, collection string, searchBy Article) Article

func SearchByTitle added in v1.0.4

func SearchByTitle(mongoconn *mongo.Database, collection string, searchBy Article) Article

type ArticleInfo added in v1.1.4

type ArticleInfo struct {
	Message  string    `json:"message,omitempty" bson:"message,omitempty"`
	Author   string    `json:"author" bson:"author"`
	Title    string    `json:"title" bson:"title"`
	Category string    `json:"category" bson:"category"`
	Tags     string    `json:"tags" bson:"tags"`
	Content  []Content `json:"content" bson:"content"`
	Date     string    `json:"date" bson:"date"`
}

type Content added in v1.0.2

type Content struct {
	Paragraph string `json:"paragraph" bson:"paragraph"`
	Image     string `json:"image" bson:"image"`
}

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"`
}

type RegisterInfo added in v1.1.3

type RegisterInfo struct {
	Message       string `json:"message,omitempty" bson:"message,omitempty"`
	Status        bool   `json:"status" bson:"status"`
	Fullname      string `json:"fullname" bson:"fullname"`
	Username      string `json:"username" bson:"username"`
	Password      string `json:"password" bson:"password"`
	JournalStatus string `json:"journal_bool" bson:"journal_bool"`
	Role          string `json:"role,omitempty" bson:"role,omitempty"`
	NoHP          string `json:"no_hp,omitempty" bson:"no_hp,omitempty"`
}

type User

type User struct {
	Fullname      string `json:"fullname" bson:"fullname"`
	Username      string `json:"username" bson:"username"`
	Password      string `json:"password" bson:"password"`
	NoHP          string `json:"no_hp,omitempty" bson:"no_hp,omitempty"`
	JournalStatus string `json:"journal_bool" bson:"journal_bool"`
	Token         string `json:"token,omitempty" bson:"token,omitempty"`
	Role          string `json:"role,omitempty" bson:"role,omitempty"`
}

func FindUser added in v1.1.3

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

func GetAllUser added in v1.0.3

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

func GetNameAndPassowrd added in v1.0.3

func GetNameAndPassowrd(mongoconn *mongo.Database, collection string) []User

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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