gisgolang

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 15 Imported by: 0

README

Backend GIS Golang

Nama : Adam Ghafara NPM : 1214064 Kelas : 3C

Push and Publish Repo Tags

go get -u all
go mod tidy                             # Tidy golang
git add .                               # Add Files
git commit -m "Commit Here"             # Commit Data
git tag                                 #check current version
git tag v1.0.0                         #set tag version
git push origin --tags                  #push tag version to repo
go list -m github.com/adam-ghafara/gis-baru@v1.0.0   #publish to pkg dev, replace ORG/URL with your repo URL

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 AmbilSemuaUser

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

func Authorization

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

func Box

func Box(mconn *mongo.Database, collname string, coordinates Polyline) string

func Center

func Center(mconn *mongo.Database, collname string, coordinates Point) string

func CenterSphere

func CenterSphere(mconn *mongo.Database, collname string, coordinates Point) string

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func Create2dsphere

func Create2dsphere(mconn DBInfo) (db *mongo.Database)

func DecodeGetName

func DecodeGetName(publickey string, tokenstring string) string

func DecodeGetRole

func DecodeGetRole(publickey string, tokenstring string) string

func DecodeGetUsername

func DecodeGetUsername(publickey string, tokenstring string) string

func DeleteDoc

func DeleteDoc(db *mongo.Database, collection string, filter bson.M) (result *mongo.DeleteResult)

func DeleteGeojson

func DeleteGeojson(mconn *mongo.Database, collname string, userdata User) interface{}

func DeleteOneDoc

func DeleteOneDoc(db *mongo.Database, collection string, filter bson.M) (result *mongo.DeleteResult)

func DeleteUser

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

func DocExists

func DocExists[T any](db *mongo.Database, collname string, filter bson.M, doc T) (result bool)

func EditUser

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

func Encode

func Encode(name, username, role, privatekey string) (string, error)

func GenerateKey

func GenerateKey() (privatekey, publickey string)

func GeoWithin

func GeoWithin(mconn *mongo.Database, collname string, coordinates Polygon) string

func GetAllDistinctDoc

func GetAllDistinctDoc(db *mongo.Database, filter bson.M, fieldname, collection string) (doc []any)

func GetAllDoc

func GetAllDoc[T any](db *mongo.Database, collection string) (doc T)

func GetAllDocByFilter

func GetAllDocByFilter[T any](db *mongo.Database, collection string, filter bson.M) (doc T)

func GetBoxDoc

func GetBoxDoc(db *mongo.Database, collname string, coordinates Polyline) (result string)

func GetCenterDoc

func GetCenterDoc(db *mongo.Database, collname string, coordinates Point) (result string)

func GetCenterSphereDoc

func GetCenterSphereDoc(db *mongo.Database, collname string, coordinates Point) (result string)

func GetGeoIntersectsDoc

func GetGeoIntersectsDoc(db *mongo.Database, collname string, coordinates Point) (result string)

func GetGeoWithinDoc

func GetGeoWithinDoc(db *mongo.Database, collname string, coordinates Polygon) (result string)

func GetNearDoc

func GetNearDoc(db *mongo.Database, collname string, coordinates Point) (result string)

func GetNearSphereDoc

func GetNearSphereDoc(db *mongo.Database, collname string, coordinates Point) (result string)

func GetOneDoc

func GetOneDoc[T any](db *mongo.Database, collection string, filter bson.M) (doc T)

func GetOneLatestDoc

func GetOneLatestDoc[T any](db *mongo.Database, collection string, filter bson.M) (doc T, err error)

func GetRandomDoc

func GetRandomDoc[T any](db *mongo.Database, collection string, size uint) (result []T, err error)

func HapusUser

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

func HashPassword

func HashPassword(password string) (string, error)

func InsertOneDoc

func InsertOneDoc(db *mongo.Database, collection string, doc interface{}) (insertedID interface{})

func InsertUser

func InsertUser(mongoenv *mongo.Database, collname string, datauser User) interface{}

func IsPasswordValid

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

func Login

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

func MembuatGeojsonPoint

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

func MembuatGeojsonPolygon

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

func MembuatGeojsonPolyline

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

func MongoConnect

func MongoConnect(mconn DBInfo) (db *mongo.Database)

func Near

func Near(mconn *mongo.Database, collname string, coordinates Point) string

func NearSphere

func NearSphere(mconn *mongo.Database, collname string, coordinates Point) string

func PostBox

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

func PostCenter

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

func PostCenterSphere added in v1.0.2

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

func PostGeoIntersects

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

