geobackend

package module
v0.0.3 Latest Latest
Warning

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

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

README

geobackend

backend geo

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 added in v0.0.2

func CheckPasswordHash(password, hash string) bool

func Create2dsphere

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

func DecodeGetName added in v0.0.2

func DecodeGetName(publickey string, tokenstring string) string

func DecodeGetRole added in v0.0.2

func DecodeGetRole(publickey string, tokenstring string) string

func DecodeGetUsername added in v0.0.2

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 added in v0.0.2

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

func GenerateKey added in v0.0.2

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 added in v0.0.2

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 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 ReturnString added in v0.0.3

func ReturnString(geojson []FullGeoJson) string

func ReturnStruct

func ReturnStruct(DataStuct any) (result 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 added in v0.0.2

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         int64     `json:"max,omitempty" bson:"max,omitempty"`
	Min         int64     `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

Jump to

Keyboard shortcuts

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