github.com/Ali-iotechsys/sqlboiler/v4@v4.0.0-20221208124957-6aec9a5f1f71/types/pgeo/main.go (about)

     1  // Package pgeo implements geometric types for Postgres
     2  //
     3  // Geometric types:
     4  // https://www.postgresql.org/docs/current/static/datatype-geometric.html
     5  //
     6  // Description:
     7  // https://github.com/saulortega/pgeo
     8  package pgeo
     9  
    10  // NewPoint creates a point
    11  func NewPoint(X, Y float64) Point {
    12  	return Point{X, Y}
    13  }
    14  
    15  // NewLine creates a line
    16  func NewLine(A, B, C float64) Line {
    17  	return Line{A, B, C}
    18  }
    19  
    20  // NewLseg creates a line segment
    21  func NewLseg(A, B Point) Lseg {
    22  	return Lseg([2]Point{A, B})
    23  }
    24  
    25  // NewBox creates a box
    26  func NewBox(A, B Point) Box {
    27  	return Box([2]Point{A, B})
    28  }
    29  
    30  // NewPath creates a path
    31  func NewPath(P []Point, C bool) Path {
    32  	return Path{P, C}
    33  }
    34  
    35  // NewPolygon creates a polygon
    36  func NewPolygon(P []Point) Polygon {
    37  	return Polygon(P)
    38  }
    39  
    40  // NewCircle creates a circle from a radius and a point
    41  func NewCircle(P Point, R float64) Circle {
    42  	return Circle{P, R}
    43  }
    44  
    45  // NewNullPoint creates a point which can be null
    46  func NewNullPoint(P Point, v bool) NullPoint {
    47  	return NullPoint{P, v}
    48  }
    49  
    50  // NewNullLine creates a line which can be null
    51  func NewNullLine(L Line, v bool) NullLine {
    52  	return NullLine{L, v}
    53  }
    54  
    55  // NewNullLseg creates a line segment which can be null
    56  func NewNullLseg(L Lseg, v bool) NullLseg {
    57  	return NullLseg{L, v}
    58  }
    59  
    60  // NewNullBox creates a box which can be null
    61  func NewNullBox(B Box, v bool) NullBox {
    62  	return NullBox{B, v}
    63  }
    64  
    65  // NewNullPath creates a path which can be null
    66  func NewNullPath(P Path, v bool) NullPath {
    67  	return NullPath{P, v}
    68  }
    69  
    70  // NewNullPolygon creates a polygon which can be null
    71  func NewNullPolygon(P Polygon, v bool) NullPolygon {
    72  	return NullPolygon{P, v}
    73  }
    74  
    75  // NewNullCircle creates a circle which can be null
    76  func NewNullCircle(C Circle, v bool) NullCircle {
    77  	return NullCircle{C, v}
    78  }