peda

package module
v1.0.0 Latest Latest
Warning

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

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

README

Befous

Nama = Ibrohim Mubarok
NPM = 1214081
Kelas = 3C

Mengambil semua data gejson

Link API-nya

https://asia-southeast2-gis3-401509.cloudfunctions.net/BefousAmbilDataGeojson

Response

[{
      "type": "Feature",
      "properties": {
        "name": "nama property"
      },
      "geometry": {
        "coordinates": [
          x,y
        ],
        "type": "tipe geojson"
      }
    }]

Registrasi Akun

Link API-nya

https://asia-southeast2-gis3-401509.cloudfunctions.net/BefousMembuatUser

Body

{
    "username": "input username di sini",
    "password": "input password di sini",
	"role": "input role di sini"
}

Response

{"status":true,"message":"Berhasil Input data"}

Login Akun

Membuat Token

Link API-nya

https://asia-southeast2-gis3-401509.cloudfunctions.net/BefousMembuatTokenUser

Body

{
    "username": "input username di sini",
    "password": "input password di sini"
}

Response bila berhasil

{"status":true,"token":"token yang didapat","message":"Selamat Datang"}

Response bila gagal

{"status":false,"message":"Password Salah"}
Menyimpan Token

Link API-nya

https://asia-southeast2-gis3-401509.cloudfunctions.net/BefousLoginUser

Header

Login : masukkan token di sini

Response bila berhasil

{
    "status": true,
    "message": "data User berhasil diambil",
    "data": [
        {
            "username": "data",
            "password": "data",
            "role": "role"
        },
        {
            "username": "data",
            "password": "data",
            "role": "role"
        }
    ]
}

Response bila gagal

{"status":false,"message":"Data Username tidak ada di database"}

Delete Akun

Link API-nya

https://asia-southeast2-gis3-401509.cloudfunctions.net/BefousHapusUser

Body

{
    "username": "input username di sini"
}

Response bila berhasil

{"status":false,"message":"Berhasil Delete data"}

Response bila gagal

{"status":false,"message":"error parsing application/json: EOF"}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AmbilDataGeojson

func AmbilDataGeojson(mongoenv, dbname, collname string, r *http.Request) string

func AmbilDataGeojsonHeader

func AmbilDataGeojsonHeader(mongoenv, dbname, collname string, r *http.Request) string

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func CompareUsername

func CompareUsername(mongoenv *mongo.Database, collname, username string) bool

func CreateNewUserRole

func CreateNewUserRole(mongoenv *mongo.Database, collname string, userdata User) interface{}

func CreateUserAndAddedToeken

func CreateUserAndAddedToeken(privatekey string, mongoenv *mongo.Database, collname string, userdata User) interface{}

func DeleteUser

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

func HapusUser

func HapusUser(mongoenv, dbname, collname string, r *http.Request) string

func HashPassword

func HashPassword(password string) (string, error)

func InsertUserdata

func InsertUserdata(mongoenv *mongo.Database, collname, username, role, password string) (InsertedID interface{})

func IsPasswordValid

func IsPasswordValid(mongoenv *mongo.Database, collname string, userdata User) bool

func LoginUser

func LoginUser(privatekey, mongoenv, dbname, collname string, r *http.Request) string

func MemasukkanKoordinat

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

func MembuatGeojsonPoint

func MembuatGeojsonPoint(mongoenv, dbname, collname string, r *http.Request) string

func MembuatGeojsonPointHeader

func MembuatGeojsonPointHeader(mongoenv, dbname, collname string, r *http.Request) string

func MembuatGeojsonPolygon

func MembuatGeojsonPolygon(mongoenv, dbname, collname string, r *http.Request) string

func MembuatGeojsonPolygonHeader

func MembuatGeojsonPolygonHeader(mongoenv, dbname, collname string, r *http.Request) string

func MembuatGeojsonPolyline

func MembuatGeojsonPolyline(mongoenv, dbname, collname string, r *http.Request) string

func MembuatGeojsonPolylineHeader

func MembuatGeojsonPolylineHeader(mongoenv, dbname, collname string, r *http.Request) string

func PostLinestring

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

func PostPoint

func PostPoint(mongoconn *mongo.Database, collection string, pointdata GeoJsonPoint) interface{}

func PostPolygon

func PostPolygon(mongoconn *mongo.Database, collection string, polygondata GeoJsonPolygon) interface{}

func PostStructWithToken

func PostStructWithToken[T any](tokenkey string, tokenvalue string, structname interface{}, urltarget string) (result T, errormessage string)

func RegistrasiUser

func RegistrasiUser(mongoenv, dbname, collname string, r *http.Request) string

func ReplaceOneDoc

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

func ReturnStruct

func ReturnStruct(DataStuct any) string

func SetConnection

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

Types

type Coordinate

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

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 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(mongoenv *mongo.Database, collname 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 GeoJsonPoint

type GeoJsonPoint struct {
	Type       string        `json:"type" bson:"type"`
	Properties Properties    `json:"properties" bson:"properties"`
	Geometry   GeometryPoint `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 Jaja

type Jaja 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{}) Jaja

type Pesan

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

type PostToken

type PostToken struct {
	Response string `json:"response"`
}

type Properties

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

type Response

type Response struct {
	Token string `json:"token,omitempty" bson:"token,omitempty"`
}

type ResponseDataUser

type ResponseDataUser struct {
	Status  bool   `json:"status" bson:"status"`
	Message string `json:"message,omitempty" bson:"message,omitempty"`
	Data    []User `json:"data,omitempty" bson:"data,omitempty"`
}

type Token

type Token struct {
	Key    string
	Values string
}

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(mongoenv *mongo.Database, collname string, userdata User) User

func FindUserUser

func FindUserUser(mongoenv *mongo.Database, collname string, userdata User) User

func GetAllUser

func GetAllUser(mongoenv *mongo.Database, collname string) []User

func GetNameAndPassowrd

func GetNameAndPassowrd(mongoenv *mongo.Database, collname string) []User

Jump to

Keyboard shortcuts

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