gcfGEO

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 12 Imported by: 0

README

Update enkripsi Password Mongo DB, Deploy function Signup, Memasukan Token jika user berhasil login kedalam Cookies

•Update 21-10-2023
{
  "username": "ucup",
  "password": "$2a$10$r.Z8w/WHkd7uHcE6ZGlqCOcsNQEQOdXyrYYcDMMY9V4/HLOmXloCq"
}
Update 23-10-2023

-API clooud functions Signup

https://asia-southeast2-bustling-walker-340203.cloudfunctions.net/function-Signup

input

{
  "username": "username",
  "password": "Password"
}

Send Post

{
    "message": "Pendaftaran berhasil"
}

-Memasukan Token ke Cookies

cookie := http.Cookie{
		Name:     "token",     // Nama cookie
		Value:    tokenString, // Token sebagai nilai cookie
		HttpOnly: true,        // Hanya bisa diakses melalui HTTP
		Path:     "/",         // Path di mana cookie berlaku (misalnya, seluruh situs)
		MaxAge:   3600,        // Durasi cookie (dalam detik), sesuaikan sesuai kebutuhan
		// Secure: true, // Jika situs dijalankan melalui HTTPS
	}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteDataGeo

func DeleteDataGeo(Mongoenv, dbname string, ctx context.Context, val LonLatProperties) (DeletedId interface{})

func GCFDeleteLon

func GCFDeleteLon(publickey, Mongostring, dbname string, r *http.Request) string

func GCFPostCoordinate

func GCFPostCoordinate(Mongostring, dbname, colname string, r *http.Request) string

func GCFUpdateName

func GCFUpdateName(publickey, Mongostring, dbname string, r *http.Request) string

func GCHandlerFunc

func GCHandlerFunc(publickey, Mongostring, dbname, colname string, r *http.Request) string

func GetConnectionMongo

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

func InsertDataLonlat

func InsertDataLonlat(MongoConn *mongo.Database, colname string, coordinate []float64, name, volume, tipe string) (InsertedID interface{})

func IsExist

func IsExist(Tokenstr, PublicKey string) bool

func Login

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

func Register

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

func ReturnStringStruct

func ReturnStringStruct(Data any) string

func UpdateNameGeo

func UpdateNameGeo(Mongoenv, dbname string, ctx context.Context, val LonLatProperties) (UpdateID interface{})

Types

type Credents

type Credents struct {
	Status  string `json:"status" bson:"status"`
	Message string `json:"message" bson:"message"`
}

type GeoJson

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

func GetAllGeoData

func GetAllGeoData(MongoConnect *mongo.Database, colname 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"`
}

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 LonLatProperties

type LonLatProperties struct {
	Type        string    `json:"type" bson:"type"`
	Name        string    `json:"name" bson:"name"`
	Volume      string    `json:"volume" bson:"volume"`
	Coordinates []float64 `json:"coordinates" bson:"coordinates, omitempty"`
}

type Properties

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

type RegisterStruct

type RegisterStruct struct {
	Username string `json:"username" bson:"username"`
	Password string `json:"password" bson:"password"`
}

Jump to

Keyboard shortcuts

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