peda

package module
v1.9.31 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 14 Imported by: 2

README

fancy

fancy

go get -u all
go mod tidy
git tag                                 #check current version
git tag v0.0.28                          #set tag version
git push origin --tags                  #push tag version to repo
go list -m https://github.com/Fancypedia/fancybackend@v0.0.1   #publish to pkg dev, replace ORG/URL with your repo URL
[https://asia-southeast2-testlogin-366704.cloudfunctions.net/updated](https://asia-southeast2-testlogin-366704.cloudfunctions.net/getaaalll -get all
https://asia-southeast2-testlogin-366704.cloudfunctions.net/function-16 -admin khusus
https://asia-southeast2-testlogin-366704.cloudfunctions.net/gislocation -gis tempat penjualan
https://asia-southeast2-testlogin-366704.cloudfunctions.net/post -post ( ini payloadnya {
   " Username": "pakrolly",
		"Password": "ganteng",
		"Role":     "admin"
})
https://us-central1-testlogin-366704.cloudfunctions.net/delete
https://asia-southeast2-testlogin-366704.cloudfunctions.net/updated)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticateUserAndGenerateToken

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

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func CreateAbout added in v1.3.0

func CreateAbout(mongoconn *mongo.Database, collection string, aboutdata About) interface{}

func CreateComment added in v1.3.0

func CreateComment(mongoconn *mongo.Database, collection string, commentdata Comment) interface{}

func CreateContact added in v1.3.0

func CreateContact(mongoconn *mongo.Database, collection string, contactdata Contack) interface{}

func CreateEvent added in v1.3.0

func CreateEvent(mongoconn *mongo.Database, collection string, eventdata Event) interface{}

func CreateEventGlobal added in v1.3.0

func CreateEventGlobal(mongoconn *mongo.Database, collection string, eventglobaldata EventGlobal) interface{}

func CreateGallery added in v1.3.0

func CreateGallery(mongoconn *mongo.Database, collection string, gallerydata Gallery) interface{}

func CreateIklan added in v1.3.0

func CreateIklan(mongoconn *mongo.Database, collection string, iklandata Iklan) interface{}

CreateIklan function

func CreateLogin

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

create login using Private

func CreateNewBlog

func CreateNewBlog(mongoconn *mongo.Database, collection string, blogdata Blog) interface{}

func CreateNewContent

func CreateNewContent(mongoconn *mongo.Database, collection string, contentdata Content) interface{}

content

func CreateNewProduct

func CreateNewProduct(mongoconn *mongo.Database, collection string, productdata Product) interface{}

func CreateNewUserRole

func CreateNewUserRole(mongoconn *mongo.Database, collection string, userdata User) interface{}
func GetAllUser(mongoconn *mongo.Database, collection string) []User {
	user := atdb.GetAllDoc[[]User](mongoconn, collection)
	return user
}

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

func CreateUserAndAddedToeken

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

func DeleteAbout added in v1.3.0

func DeleteAbout(mongoconn *mongo.Database, collection string, aboutdata About) interface{}

func DeleteComment added in v1.3.0

func DeleteComment(mongoconn *mongo.Database, collection string, commentdata Comment) interface{}

func DeleteContact added in v1.3.0

func DeleteContact(mongoconn *mongo.Database, collection string, contactdata Contack) interface{}

func DeleteContent

func DeleteContent(mongoconn *mongo.Database, collection string, contentdata Content) interface{}

func DeleteEvent added in v1.3.0

func DeleteEvent(mongoconn *mongo.Database, collection string, eventdata Event) interface{}

func DeleteEventGlobal added in v1.3.0

func DeleteEventGlobal(mongoconn *mongo.Database, collection string, eventglobaldata EventGlobal) interface{}

func DeleteGallery added in v1.3.0

func DeleteGallery(mongoconn *mongo.Database, collection string, gallerydata Gallery) interface{}

func DeleteIklan added in v1.3.0

func DeleteIklan(mongoconn *mongo.Database, collection string, iklandata Iklan) interface{}

func DeleteUser

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

func GCFAllGlobalID added in v1.3.0

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

func GCFCreateAccountAndToken

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

func GCFCreateContent

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