func PostGeoWithin

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

func PostLinestring

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

func PostNear

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

func PostNearSphere

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

func PostPoint

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

func PostPolygon

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

func Registrasi

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

func ReplaceOneDoc

func ReplaceOneDoc(db *mongo.Database, collection string, filter bson.M, doc interface{}) (updatereseult *mongo.UpdateResult)

func ReturnStruct

func ReturnStruct(DataStuct any) string

func SetConnection

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

func SetConnection2dsphere

func SetConnection2dsphere(mongoenv, dbname, collname string) *mongo.Database

func UpdateUser

func UpdateUser(mconn *mongo.Database, collname string, datauser User) interface{}

func UsernameExists

func UsernameExists(mconn *mongo.Database, collname string, userdata User) bool

Types

type CredentialUser

type CredentialUser struct {
	Status bool `json:"status" bson:"status"`
	Data   struct {
		Name     string `json:"name" bson:"name"`
		Username string `json:"username" bson:"username"`
		Role     string `json:"role" bson:"role"`
	} `json:"data" bson:"data"`
	Message string `json:"message,omitempty" bson:"message,omitempty"`
}

type DBInfo

type DBInfo struct {
	DBString       string
	DBName         string
	CollectionName string
}

type FullGeoJson

type FullGeoJson struct {
	ID         primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	Type       string             `json:"type" bson:"type"`
	Properties Properties         `json:"properties" bson:"properties"`
	Geometry   Geometry           `json:"geometry" bson:"geometry"`
}

func GeoIntersects

func GeoIntersects(mconn *mongo.Database, collname string, geospatial models.Geospatial) ([]FullGeoJson, error)

type GeoJson

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

func GetAllBangunan

func GetAllBangunan(mconn *mongo.Database, collname string) []GeoJson

type GeoJsonLineString

type GeoJsonLineString struct {
	Type       string     `json:"type" bson:"type"`
	Properties Properties `json:"properties" bson:"properties"`
	Geometry   struct {
		Coordinates [][]float64 `json:"coordinates" bson:"coordinates"`
		Type        string      `json:"type" bson:"type"`
	} `json:"geometry" bson:"geometry"`
}

type GeoJsonPoint

type GeoJsonPoint struct {
	Type       string     `json:"type" bson:"type"`
	Properties Properties `json:"properties" bson:"properties"`
	Geometry   struct {
		Coordinates []float64 `json:"coordinates" bson:"coordinates"`
		Type        string    `json:"type" bson:"type"`
	} `json:"geometry" bson:"geometry"`
}

type GeoJsonPolygon

type GeoJsonPolygon struct {
	Type       string     `json:"type" bson:"type"`
	Properties Properties `json:"properties" bson:"properties"`
	Geometry   struct {
		Coordinates [][][]float64 `json:"coordinates" bson:"coordinates"`
		Type        string        `json:"type,omitempty" bson:"type,omitempty"`
	} `json:"geometry" bson:"geometry"`
}

type Geometry

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

type LongLat

type LongLat struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

type Payload

type Payload struct {
	Name     string    `json:"name"`
	Username string    `json:"username"`
	Role     string    `json:"role"`
	Exp      time.Time `json:"exp"`
	Iat      time.Time `json:"iat"`
	Nbf      time.Time `json:"nbf"`
}

func Decode

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

type Pesan

type Pesan struct {
	Status  bool        `json:"status" bson:"status"`
	Message string      `json:"message" bson:"message"`
	Data    interface{} `json:"data,omitempty" bson:"data,omitempty"`
	Token   string      `json:"token,omitempty" bson:"token,omitempty"`
}

type Point

type Point struct {
	Coordinates []float64 `json:"coordinates" bson:"coordinates"`
	Max         float64   `json:"max,omitempty" bson:"max,omitempty"`
	Min         float64   `json:"min,omitempty" bson:"min,omitempty"`
	Radius      float64   `json:"radius,omitempty" bson:"radius,omitempty"`
}

type Polygon

type Polygon struct {
	Coordinates [][][]float64 `json:"coordinates" bson:"coordinates"`
}

type Polyline

type Polyline struct {
	Coordinates [][]float64 `json:"coordinates" bson:"coordinates"`
}

type Properties

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

type User

type User struct {
	Name     string `json:"name" bson:"name"`
	Username string `json:"username" bson:"username"`
	Password string `json:"password" bson:"password"`
	Role     string `json:"role" bson:"role"`
}

func FindUser

func FindUser(mconn *mongo.Database, collname string, userdata User) User

func GetAllUser

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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