evchargingpoint

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 16 Imported by: 0

README

backend-evchargingpoint

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteOneDoc

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

func Encode

func Encode(id primitive.ObjectID, email, privateKey string) (string, error)

func GCFReturnStruct

func GCFReturnStruct(DataStuct any) string

Return Struct

func GenerateKey

func GenerateKey() (privateKey, publicKey string)

func GetAllDocs

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

crud

func GetID

func GetID(r *http.Request) string

Get Id

func InsertOneDoc

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

func MongoConnect

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

Mongo Environment

func SaveFileToGithub

func SaveFileToGithub(usernameGhp, emailGhp, repoGhp, path string, r *http.Request) (string, error)

save file to github

func UpdateOneDoc

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

Types

type Charge added in v0.1.0

type Charge struct {
	ID              primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	ChargingStation ChargingStation    `bson:"chargingstation,omitempty" json:"chargingstation,omitempty"`
	User            User               `bson:"user,omitempty" json:"user,omitempty"`
	Tanggal         string             `bson:"tanggal,omitempty" json:"tanggal,omitempty"`
	StartTime       string             `bson:"starttime,omitempty" json:"starttime,omitempty"`
	EndTime         string             `bson:"endtime,omitempty" json:"endtime,omitempty"`
	TotalKWH        string             `bson:"totalkwh,omitempty" json:"totalkwh,omitempty"`
	TotalPrice      string             `bson:"totalprice,omitempty" json:"totalprice,omitempty"`
	PaymentMethod   string             `bson:"paymentmethod,omitempty" json:"paymentmethod,omitempty"`
	InputPembayaran string             `bson:"inputpembayaran,omitempty" json:"inputpembayaran,omitempty"`
	Payment         bool               `bson:"payment,omitempty" json:"payment,omitempty"`
	Status          bool               `bson:"status,omitempty" json:"status,omitempty"`
}

type ChargingStation added in v0.1.0

type ChargingStation struct {
	ID             primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	ChargingKode   string             `bson:"chargingkode,omitempty" json:"chargingkode,omitempty"`
	Nama           string             `bson:"nama,omitempty" json:"nama,omitempty"`
	Alamat         string             `bson:"alamat,omitempty" json:"alamat,omitempty"`
	AmmountPlugs   int                `bson:"ammountplugs,omitempty" json:"ammountplugs,omitempty"`
	Daya           string             `bson:"daya,omitempty" json:"daya,omitempty"`
	Connector      string             `bson:"connector,omitempty" json:"connector,omitempty"`
	Harga          string             `bson:"harga,omitempty" json:"harga,omitempty"`
	Image          string             `bson:"image,omitempty" json:"image,omitempty"`
	NomorTelepon   string             `bson:"nomortelepon,omitempty" json:"nomortelepon,omitempty"`
	JamOperasional string             `bson:"jamoperasional,omitempty" json:"jamoperasional,omitempty"`
	Longitude      string             `bson:"longitude,omitempty" json:"longitude,omitempty"`
	Latitude       string             `bson:"latitude,omitempty" json:"latitude,omitempty"`
	Available      int                `bson:"available,omitempty" json:"available,omitempty"`
}

type Credential

type Credential struct {
	Status  int    `json:"status" bson:"status"`
	Token   string `json:"token,omitempty" bson:"token,omitempty"`
	Message string `json:"message,omitempty" bson:"message,omitempty"`
}

type Payload

type Payload struct {
	Id    primitive.ObjectID `json:"id"`
	Email string             `json:"email"`
	Exp   time.Time          `json:"exp"`
	Iat   time.Time          `json:"iat"`
	Nbf   time.Time          `json:"nbf"`
}

func Decode

func Decode(publicKey string, tokenstring string) (payload Payload, err error)

func GetUserLogin

func GetUserLogin(PASETOPUBLICKEYENV string, r *http.Request) (Payload, error)

Get User Login

type Response

type Response struct {
	Status  int    `json:"status" bson:"status"`
	Message string `json:"message,omitempty" bson:"message,omitempty"`
}

type User

type User struct {
	ID              primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	NamaLengkap     string             `bson:"namalengkap,omitempty" json:"namalengkap,omitempty"`
	NomorHp         string             `bson:"nomorhp,omitempty" json:"nomorhp,omitempty"`
	NamaKendaraan   string             `bson:"namakendaraan,omitempty" json:"namakendaraan,omitempty"`
	NomorPolisi     string             `bson:"nomorpolisi,omitempty" json:"nomorpolisi,omitempty"`
	Email           string             `bson:"email,omitempty" json:"email,omitempty"`
	Password        string             `bson:"password,omitempty" json:"password,omitempty"`
	Image           string             `bson:"image,omitempty" json:"image,omitempty"`
	Confirmpassword string             `bson:"confirmpass,omitempty" json:"confirmpass,omitempty"`
	Salt            string             `bson:"salt,omitempty" json:"salt,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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