func GCFCreateHandler

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

func GCFCreateHandlerTokenPaseto

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

func GCFCreateNewBlog

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

func GCFCreatePostLineString added in v1.3.0

func GCFCreatePostLineString(MONGOCONNSTRINGENV, dbname, collection string, r *http.Request) string

func GCFCreatePostLineStringg added in v1.3.0

func GCFCreatePostLineStringg(MONGOCONNSTRINGENV, dbname, collection string, r *http.Request) string

func GCFCreateTokenAndSaveToDB

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

func GCFCretatedEventGlobal added in v1.3.0

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

func GCFCreteCommnet added in v1.3.0

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

func GCFCreteRegister

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

func GCFDeleteHandler

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

func GCFDeleteHandlerContent

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

func GCFDeletedCommnet added in v1.3.0

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

func GCFFindBlogAllID

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

func GCFFindContentAllID

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

func GCFFindUserByID

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

func GCFFindUserByName

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

func GCFGetAllBlog

func GCFGetAllBlog(MONGOCONNSTRINGENV, dbname, collectionname string) string

func GCFGetAllComment added in v1.3.0

func GCFGetAllComment(MONGOCONNSTRINGENV, dbname, collectionname string) string

func GCFGetAllContentBy

func GCFGetAllContentBy(MONGOCONNSTRINGENV, dbname, collectionname string) string

func GCFGetAllEvent added in v1.3.0

func GCFGetAllEvent(MONGOCONNSTRINGENV, dbname, collectionname string) string

get all

func GCFGetAllProduct

func GCFGetAllProduct(MONGOCONNSTRINGENV, dbname, collectionname string) string

product

func GCFLoginAfterCreate

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

func GCFLoginAfterCreatee

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

func GCFLoginAfterCreateee

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

func GCFLoginAfterCreateeee

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

func GCFLoginAfterCreater

func GCFLoginAfterCreater(MONGOCONNSTRINGENV, dbname, collectionname, privateKeyEnv string, r *http.Request) (string, error)

func GCFLoginFixx added in v1.3.0

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

func GCFLoginFixxx added in v1.3.0

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

func GCFLoginTest

func GCFLoginTest(username, password, MONGOCONNSTRINGENV, dbname, collectionname string) bool

func GCFPostHandler

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

func GCFReturnStruct

func GCFReturnStruct(DataStuct any) string

func GCFUpdateHandler

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

func GCFUpdatedContent

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

func GFCPostHandlerUser

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

func GFCUpadatedCommnet added in v1.3.0

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

func HashPassword

func HashPassword(password string) (string, error)

func IsPasswordValid

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

func PostLinestring added in v1.3.0

func PostLinestring(mongoconn *mongo.Database, collection string, linestringdata GeoJsonLineString) interface{}

func ReplaceContent

func ReplaceContent(mongoconn *mongo.Database, collection string, filter bson.M, contentdata Content) interface{}

func ReplaceOneDoc

func ReplaceOneDoc(mongoconn *mongo.Database, collection string, filter bson.M, userdata User) interface{}

func SetConnection

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

func UpdatedAbout added in v1.3.0

func UpdatedAbout(mongoconn *mongo.Database, collection string, filter bson.M, aboutdata About) interface{}

func UpdatedComment added in v1.3.0

func UpdatedComment(mongoconn *mongo.Database, collection string, filter bson.M, commentdata Comment) interface{}

func UpdatedContact added in v1.3.0

func UpdatedContact(mongoconn *mongo.Database, collection string, filter bson.M, contactdata Contack) interface{}

func UpdatedEvent added in v1.3.0

func UpdatedEvent(mongoconn *mongo.Database, collection string, filter bson.M, eventdata Event) interface{}

func UpdatedEventGlobal added in v1.3.0

func UpdatedEventGlobal(mongoconn *mongo.Database, collection string, filter bson.M, eventglobaldata EventGlobal) interface{}

func UpdatedGallery added in v1.3.0

func UpdatedGallery(mongoconn *mongo.Database, collection string, filter bson.M, gallerydata Gallery) interface{}

func UpdatedIklan added in v1.3.0

func UpdatedIklan(mongoconn *mongo.Database, collection string, filter bson.M, iklandata Iklan) interface{}

