gisbackend

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 13 Imported by: 0

README

gisbackend

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 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 Create2dsphere

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

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 DocExists

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

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, geo Point) (result string)

func GetCenterSphereDoc

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

func GetGeoIntersectsDoc

func GetGeoIntersectsDoc[T any](db *mongo.Database, collname, locfield string, geospatial models.Geospatial) (result []T, err error)

func GetGeoWitDoc added in v0.0.5

func GetGeoWitDoc(db *mongo.Database, collname string, coordinates Polygon) (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 InsertOneDoc

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

func MembuatGeojsonPoint

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

func MembuatGeojsonPolygon

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

func MembuatGeojsonPolyline

func MembuatGeojsonPolyline(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 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 ReplaceOneDoc

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

func ReturnString added in v0.0.5

func ReturnString(geojson []FullGeoJson) string

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

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"`
}

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"`
}

Jump to

Keyboard shortcuts

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