peda

package module
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 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 added in v1.0.7

func AmbilDataGeojson(mongoenv, dbname, collname string) string

func AmbilDataGeojsonHeader added in v1.2.7

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

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func CompareUsername added in v1.0.7

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 added in v1.0.7

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

func HashPassword

func HashPassword(password string) (string, error)

func InsertUserdata added in v1.0.5

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 added in v1.0.7

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

func MemasukkanKoordinat added in v1.0.9

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

func MembuatGeojsonPoint added in v1.1.2

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

func MembuatGeojsonPointHeader added in v1.2.7

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

func MembuatGeojsonPolygon added in v1.1.2

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

func MembuatGeojsonPolygonHeader added in v1.2.7

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

func MembuatGeojsonPolyline added in v1.1.2

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

func MembuatGeojsonPolylineHeader added in v1.2.7

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

func PostLinestring added in v1.1.1

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

func PostPoint added in v1.1.2

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

func PostPolygon added in v1.1.2

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

func PostStructWithToken added in v1.1.9

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

func RegistrasiUser added in v1.1.6

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 added in v1.0.7

func ReturnStruct(DataStuct any) string

func SetConnection

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

Types

type Coordinate added in v1.0.9

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 added in v1.1.2

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 added in v1.2.6

type Jaja struct {
	Status  bool        `json:"status" bson:"status"`
	Message string      `json:"message" bson:"message"`
	Data    interface{} `json:"data" bson:"data"`
}

func CreateResponse added in v1.2.6

func CreateResponse(status bool, message string, data interface{}) Jaja

type Pesan added in v1.0.9

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

type PostToken added in v1.1.9

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 added in v1.0.7

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 added in v1.1.9

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