Types

type About

type About struct {
	ID          int    `json:"id" bson:"id"`
	Title       string `json:"title" bson:"title"`
	Description string `json:"description" bson:"description"`
	Image       string `json:"image" bson:"image"`
}

func GetAllAbout added in v1.3.0

func GetAllAbout(mongoconn *mongo.Database, collection string) []About

func GetIDAbout added in v1.3.0

func GetIDAbout(mongoconn *mongo.Database, collection string, aboutdata About) About

type Blog

type Blog struct {
	ID          int       `json:"id" bson:"id"`
	Title       string    `json:"title" bson:"title"`
	Tanggal     string    `json:"tanggal" bson:"tanggal"`
	Description string    `json:"judul" bson:"judul"`
	Content     []Content `json:"content" bson:"content"`
}

func GetAllBlogAll

func GetAllBlogAll(mongoconn *mongo.Database, collection string) []Blog

func GetIDBlog

func GetIDBlog(mongoconn *mongo.Database, collection string, blogdata Blog) Blog

type Category

type Category struct {
	Category []string `json:"category" bson:"category"`
}

type Comment

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

func GetAllComment added in v1.3.0

func GetAllComment(mongoconn *mongo.Database, collection string) []Comment

type Contack

type Contack struct {
	ID      int    `json:"id" bson:"id"`
	Name    string `json:"title" bson:"title"`
	Subject string `json:"description" bson:"description"`
	Message string `json:"image" bson:"image"`
	Email   string `json:"email" bson:"email"`
	Phone   string `json:"phone" bson:"phone"`
}

func GetAllContact added in v1.3.0

func GetAllContact(mongoconn *mongo.Database, collection string) []Contack

func GetIdContact added in v1.3.0

func GetIdContact(mongoconn *mongo.Database, collection string, contactdata Contack) Contack

type Content

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

func FindContentAllId

func FindContentAllId(mongoconn *mongo.Database, collection string, contentdata Content) Content

func GetAllContent

func GetAllContent(mongoconn *mongo.Database, collection string) []Content

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

func GCFCreateProduct

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

func GCFCreateProducttWithpublickey added in v1.3.0

func GCFCreateProducttWithpublickey(MONGOCONNSTRINGENV, dbname, collectionname string, publickey string, r *http.Request) Credential

func GCFCreateProducttWithpublickeyFix added in v1.3.0

func GCFCreateProducttWithpublickeyFix(MONGOCONNSTRINGENV, dbname, collectionname string, publickey string, r *http.Request) Credential

type Event

type Event struct {
	ID          int    `json:"id" bson:"id"`
	Title       string `json:"title" bson:"title"`
	Description string `json:"description" bson:"description"`
	Tanggal     string `json:"tanggal" bson:"tanggal"`
	Image       string `json:"image" bson:"image"`
	Harga       int    `json:"harga" bson:"harga"`
	LinkYoutube string `json:"linkyoutube" bson:"linkyoutube"`
}

func GetAllEvent added in v1.3.0

func GetAllEvent(mongoconn *mongo.Database, collection string) []Event

func GetIDEvent added in v1.3.0

func GetIDEvent(mongoconn *mongo.Database, collection string, eventdata Event) Event

type EventGlobal

type EventGlobal struct {
	ID          int    `json:"id" bson:"id"`
	Title       string `json:"title" bson:"title"`
	Description string `json:"description" bson:"description"`
	Tanggal     string `json:"tanggal" bson:"tanggal"`
	Image       string `json:"image" bson:"image"`
	Harga       int    `json:"harga" bson:"harga"`
}

func GetAllEventGlobal added in v1.3.0

func GetAllEventGlobal(mongoconn *mongo.Database, collection string) []EventGlobal

func GetAllEventGlobalId added in v1.3.0

func GetAllEventGlobalId(mongoconn *mongo.Database, collection string, eventglobaldata EventGlobal) []EventGlobal
type Gallery struct {
	ID          int    `json:"id" bson:"id"`
	Title       string `json:"title" bson:"title"`
	Description string `json:"description" bson:"description"`
	Image       string `json:"image" bson:"image"`
}

