// NewGeoPolygonQuery creates and initializes a new GeoPolygonQuery.
496156
func NewGeoPolygonQuery(name string) *GeoPolygonQuery {
	return &GeoPolygonQuery{
		name:   name,
		points: make([]*GeoPoint, 0),
	}
}
555695
func Polygon(db XODB, v0 pgtypes.Path, v1 pgtypes.Box, v2 pgtypes.Circle, v3 int, v4 pgtypes.Circle) (pgtypes.Polygon, error) {
	var err error

	// sql query
	const sqlstr = `SELECT pg_catalog.polygon($1, $2, $3, $4, $5)`

	// run query
	var ret pgtypes.Polygon
	XOLog(sqlstr, v0, v1, v2, v3, v4)
	err = db.QueryRow(sqlstr, v0, v1, v2, v3, v4).Scan(&ret)
	if err != nil {
		return pgtypes.Polygon{}, err
	}

	return ret, nil
}
1188346
func (o *Enterprise) CreateEgressQOSPolicy(child *EgressQOSPolicy) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}
912561
func (q *GeoPolygonQuery) AddPoint(lat, lon float64) *GeoPolygonQuery {
	q.points = append(q.points, GeoPointFromLatLon(lat, lon))
	return q
}
1080456
func (q *GeoPolygonQuery) Source() (interface{}, error) {
	// "geo_polygon" : {
	//  	"person.location" : {
	//         "points" : [
	//             {"lat" : 40, "lon" : -70},
	//             {"lat" : 30, "lon" : -80},
	//             {"lat" : 20, "lon" : -90}
	//         ]
	//     }
	// }
	source := make(map[string]interface{})

	params := make(map[string]interface{})
	source["geo_polygon"] = params

	polygon := make(map[string]interface{})
	params[q.name] = polygon

	var points []interface{}
	for _, point := range q.points {
		points = append(points, point.Source())
	}
	polygon["points"] = points

	if q.queryName != "" {
		params["_name"] = q.queryName
	}

	return source, nil
}
358626
func (calc *LineCentroidCalculator) AddPolygon(polygon *geom.Polygon) *LineCentroidCalculator {
	for i := 0; i < polygon.NumLinearRings(); i++ {
		calc.AddLinearRing(polygon.LinearRing(i))
	}

	return calc
}
99612
func NewSuggesterGeoQuery(name string, location *GeoPoint) *SuggesterGeoQuery {
	return &SuggesterGeoQuery{
		name:       name,
		location:   location,
		neighbours: make([]string, 0),
	}
}
1064893
func NewPgsqlBuilder(db *DB, executor Executor) Builder {
	return &PgsqlBuilder{
		NewBaseBuilder(db, executor),
		NewBaseQueryBuilder(db),
	}
}
857952
func NewGpsCoordinates(Latitude float64, Longitude float64) *GpsCoordinates {
	s := new(GpsCoordinates)
	s.Latitude = Latitude
	s.Longitude = Longitude
	return s
}
1335548
func NewPGPPurge(g *libkb.GlobalContext, arg keybase1.PGPPurgeArg) *PGPPurge {
	return &PGPPurge{
		Contextified: libkb.NewContextified(g),
		arg:          arg,
	}
}
1297838
func NewNestedQuery(path string, query Query) *NestedQuery {
	return &NestedQuery{path: path, query: query}
}
1364344
func NewSearchSortGeoDistance(field string, lat, lon float64) *SearchSortGeoDistance {
	q := &SearchSortGeoDistance{newFtsSortBase()}
	q.options["by"] = "geo_distance"
	q.options["field"] = field
	q.options["location"] = []float64{lon, lat}
	return q
}
1100505
func (dht *IpfsDHT) newQuery(k string, f queryFunc) *dhtQuery {
	return &dhtQuery{
		key:         k,
		dht:         dht,
		qfunc:       f,
		concurrency: maxQueryConcurrency,
	}
}
1280083
func NewPolygonFlat(layout Layout, flatCoords []float64, ends []int) *Polygon {
	g := new(Polygon)
	g.layout = layout
	g.stride = layout.Stride()
	g.flatCoords = flatCoords
	g.ends = ends
	return g
}
747115
func NewQuery() *Query {
	return &Query{
		Metadata: make(flux.Metadata),
		results:  make(chan flux.Result, 1),
	}
}
191406
func NewPolyline(init ...*Polyline) *Polyline {
	var o *Polyline
	if len(init) == 1 {
		o = init[0]
	} else {
		o = new(Polyline)
	}
	return o.Init()
}
776890
func New() backend.Backend {
	s := &schema.Backend{
		Schema: map[string]*schema.Schema{
			"conn_str": &schema.Schema{
				Type:        schema.TypeString,
				Required:    true,
				Description: "Postgres connection string; a `postgres://` URL",
			},

			"schema_name": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Description: "Name of the automatically managed Postgres schema to store state",
				Default:     "terraform_remote_state",
			},
		},
	}

	result := &Backend{Backend: s}
	result.Backend.ConfigureFunc = result.configure
	return result
}