Geospacialsfunc

package module
v0.0.8 Latest Latest
Warning

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

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

README

Geospacialsfunc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AmbilDataGeojson added in v0.0.3

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

func AmbilSemuaUser added in v0.0.6

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

func Authorization added in v0.0.6

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

func Box added in v0.0.3

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

func Center added in v0.0.3

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

func CenterSphere added in v0.0.3

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

func CheckPasswordHash added in v0.0.6

func CheckPasswordHash(password, hash string) bool

func Create2dsphere added in v0.0.3

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

func DecodeGetName added in v0.0.6

func DecodeGetName(publickey string, tokenstring string) string

func DecodeGetRole added in v0.0.6

func DecodeGetRole(publickey string, tokenstring string) string

func DecodeGetUsername added in v0.0.6

func DecodeGetUsername(publickey string, tokenstring string) string

func DeleteDoc added in v0.0.3

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

func DeleteGeojson added in v0.0.3

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

func DeleteOneDoc added in v0.0.3

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

func DeleteUser added in v0.0.6

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

func DocExists added in v0.0.3

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

func EditUser added in v0.0.6

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

func Encode added in v0.0.6

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

func GenerateKey added in v0.0.6

func GenerateKey() (privatekey, publickey string)

func GeoWithin added in v0.0.3

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

func GetAllDistinctDoc added in v0.0.3

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

func GetAllDoc added in v0.0.3

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

func GetAllDocByFilter added in v0.0.3

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

func GetBoxDoc added in v0.0.3

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

func GetCenterDoc added in v0.0.3

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

func GetCenterSphereDoc added in v0.0.3

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

func GetGeoIntersectsDoc added in v0.0.3

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

func GetGeoWithinDoc added in v0.0.3

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

func GetNearDoc added in v0.0.3

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

func GetNearSphereDoc added in v0.0.3

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

func GetOneDoc added in v0.0.3

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

func GetOneLatestDoc added in v0.0.3

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

func GetRandomDoc added in v0.0.3

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

func HapusUser added in v0.0.6

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

func HashPassword added in v0.0.6

func HashPassword(password string) (string, error)

func InsertOneDoc added in v0.0.3

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

func InsertUser added in v0.0.6

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

func IsPasswordValid added in v0.0.6

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

func Login added in v0.0.6

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

func MembuatGeojsonPoint added in v0.0.3

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

func MembuatGeojsonPolygon added in v0.0.3

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

func MembuatGeojsonPolyline added in v0.0.3

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

func MongoConnect added in v0.0.3

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

func Near added in v0.0.3

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

func NearSphere added in v0.0.3

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

func PostBox added in v0.0.3

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

func PostCenter added in v0.0.3

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

func PostGeoIntersects added in v0.0.3

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

func PostGeoWithin added in v0.0.3

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

func PostLinestring added in v0.0.3

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

func PostNear added in v0.0.3

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

func PostNearSphere added in v0.0.3

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

func PostPoint added in v0.0.3

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

func PostPolygon added in v0.0.3

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

func Registrasi added in v0.0.6

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

func ReplaceOneDoc added in v0.0.3

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

func ReturnString added in v0.0.6

func ReturnString(geojson []FullGeoJson) string

func ReturnStruct added in v0.0.3

func ReturnStruct(DataStuct any) (result string)

func SetConnection added in v0.0.3

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

func SetConnection2dsphere added in v0.0.3

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

func UpdateUser added in v0.0.6

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

func UsernameExists added in v0.0.6

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

Types

type CredentialUser added in v0.0.3

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

type DBInfo struct {
	DBString       string
	DBName         string
	CollectionName string
}

type FullGeoJson added in v0.0.3

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

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

type GeoJson added in v0.0.3

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

func GetAllBangunan added in v0.0.3

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

type GeoJsonLineString added in v0.0.3

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

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

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

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

type LongLat added in v0.0.3

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

type Payload added in v0.0.3

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.6

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

type Pesan added in v0.0.3

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

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

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

type Polyline added in v0.0.3

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

type Properties added in v0.0.3

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

type User added in v0.0.3

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

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

func GetAllUser added in v0.0.6

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