func GetAllGallery added in v1.3.0

func GetAllGallery(mongoconn *mongo.Database, collection string) []Gallery

func GetIDGallery added in v1.3.0

func GetIDGallery(mongoconn *mongo.Database, collection string, gallerydata Gallery) Gallery

type GeoJson

type GeoJson struct {
	Type       string     `json:"type" bson:"type"`
	Properties Properties `json:"properties" bson:"properties"`
	Geometry   Geometry   `json:"geometry" bson:"geometry"`
}

func GetAllBangunanLineString

func GetAllBangunanLineString(mongoconn *mongo.Database, collection string) []GeoJson

type GeoJsonLineString

type GeoJsonLineString struct {
	Type       string             `json:"type" bson:"type"`
	Properties Properties         `json:"properties" bson:"properties"`
	Geometry   GeometryLineString `json:"geometry" bson:"geometry"`
}

func GetByCoordinate added in v1.3.0

func GetByCoordinate(mongoconn *mongo.Database, collection string, linestringdata GeoJsonLineString) GeoJsonLineString

type GeoJsonPolygon

type GeoJsonPolygon struct {
	Type       string          `json:"type" bson:"type"`
	Properties Properties      `json:"properties" bson:"properties"`
	Geometry   GeometryPolygon `json:"geometry" bson:"geometry"`
}

type Geometry

type Geometry struct {
	Coordinates interface{} `json:"coordinates" bson:"coordinates"`
	Type        string      `json:"type" bson:"type"`
}

type GeometryLineString

type GeometryLineString struct {
	Coordinates [][]float64 `json:"coordinates" bson:"coordinates"`
	Type        string      `json:"type" bson:"type"`
}

type GeometryPoint

type GeometryPoint struct {
	Coordinates []float64 `json:"coordinates" bson:"coordinates"`
	Type        string    `json:"type" bson:"type"`
}

type GeometryPolygon

type GeometryPolygon struct {
	Coordinates [][][]float64 `json:"coordinates" bson:"coordinates"`
	Type        string        `json:"type" bson:"type"`
}

type Iklan

type Iklan struct {
	ID          int    `json:"id" bson:"id"`
	Title       string `json:"title" bson:"title"`
	Description string `json:"description" bson:"description"`
	Image       string `json:"image" bson:"image"`
}

func GetAllIklan added in v1.3.0

func GetAllIklan(mongoconn *mongo.Database, collection string) []Iklan

func GetIDIklan added in v1.3.0

func GetIDIklan(mongoconn *mongo.Database, collection string, iklandata Iklan) Iklan

type Payload added in v1.3.0

type Payload struct {
	User string    `json:"user"`
	Role string    `json:"role"`
	Exp  time.Time `json:"exp"`
	Iat  time.Time `json:"iat"`
	Nbf  time.Time `json:"nbf"`
}

func IsTokenValid added in v1.3.0

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

pengecekantoken

type Product

type Product struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" `
	Nomorid     int                `json:"nomorid" bson:"nomorid"`
	Name        string             `json:"name" bson:"name"`
	Description string             `json:"description" bson:"description"`
	Price       int                `json:"price" bson:"price"`
	Stock       int                `json:"stock" bson:"stock"`
	Size        string             `json:"size" bson:"size"`
	Image       string             `json:"image" bson:"image"`
}

func GetAllProduct

func GetAllProduct(mongoconn *mongo.Database, collection string) []Product

type Properties

type Properties struct {
	Name string `json:"name" bson:"name"`
}

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 Share

type Share struct {
	Share []string `json:"share" bson:"share"`
}

type Tags

type Tags struct {
	Tags []string `json:"tags" bson:"tags"`
}

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"`
	Publick  string `json:"publick,omitempty" bson:"publick,omitempty"`
}

func FindUser

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

func FindUserByUsername

func FindUserByUsername(mongoconn *mongo.Database, collection string, username string) (User, error)

func FindUserUser

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

func FindUserUserr added in v1.3.0

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

func GetNameAndPassowrd

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

func IsPasswordValidd added in v1.3.0

func IsPasswordValidd(mconn *mongo.Database, collection string, userdata User) (User, bool)

Jump to

Keyboard shortcuts

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