diff --git a/example_types_io_test.go b/example_types_io_test.go new file mode 100644 index 0000000..905b846 --- /dev/null +++ b/example_types_io_test.go @@ -0,0 +1,53 @@ +package gomeos + +// Every generated type reads and writes each format the catalog gives it under +// the portable name of the SQL function, From and As, +// and prints as its asText, a spatial value's points written as WKT. The +// examples reach the generated package as #ExampleTemporalFromPointer of +// example_pointer_boundary_test.go does, through the pointer both share. + +import ( + "fmt" + "unsafe" + + "github.com/MobilityDB/GoMEOS/types" +) + +func ExampleTGeomPointFromText() { + temp, err := types.TGeomPointFromText("[Point(1 1)@2024-12-06, Point(2 2)@2024-12-07]") + fmt.Println(temp, err) + // Output: + // [POINT(1 1)@2024-12-06 00:00:00+00, POINT(2 2)@2024-12-07 00:00:00+00] +} + +func ExampleTGeomPointFromEWKT() { + point, _ := types.TGeomPointFromEWKT("SRID=4326;Point(1 1)@2024-12-06") + ewkt, err := point.AsEWKT(15) + fmt.Println(ewkt, err) + // Output: + // SRID=4326;POINT(1 1)@2024-12-06 00:00:00+00 +} + +func ExampleTGeomPointFromHexEWKB() { + point, _ := types.TGeomPointFromEWKT("SRID=4326;Point(1 1)@2024-12-06") + var size uint64 // the size_t the writer states the length in + hex, _ := point.AsHexEWKB(0, unsafe.Pointer(&size)) + read, err := types.TGeomPointFromHexEWKB(hex) + fmt.Println(read, err) + // Output: + // POINT(1 1)@2024-12-06 00:00:00+00 +} + +func ExampleCbuffer_String() { + cbuffer, _ := types.CbufferFromText("Cbuffer(Point(1 1),0.5)") + fmt.Println(cbuffer) + // Output: + // Cbuffer(POINT(1 1),0.5) +} + +func ExampleFloatSpan_String() { + span, _ := types.FloatSpanFromText("[8, 10]") + fmt.Println(span) + // Output: + // [8, 10] +} diff --git a/functions/meos_meos.go b/functions/meos_meos.go index 6798070..0d19c3c 100644 --- a/functions/meos_meos.go +++ b/functions/meos_meos.go @@ -3675,6 +3675,28 @@ func TimestamptzTprecision(t int64, duration *Interval, torigin int64) (_r0 int6 } +// TstzsetScale wraps MEOS C function tstzset_scale. +func TstzsetScale(s *Set, duration *Interval) (_r0 *Set, _err error) { + C.meos_errno_reset() + _cret := C.tstzset_scale(s._inner, duration._inner) + if _err = meosError(); _err != nil { + return + } + return &Set{_inner: _cret}, nil +} + + +// TstzsetShift wraps MEOS C function tstzset_shift. +func TstzsetShift(s *Set, shift *Interval) (_r0 *Set, _err error) { + C.meos_errno_reset() + _cret := C.tstzset_shift(s._inner, shift._inner) + if _err = meosError(); _err != nil { + return + } + return &Set{_inner: _cret}, nil +} + + // TstzsetShiftScale wraps MEOS C function tstzset_shift_scale. func TstzsetShiftScale(s *Set, shift *Interval, duration *Interval) (_r0 *Set, _err error) { C.meos_errno_reset() @@ -3697,6 +3719,28 @@ func TstzsetTprecision(s *Set, duration *Interval, torigin int64) (_r0 *Set, _er } +// TstzspanScale wraps MEOS C function tstzspan_scale. +func TstzspanScale(s *Span, duration *Interval) (_r0 *Span, _err error) { + C.meos_errno_reset() + _cret := C.tstzspan_scale(s._inner, duration._inner) + if _err = meosError(); _err != nil { + return + } + return &Span{_inner: _cret}, nil +} + + +// TstzspanShift wraps MEOS C function tstzspan_shift. +func TstzspanShift(s *Span, shift *Interval) (_r0 *Span, _err error) { + C.meos_errno_reset() + _cret := C.tstzspan_shift(s._inner, shift._inner) + if _err = meosError(); _err != nil { + return + } + return &Span{_inner: _cret}, nil +} + + // TstzspanShiftScale wraps MEOS C function tstzspan_shift_scale. func TstzspanShiftScale(s *Span, shift *Interval, duration *Interval) (_r0 *Span, _err error) { C.meos_errno_reset() @@ -3719,6 +3763,28 @@ func TstzspanTprecision(s *Span, duration *Interval, torigin int64) (_r0 *Span, } +// TstzspansetScale wraps MEOS C function tstzspanset_scale. +func TstzspansetScale(ss *SpanSet, duration *Interval) (_r0 *SpanSet, _err error) { + C.meos_errno_reset() + _cret := C.tstzspanset_scale(ss._inner, duration._inner) + if _err = meosError(); _err != nil { + return + } + return &SpanSet{_inner: _cret}, nil +} + + +// TstzspansetShift wraps MEOS C function tstzspanset_shift. +func TstzspansetShift(ss *SpanSet, shift *Interval) (_r0 *SpanSet, _err error) { + C.meos_errno_reset() + _cret := C.tstzspanset_shift(ss._inner, shift._inner) + if _err = meosError(); _err != nil { + return + } + return &SpanSet{_inner: _cret}, nil +} + + // TstzspansetShiftScale wraps MEOS C function tstzspanset_shift_scale. func TstzspansetShiftScale(ss *SpanSet, shift *Interval, duration *Interval) (_r0 *SpanSet, _err error) { C.meos_errno_reset() @@ -9207,6 +9273,17 @@ func TintboxShiftScale(box *TBox, shift int, width int, hasshift bool, haswidth } +// TBOXScaleTime wraps MEOS C function tbox_scale_time. +func TBOXScaleTime(box *TBox, duration *Interval) (_r0 *TBox, _err error) { + C.meos_errno_reset() + _cret := C.tbox_scale_time(box._inner, duration._inner) + if _err = meosError(); _err != nil { + return + } + return &TBox{_inner: _cret}, nil +} + + // TBOXShiftScaleTime wraps MEOS C function tbox_shift_scale_time. func TBOXShiftScaleTime(box *TBox, shift *Interval, duration *Interval) (_r0 *TBox, _err error) { C.meos_errno_reset() @@ -9218,6 +9295,17 @@ func TBOXShiftScaleTime(box *TBox, shift *Interval, duration *Interval) (_r0 *TB } +// TBOXShiftTime wraps MEOS C function tbox_shift_time. +func TBOXShiftTime(box *TBox, shift *Interval) (_r0 *TBox, _err error) { + C.meos_errno_reset() + _cret := C.tbox_shift_time(box._inner, shift._inner) + if _err = meosError(); _err != nil { + return + } + return &TBox{_inner: _cret}, nil +} + + // TbigintboxExpand wraps MEOS C function tbigintbox_expand. func TbigintboxExpand(box *TBox, i int64) (_r0 *TBox, _err error) { C.meos_errno_reset() @@ -9405,6 +9493,402 @@ func RightTBOXTBOX(box1 *TBox, box2 *TBox) (_r0 bool, _err error) { } +// AdjacentNumspanTBOX wraps MEOS C function adjacent_numspan_tbox. +func AdjacentNumspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.adjacent_numspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// AdjacentTBOXNumspan wraps MEOS C function adjacent_tbox_numspan. +func AdjacentTBOXNumspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.adjacent_tbox_numspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// AdjacentTBOXTstzspan wraps MEOS C function adjacent_tbox_tstzspan. +func AdjacentTBOXTstzspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.adjacent_tbox_tstzspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// AdjacentTstzspanTBOX wraps MEOS C function adjacent_tstzspan_tbox. +func AdjacentTstzspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.adjacent_tstzspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// ContainedNumspanTBOX wraps MEOS C function contained_numspan_tbox. +func ContainedNumspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.contained_numspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// ContainedTBOXNumspan wraps MEOS C function contained_tbox_numspan. +func ContainedTBOXNumspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.contained_tbox_numspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// ContainedTBOXTstzspan wraps MEOS C function contained_tbox_tstzspan. +func ContainedTBOXTstzspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.contained_tbox_tstzspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// ContainedTstzspanTBOX wraps MEOS C function contained_tstzspan_tbox. +func ContainedTstzspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.contained_tstzspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// ContainsNumspanTBOX wraps MEOS C function contains_numspan_tbox. +func ContainsNumspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.contains_numspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// ContainsTBOXNumspan wraps MEOS C function contains_tbox_numspan. +func ContainsTBOXNumspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.contains_tbox_numspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// ContainsTBOXTstzspan wraps MEOS C function contains_tbox_tstzspan. +func ContainsTBOXTstzspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.contains_tbox_tstzspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// ContainsTstzspanTBOX wraps MEOS C function contains_tstzspan_tbox. +func ContainsTstzspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.contains_tstzspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// OverlapsNumspanTBOX wraps MEOS C function overlaps_numspan_tbox. +func OverlapsNumspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.overlaps_numspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// OverlapsTBOXNumspan wraps MEOS C function overlaps_tbox_numspan. +func OverlapsTBOXNumspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.overlaps_tbox_numspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// OverlapsTBOXTstzspan wraps MEOS C function overlaps_tbox_tstzspan. +func OverlapsTBOXTstzspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.overlaps_tbox_tstzspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// OverlapsTstzspanTBOX wraps MEOS C function overlaps_tstzspan_tbox. +func OverlapsTstzspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.overlaps_tstzspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// SameNumspanTBOX wraps MEOS C function same_numspan_tbox. +func SameNumspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.same_numspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// SameTBOXNumspan wraps MEOS C function same_tbox_numspan. +func SameTBOXNumspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.same_tbox_numspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// SameTBOXTstzspan wraps MEOS C function same_tbox_tstzspan. +func SameTBOXTstzspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.same_tbox_tstzspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// SameTstzspanTBOX wraps MEOS C function same_tstzspan_tbox. +func SameTstzspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.same_tstzspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// AfterTBOXTstzspan wraps MEOS C function after_tbox_tstzspan. +func AfterTBOXTstzspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.after_tbox_tstzspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// AfterTstzspanTBOX wraps MEOS C function after_tstzspan_tbox. +func AfterTstzspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.after_tstzspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// BeforeTBOXTstzspan wraps MEOS C function before_tbox_tstzspan. +func BeforeTBOXTstzspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.before_tbox_tstzspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// BeforeTstzspanTBOX wraps MEOS C function before_tstzspan_tbox. +func BeforeTstzspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.before_tstzspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// LeftNumspanTBOX wraps MEOS C function left_numspan_tbox. +func LeftNumspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.left_numspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// LeftTBOXNumspan wraps MEOS C function left_tbox_numspan. +func LeftTBOXNumspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.left_tbox_numspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// OverafterTBOXTstzspan wraps MEOS C function overafter_tbox_tstzspan. +func OverafterTBOXTstzspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.overafter_tbox_tstzspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// OverafterTstzspanTBOX wraps MEOS C function overafter_tstzspan_tbox. +func OverafterTstzspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.overafter_tstzspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// OverbeforeTBOXTstzspan wraps MEOS C function overbefore_tbox_tstzspan. +func OverbeforeTBOXTstzspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.overbefore_tbox_tstzspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// OverbeforeTstzspanTBOX wraps MEOS C function overbefore_tstzspan_tbox. +func OverbeforeTstzspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.overbefore_tstzspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// OverleftNumspanTBOX wraps MEOS C function overleft_numspan_tbox. +func OverleftNumspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.overleft_numspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// OverleftTBOXNumspan wraps MEOS C function overleft_tbox_numspan. +func OverleftTBOXNumspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.overleft_tbox_numspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// OverrightNumspanTBOX wraps MEOS C function overright_numspan_tbox. +func OverrightNumspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.overright_numspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// OverrightTBOXNumspan wraps MEOS C function overright_tbox_numspan. +func OverrightTBOXNumspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.overright_tbox_numspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// RightNumspanTBOX wraps MEOS C function right_numspan_tbox. +func RightNumspanTBOX(s *Span, box *TBox) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.right_numspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + +// RightTBOXNumspan wraps MEOS C function right_tbox_numspan. +func RightTBOXNumspan(box *TBox, s *Span) (_r0 bool, _err error) { + C.meos_errno_reset() + _cret := C.right_tbox_numspan(box._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), nil +} + + // TBOXCmp wraps MEOS C function tbox_cmp. func TBOXCmp(box1 *TBox, box2 *TBox) (_r0 int, _err error) { C.meos_errno_reset() @@ -15531,6 +16015,17 @@ func TdistanceTnumberTnumber(temp1 *Temporal, temp2 *Temporal) (_r0 *Temporal, _ } +// NadBigintspanTBOX wraps MEOS C function nad_bigintspan_tbox. +func NadBigintspanTBOX(s *Span, box *TBox) (_r0 int64, _err error) { + C.meos_errno_reset() + _cret := C.nad_bigintspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return int64(_cret), nil +} + + // NadTboxfloatTboxfloat wraps MEOS C function nad_tboxfloat_tboxfloat. func NadTboxfloatTboxfloat(box1 *TBox, box2 *TBox) (_r0 float64, _err error) { C.meos_errno_reset() @@ -15542,6 +16037,17 @@ func NadTboxfloatTboxfloat(box1 *TBox, box2 *TBox) (_r0 float64, _err error) { } +// NadFloatspanTBOX wraps MEOS C function nad_floatspan_tbox. +func NadFloatspanTBOX(s *Span, box *TBox) (_r0 float64, _err error) { + C.meos_errno_reset() + _cret := C.nad_floatspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return float64(_cret), nil +} + + // NadTboxintTboxint wraps MEOS C function nad_tboxint_tboxint. func NadTboxintTboxint(box1 *TBox, box2 *TBox) (_r0 int, _err error) { C.meos_errno_reset() @@ -15553,6 +16059,17 @@ func NadTboxintTboxint(box1 *TBox, box2 *TBox) (_r0 int, _err error) { } +// NadIntspanTBOX wraps MEOS C function nad_intspan_tbox. +func NadIntspanTBOX(s *Span, box *TBox) (_r0 int, _err error) { + C.meos_errno_reset() + _cret := C.nad_intspan_tbox(s._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return int(_cret), nil +} + + // NadTfloatFloat wraps MEOS C function nad_tfloat_float. func NadTfloatFloat(temp *Temporal, d float64) (_r0 float64, _err error) { C.meos_errno_reset() @@ -15564,6 +16081,17 @@ func NadTfloatFloat(temp *Temporal, d float64) (_r0 float64, _err error) { } +// NadTfloatFloatspan wraps MEOS C function nad_tfloat_floatspan. +func NadTfloatFloatspan(temp *Temporal, s *Span) (_r0 float64, _err error) { + C.meos_errno_reset() + _cret := C.nad_tfloat_floatspan(temp._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return float64(_cret), nil +} + + // NadTfloatTfloat wraps MEOS C function nad_tfloat_tfloat. func NadTfloatTfloat(temp1 *Temporal, temp2 *Temporal) (_r0 float64, _err error) { C.meos_errno_reset() @@ -15597,6 +16125,17 @@ func NadTbigintBigint(temp *Temporal, i int64) (_r0 int64, _err error) { } +// NadTbigintBigintspan wraps MEOS C function nad_tbigint_bigintspan. +func NadTbigintBigintspan(temp *Temporal, s *Span) (_r0 int64, _err error) { + C.meos_errno_reset() + _cret := C.nad_tbigint_bigintspan(temp._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return int64(_cret), nil +} + + // NadTbigintTBOX wraps MEOS C function nad_tbigint_tbox. func NadTbigintTBOX(temp *Temporal, box *TBox) (_r0 int64, _err error) { C.meos_errno_reset() @@ -15641,6 +16180,17 @@ func NadTintInt(temp *Temporal, i int) (_r0 int, _err error) { } +// NadTintIntspan wraps MEOS C function nad_tint_intspan. +func NadTintIntspan(temp *Temporal, s *Span) (_r0 int, _err error) { + C.meos_errno_reset() + _cret := C.nad_tint_intspan(temp._inner, s._inner) + if _err = meosError(); _err != nil { + return + } + return int(_cret), nil +} + + // NadTintTBOX wraps MEOS C function nad_tint_tbox. func NadTintTBOX(temp *Temporal, box *TBox) (_r0 int, _err error) { C.meos_errno_reset() diff --git a/functions/meos_meos_cbuffer.go b/functions/meos_meos_cbuffer.go index 90b6f07..d1ad423 100644 --- a/functions/meos_meos_cbuffer.go +++ b/functions/meos_meos_cbuffer.go @@ -813,6 +813,17 @@ func UnionSetCbuffer(s *Set, cb *Cbuffer) (_r0 *Set, _err error) { } +// DistanceCbuffersetCbufferset wraps MEOS C function distance_cbufferset_cbufferset. +func DistanceCbuffersetCbufferset(s1 *Set, s2 *Set) (_r0 float64, _err error) { + C.meos_errno_reset() + _cret := C.distance_cbufferset_cbufferset(s1._inner, s2._inner) + if _err = meosError(); _err != nil { + return + } + return float64(_cret), nil +} + + // TcbufferIn wraps MEOS C function tcbuffer_in. func TcbufferIn(str string) (_r0 *Temporal, _err error) { _c_str := C.CString(str) diff --git a/functions/meos_meos_geo.go b/functions/meos_meos_geo.go index 1f1fd6a..494c7f6 100644 --- a/functions/meos_meos_geo.go +++ b/functions/meos_meos_geo.go @@ -728,9 +728,20 @@ func GeoScale(gs *Geom, xfactor float64, yfactor float64, zfactor float64) (_r0 // GeoScaleGeo wraps MEOS C function geo_scale_geo. -func GeoScaleGeo(gs *Geom, scale *Geom, sorigin *Geom) (_r0 *Geom, _err error) { +func GeoScaleGeo(gs *Geom, scale *Geom) (_r0 *Geom, _err error) { C.meos_errno_reset() - _cret := C.geo_scale_geo(gs._inner, scale._inner, sorigin._inner) + _cret := C.geo_scale_geo(gs._inner, scale._inner) + if _err = meosError(); _err != nil { + return + } + return &Geom{_inner: _cret}, nil +} + + +// GeoScaleGeoOrigin wraps MEOS C function geo_scale_geo_origin. +func GeoScaleGeoOrigin(gs *Geom, scale *Geom, sorigin *Geom) (_r0 *Geom, _err error) { + C.meos_errno_reset() + _cret := C.geo_scale_geo_origin(gs._inner, scale._inner, sorigin._inner) if _err = meosError(); _err != nil { return } @@ -2324,6 +2335,17 @@ func STBOXRound(box *STBox, maxdd int) (_r0 *STBox, _err error) { } +// STBOXScaleTime wraps MEOS C function stbox_scale_time. +func STBOXScaleTime(box *STBox, duration *Interval) (_r0 *STBox, _err error) { + C.meos_errno_reset() + _cret := C.stbox_scale_time(box._inner, duration._inner) + if _err = meosError(); _err != nil { + return + } + return &STBox{_inner: _cret}, nil +} + + // STBOXShiftScaleTime wraps MEOS C function stbox_shift_scale_time. func STBOXShiftScaleTime(box *STBox, shift *Interval, duration *Interval) (_r0 *STBox, _err error) { C.meos_errno_reset() @@ -2335,6 +2357,17 @@ func STBOXShiftScaleTime(box *STBox, shift *Interval, duration *Interval) (_r0 * } +// STBOXShiftTime wraps MEOS C function stbox_shift_time. +func STBOXShiftTime(box *STBox, shift *Interval) (_r0 *STBox, _err error) { + C.meos_errno_reset() + _cret := C.stbox_shift_time(box._inner, shift._inner) + if _err = meosError(); _err != nil { + return + } + return &STBox{_inner: _cret}, nil +} + + // StboxarrRound wraps MEOS C function stboxarr_round. func StboxarrRound(boxarr *STBox, count int, maxdd int) (_r0 *STBox, _err error) { C.meos_errno_reset() @@ -3529,9 +3562,20 @@ func TgeoScale(temp *Temporal, xfactor float64, yfactor float64, zfactor float64 // TgeoScaleGeo wraps MEOS C function tgeo_scale_geo. -func TgeoScaleGeo(temp *Temporal, scale *Geom, sorigin *Geom) (_r0 *Temporal, _err error) { +func TgeoScaleGeo(temp *Temporal, scale *Geom) (_r0 *Temporal, _err error) { + C.meos_errno_reset() + _cret := C.tgeo_scale_geo(temp._inner, scale._inner) + if _err = meosError(); _err != nil { + return + } + return &Temporal{_inner: _cret}, nil +} + + +// TgeoScaleGeoOrigin wraps MEOS C function tgeo_scale_geo_origin. +func TgeoScaleGeoOrigin(temp *Temporal, scale *Geom, sorigin *Geom) (_r0 *Temporal, _err error) { C.meos_errno_reset() - _cret := C.tgeo_scale_geo(temp._inner, scale._inner, sorigin._inner) + _cret := C.tgeo_scale_geo_origin(temp._inner, scale._inner, sorigin._inner) if _err = meosError(); _err != nil { return } diff --git a/functions/meos_meos_internal.go b/functions/meos_meos_internal.go index e86005a..54b498d 100644 --- a/functions/meos_meos_internal.go +++ b/functions/meos_meos_internal.go @@ -447,6 +447,39 @@ func IntspanSetFloatspan(s1 *Span, s2 *Span) (_err error) { } +// TstzsetShiftScaleIntl wraps MEOS C function tstzset_shift_scale_intl. +func TstzsetShiftScaleIntl(s *Set, shift *Interval, duration *Interval) (_r0 *Set, _err error) { + C.meos_errno_reset() + _cret := C.tstzset_shift_scale_intl(s._inner, shift._inner, duration._inner) + if _err = meosError(); _err != nil { + return + } + return &Set{_inner: _cret}, nil +} + + +// TstzspanShiftScaleIntl wraps MEOS C function tstzspan_shift_scale_intl. +func TstzspanShiftScaleIntl(s *Span, shift *Interval, duration *Interval) (_r0 *Span, _err error) { + C.meos_errno_reset() + _cret := C.tstzspan_shift_scale_intl(s._inner, shift._inner, duration._inner) + if _err = meosError(); _err != nil { + return + } + return &Span{_inner: _cret}, nil +} + + +// TstzspansetShiftScaleIntl wraps MEOS C function tstzspanset_shift_scale_intl. +func TstzspansetShiftScaleIntl(ss *SpanSet, shift *Interval, duration *Interval) (_r0 *SpanSet, _err error) { + C.meos_errno_reset() + _cret := C.tstzspanset_shift_scale_intl(ss._inner, shift._inner, duration._inner) + if _err = meosError(); _err != nil { + return + } + return &SpanSet{_inner: _cret}, nil +} + + // SetCompact wraps MEOS C function set_compact. func SetCompact(s *Set) (_r0 *Set, _err error) { C.meos_errno_reset() @@ -917,6 +950,17 @@ func TstzspanSetTBOX(s *Span, box *TBox) (_err error) { } +// TBOXShiftScaleTimeIntl wraps MEOS C function tbox_shift_scale_time_intl. +func TBOXShiftScaleTimeIntl(box *TBox, shift *Interval, duration *Interval) (_r0 *TBox, _err error) { + C.meos_errno_reset() + _cret := C.tbox_shift_scale_time_intl(box._inner, shift._inner, duration._inner) + if _err = meosError(); _err != nil { + return + } + return &TBox{_inner: _cret}, nil +} + + // TBOXExpand wraps MEOS C function tbox_expand. func TBOXExpand(box1 *TBox, box2 *TBox) (_err error) { C.meos_errno_reset() @@ -2217,6 +2261,17 @@ func TinstantAsTsequenceset(inst *TInstant, interp Interpolation) (_r0 *TSequenc } +// TemporalShiftScaleTimeIntl wraps MEOS C function temporal_shift_scale_time_intl. +func TemporalShiftScaleTimeIntl(temp *Temporal, shift *Interval, duration *Interval) (_r0 *Temporal, _err error) { + C.meos_errno_reset() + _cret := C.temporal_shift_scale_time_intl(temp._inner, shift._inner, duration._inner) + if _err = meosError(); _err != nil { + return + } + return &Temporal{_inner: _cret}, nil +} + + // TsequenceRestart wraps MEOS C function tsequence_restart. func TsequenceRestart(seq *TSequence, count int) (_err error) { C.meos_errno_reset() diff --git a/functions/meos_meos_internal_geo.go b/functions/meos_meos_internal_geo.go index 9b2b264..e2df940 100644 --- a/functions/meos_meos_internal_geo.go +++ b/functions/meos_meos_internal_geo.go @@ -127,6 +127,17 @@ func PointRound(gs *Geom, maxdd int) (_r0 *Geom, _err error) { } +// GeoScaleGeoIntl wraps MEOS C function geo_scale_geo_intl. +func GeoScaleGeoIntl(gs *Geom, scale *Geom, sorigin *Geom) (_r0 *Geom, _err error) { + C.meos_errno_reset() + _cret := C.geo_scale_geo_intl(gs._inner, scale._inner, sorigin._inner) + if _err = meosError(); _err != nil { + return + } + return &Geom{_inner: _cret}, nil +} + + // STBOXSet wraps MEOS C function stbox_set. func STBOXSet(hasx bool, hasz bool, geodetic bool, srid int32, xmin float64, xmax float64, ymin float64, ymax float64, zmin float64, zmax float64, s *Span) (_r0 *STBox, _err error) { var _out_result C.STBox @@ -270,6 +281,17 @@ func STBOXExpandSpaceSet(box *STBox, d float64) (_r0 bool, _r1 *STBox, _err erro } +// STBOXShiftScaleTimeIntl wraps MEOS C function stbox_shift_scale_time_intl. +func STBOXShiftScaleTimeIntl(box *STBox, shift *Interval, duration *Interval) (_r0 *STBox, _err error) { + C.meos_errno_reset() + _cret := C.stbox_shift_scale_time_intl(box._inner, shift._inner, duration._inner) + if _err = meosError(); _err != nil { + return + } + return &STBox{_inner: _cret}, nil +} + + // STBOXContains wraps MEOS C function stbox_contains. func STBOXContains(box1 *STBox, box2 *STBox) (_r0 bool, _err error) { C.meos_errno_reset() @@ -691,6 +713,17 @@ func TgeometryseqsetIn(str string) (_r0 *TSequenceSet, _err error) { } +// TgeoScaleGeoIntl wraps MEOS C function tgeo_scale_geo_intl. +func TgeoScaleGeoIntl(temp *Temporal, scale *Geom, sorigin *Geom) (_r0 *Temporal, _err error) { + C.meos_errno_reset() + _cret := C.tgeo_scale_geo_intl(temp._inner, scale._inner, sorigin._inner) + if _err = meosError(); _err != nil { + return + } + return &Temporal{_inner: _cret}, nil +} + + // TspatialSetSTBOX wraps MEOS C function tspatial_set_stbox. func TspatialSetSTBOX(temp *Temporal) (_r0 *STBox, _err error) { var _out_result C.STBox diff --git a/functions/meos_meos_json.go b/functions/meos_meos_json.go index 23e3964..4a7d253 100644 --- a/functions/meos_meos_json.go +++ b/functions/meos_meos_json.go @@ -1464,6 +1464,28 @@ func JsonbsetObjectFieldCommon(set *Set, key string, astext bool, null_handle Nu } +// JsonbsetPathExistsIntl wraps MEOS C function jsonbset_path_exists_intl. +func JsonbsetPathExistsIntl(set *Set, jp *JsonPath, vars *Jsonb, silent bool, tz bool, count unsafe.Pointer) (_r0 unsafe.Pointer, _err error) { + C.meos_errno_reset() + _cret := C.jsonbset_path_exists_intl(set._inner, jp._inner, vars._inner, C.bool(silent), C.bool(tz), (*C.int)(unsafe.Pointer(count))) + if _err = meosError(); _err != nil { + return + } + return unsafe.Pointer(_cret), nil +} + + +// JsonbsetPathMatchIntl wraps MEOS C function jsonbset_path_match_intl. +func JsonbsetPathMatchIntl(set *Set, jp *JsonPath, vars *Jsonb, silent bool, tz bool, count unsafe.Pointer) (_r0 unsafe.Pointer, _err error) { + C.meos_errno_reset() + _cret := C.jsonbset_path_match_intl(set._inner, jp._inner, vars._inner, C.bool(silent), C.bool(tz), (*C.int)(unsafe.Pointer(count))) + if _err = meosError(); _err != nil { + return + } + return unsafe.Pointer(_cret), nil +} + + // ContainedJsonbSet wraps MEOS C function contained_jsonb_set. func ContainedJsonbSet(jb *Jsonb, s *Set) (_r0 bool, _err error) { C.meos_errno_reset() @@ -2338,6 +2360,28 @@ func TjsonbObjectFieldCommon(temp *Temporal, key string, astext bool, null_handl } +// TjsonbPathExistsIntl wraps MEOS C function tjsonb_path_exists_intl. +func TjsonbPathExistsIntl(temp *Temporal, jp *JsonPath, vars *Jsonb, silent bool, tz bool) (_r0 *Temporal, _err error) { + C.meos_errno_reset() + _cret := C.tjsonb_path_exists_intl(temp._inner, jp._inner, vars._inner, C.bool(silent), C.bool(tz)) + if _err = meosError(); _err != nil { + return + } + return &Temporal{_inner: _cret}, nil +} + + +// TjsonbPathMatchIntl wraps MEOS C function tjsonb_path_match_intl. +func TjsonbPathMatchIntl(temp *Temporal, jp *JsonPath, vars *Jsonb, silent bool, tz bool) (_r0 *Temporal, _err error) { + C.meos_errno_reset() + _cret := C.tjsonb_path_match_intl(temp._inner, jp._inner, vars._inner, C.bool(silent), C.bool(tz)) + if _err = meosError(); _err != nil { + return + } + return &Temporal{_inner: _cret}, nil +} + + // TjsonbAtValue wraps MEOS C function tjsonb_at_value. func TjsonbAtValue(temp *Temporal, jsb *Jsonb) (_r0 *Temporal, _err error) { C.meos_errno_reset() diff --git a/functions/meos_meos_npoint.go b/functions/meos_meos_npoint.go index e8ce3a6..4f23cb4 100644 --- a/functions/meos_meos_npoint.go +++ b/functions/meos_meos_npoint.go @@ -1007,6 +1007,17 @@ func UnionSetNpoint(s *Set, np *Npoint) (_r0 *Set, _err error) { } +// DistanceNpointsetNpointset wraps MEOS C function distance_npointset_npointset. +func DistanceNpointsetNpointset(s1 *Set, s2 *Set) (_r0 float64, _err error) { + C.meos_errno_reset() + _cret := C.distance_npointset_npointset(s1._inner, s2._inner) + if _err = meosError(); _err != nil { + return + } + return float64(_cret), nil +} + + // TnpointIn wraps MEOS C function tnpoint_in. func TnpointIn(str string) (_r0 *Temporal, _err error) { _c_str := C.CString(str) diff --git a/functions/meos_meos_pointcloud.go b/functions/meos_meos_pointcloud.go index a00aead..8f7cded 100644 --- a/functions/meos_meos_pointcloud.go +++ b/functions/meos_meos_pointcloud.go @@ -2393,6 +2393,17 @@ func TpcpatchNpoints(temp *Temporal) (_r0 int64, _err error) { } +// TpcpatchSwath wraps MEOS C function tpcpatch_swath. +func TpcpatchSwath(temp *Temporal, maxt *Interval) (_r0 *Geom, _err error) { + C.meos_errno_reset() + _cret := C.tpcpatch_swath(temp._inner, maxt._inner) + if _err = meosError(); _err != nil { + return + } + return &Geom{_inner: _cret}, nil +} + + // EverEqPcpointTpcpoint wraps MEOS C function ever_eq_pcpoint_tpcpoint. func EverEqPcpointTpcpoint(pt *Pcpoint, temp *Temporal) (_r0 int, _err error) { C.meos_errno_reset() diff --git a/functions/meos_meos_pose.go b/functions/meos_meos_pose.go index a970bd4..6482e87 100644 --- a/functions/meos_meos_pose.go +++ b/functions/meos_meos_pose.go @@ -1111,6 +1111,17 @@ func UnionSetPose(s *Set, pose *Pose) (_r0 *Set, _err error) { } +// DistancePosesetPoseset wraps MEOS C function distance_poseset_poseset. +func DistancePosesetPoseset(s1 *Set, s2 *Set) (_r0 float64, _err error) { + C.meos_errno_reset() + _cret := C.distance_poseset_poseset(s1._inner, s2._inner) + if _err = meosError(); _err != nil { + return + } + return float64(_cret), nil +} + + // TposeFromMFJSON wraps MEOS C function tpose_from_mfjson. func TposeFromMFJSON(str string) (_r0 *Temporal, _err error) { _c_str := C.CString(str) @@ -2265,6 +2276,39 @@ func PosechainGe(pc1 unsafe.Pointer, pc2 unsafe.Pointer) (_r0 bool, _err error) } +// DistancePosechainGeo wraps MEOS C function distance_posechain_geo. +func DistancePosechainGeo(pc unsafe.Pointer, gs *Geom) (_r0 float64, _err error) { + C.meos_errno_reset() + _cret := C.distance_posechain_geo((*C.PoseChain)(unsafe.Pointer(pc)), gs._inner) + if _err = meosError(); _err != nil { + return + } + return float64(_cret), nil +} + + +// DistancePosechainPosechain wraps MEOS C function distance_posechain_posechain. +func DistancePosechainPosechain(pc1 unsafe.Pointer, pc2 unsafe.Pointer) (_r0 float64, _err error) { + C.meos_errno_reset() + _cret := C.distance_posechain_posechain((*C.PoseChain)(unsafe.Pointer(pc1)), (*C.PoseChain)(unsafe.Pointer(pc2))) + if _err = meosError(); _err != nil { + return + } + return float64(_cret), nil +} + + +// DistancePosechainSTBOX wraps MEOS C function distance_posechain_stbox. +func DistancePosechainSTBOX(pc unsafe.Pointer, box *STBox) (_r0 float64, _err error) { + C.meos_errno_reset() + _cret := C.distance_posechain_stbox((*C.PoseChain)(unsafe.Pointer(pc)), box._inner) + if _err = meosError(); _err != nil { + return + } + return float64(_cret), nil +} + + // PosechainsetIn wraps MEOS C function posechainset_in. func PosechainsetIn(str string) (_r0 *Set, _err error) { _c_str := C.CString(str) @@ -2448,6 +2492,17 @@ func UnionSetPosechain(s *Set, pc unsafe.Pointer) (_r0 *Set, _err error) { } +// DistancePosechainsetPosechainset wraps MEOS C function distance_posechainset_posechainset. +func DistancePosechainsetPosechainset(s1 *Set, s2 *Set) (_r0 float64, _err error) { + C.meos_errno_reset() + _cret := C.distance_posechainset_posechainset(s1._inner, s2._inner) + if _err = meosError(); _err != nil { + return + } + return float64(_cret), nil +} + + // TposechainIn wraps MEOS C function tposechain_in. func TposechainIn(str string) (_r0 *Temporal, _err error) { _c_str := C.CString(str) @@ -2584,6 +2639,10 @@ func TposechainValue(temp *Temporal) (_r0 unsafe.Pointer, _err error) { } +// TODO tposechain_value_at_timestamptz: unhandled OUTPUT_SCALAR shape PoseChain ** +// func TposechainValueAtTimestamptz(...) { /* not yet handled by codegen */ } + + // TODO tposechain_value_n: unhandled OUTPUT_SCALAR shape PoseChain ** // func TposechainValueN(...) { /* not yet handled by codegen */ } @@ -2687,6 +2746,149 @@ func TposechainMinusValue(temp *Temporal, pc unsafe.Pointer) (_r0 *Temporal, _er } +// TdistanceTposechainGeo wraps MEOS C function tdistance_tposechain_geo. +func TdistanceTposechainGeo(temp *Temporal, gs *Geom) (_r0 *Temporal, _err error) { + C.meos_errno_reset() + _cret := C.tdistance_tposechain_geo(temp._inner, gs._inner) + if _err = meosError(); _err != nil { + return + } + return &Temporal{_inner: _cret}, nil +} + + +// TdistanceTposechainPosechain wraps MEOS C function tdistance_tposechain_posechain. +func TdistanceTposechainPosechain(temp *Temporal, pc unsafe.Pointer) (_r0 *Temporal, _err error) { + C.meos_errno_reset() + _cret := C.tdistance_tposechain_posechain(temp._inner, (*C.PoseChain)(unsafe.Pointer(pc))) + if _err = meosError(); _err != nil { + return + } + return &Temporal{_inner: _cret}, nil +} + + +// TdistanceTposechainTposechain wraps MEOS C function tdistance_tposechain_tposechain. +func TdistanceTposechainTposechain(temp1 *Temporal, temp2 *Temporal) (_r0 *Temporal, _err error) { + C.meos_errno_reset() + _cret := C.tdistance_tposechain_tposechain(temp1._inner, temp2._inner) + if _err = meosError(); _err != nil { + return + } + return &Temporal{_inner: _cret}, nil +} + + +// NadTposechainGeo wraps MEOS C function nad_tposechain_geo. +func NadTposechainGeo(temp *Temporal, gs *Geom) (_r0 float64, _err error) { + C.meos_errno_reset() + _cret := C.nad_tposechain_geo(temp._inner, gs._inner) + if _err = meosError(); _err != nil { + return + } + return float64(_cret), nil +} + + +// NadTposechainPosechain wraps MEOS C function nad_tposechain_posechain. +func NadTposechainPosechain(temp *Temporal, pc unsafe.Pointer) (_r0 float64, _err error) { + C.meos_errno_reset() + _cret := C.nad_tposechain_posechain(temp._inner, (*C.PoseChain)(unsafe.Pointer(pc))) + if _err = meosError(); _err != nil { + return + } + return float64(_cret), nil +} + + +// NadTposechainSTBOX wraps MEOS C function nad_tposechain_stbox. +func NadTposechainSTBOX(temp *Temporal, box *STBox) (_r0 float64, _err error) { + C.meos_errno_reset() + _cret := C.nad_tposechain_stbox(temp._inner, box._inner) + if _err = meosError(); _err != nil { + return + } + return float64(_cret), nil +} + + +// NadTposechainTposechain wraps MEOS C function nad_tposechain_tposechain. +func NadTposechainTposechain(temp1 *Temporal, temp2 *Temporal) (_r0 float64, _err error) { + C.meos_errno_reset() + _cret := C.nad_tposechain_tposechain(temp1._inner, temp2._inner) + if _err = meosError(); _err != nil { + return + } + return float64(_cret), nil +} + + +// NaiTposechainGeo wraps MEOS C function nai_tposechain_geo. +func NaiTposechainGeo(temp *Temporal, gs *Geom) (_r0 *TInstant, _err error) { + C.meos_errno_reset() + _cret := C.nai_tposechain_geo(temp._inner, gs._inner) + if _err = meosError(); _err != nil { + return + } + return &TInstant{_inner: _cret}, nil +} + + +// NaiTposechainPosechain wraps MEOS C function nai_tposechain_posechain. +func NaiTposechainPosechain(temp *Temporal, pc unsafe.Pointer) (_r0 *TInstant, _err error) { + C.meos_errno_reset() + _cret := C.nai_tposechain_posechain(temp._inner, (*C.PoseChain)(unsafe.Pointer(pc))) + if _err = meosError(); _err != nil { + return + } + return &TInstant{_inner: _cret}, nil +} + + +// NaiTposechainTposechain wraps MEOS C function nai_tposechain_tposechain. +func NaiTposechainTposechain(temp1 *Temporal, temp2 *Temporal) (_r0 *TInstant, _err error) { + C.meos_errno_reset() + _cret := C.nai_tposechain_tposechain(temp1._inner, temp2._inner) + if _err = meosError(); _err != nil { + return + } + return &TInstant{_inner: _cret}, nil +} + + +// ShortestlineTposechainGeo wraps MEOS C function shortestline_tposechain_geo. +func ShortestlineTposechainGeo(temp *Temporal, gs *Geom) (_r0 *Geom, _err error) { + C.meos_errno_reset() + _cret := C.shortestline_tposechain_geo(temp._inner, gs._inner) + if _err = meosError(); _err != nil { + return + } + return &Geom{_inner: _cret}, nil +} + + +// ShortestlineTposechainPosechain wraps MEOS C function shortestline_tposechain_posechain. +func ShortestlineTposechainPosechain(temp *Temporal, pc unsafe.Pointer) (_r0 *Geom, _err error) { + C.meos_errno_reset() + _cret := C.shortestline_tposechain_posechain(temp._inner, (*C.PoseChain)(unsafe.Pointer(pc))) + if _err = meosError(); _err != nil { + return + } + return &Geom{_inner: _cret}, nil +} + + +// ShortestlineTposechainTposechain wraps MEOS C function shortestline_tposechain_tposechain. +func ShortestlineTposechainTposechain(temp1 *Temporal, temp2 *Temporal) (_r0 *Geom, _err error) { + C.meos_errno_reset() + _cret := C.shortestline_tposechain_tposechain(temp1._inner, temp2._inner) + if _err = meosError(); _err != nil { + return + } + return &Geom{_inner: _cret}, nil +} + + // AlwaysEqPosechainTposechain wraps MEOS C function always_eq_posechain_tposechain. func AlwaysEqPosechainTposechain(posechain unsafe.Pointer, temp *Temporal) (_r0 int, _err error) { C.meos_errno_reset() diff --git a/functions/meos_meos_quadbin.go b/functions/meos_meos_quadbin.go index 2b787fb..3e0391a 100644 --- a/functions/meos_meos_quadbin.go +++ b/functions/meos_meos_quadbin.go @@ -1354,3 +1354,14 @@ func TquadbinCellToQuadkey(temp *Temporal) (_r0 *Temporal, _err error) { return &Temporal{_inner: _cret}, nil } + +// TquadbinGridDistance wraps MEOS C function tquadbin_grid_distance. +func TquadbinGridDistance(origin *Temporal, dest *Temporal) (_r0 *Temporal, _err error) { + C.meos_errno_reset() + _cret := C.tquadbin_grid_distance(origin._inner, dest._inner) + if _err = meosError(); _err != nil { + return + } + return &Temporal{_inner: _cret}, nil +} + diff --git a/functions/meos_meos_raster.go b/functions/meos_meos_raster.go index f8ae8b9..3c5aa39 100644 --- a/functions/meos_meos_raster.go +++ b/functions/meos_meos_raster.go @@ -836,9 +836,9 @@ func RasterValueCount(rast unsafe.Pointer, band int, exclude_nodata bool, search // RasterSetValues wraps MEOS C function raster_set_values. -func RasterSetValues(rast unsafe.Pointer, band int, x int, y int, width int, height int, values unsafe.Pointer, nodata unsafe.Pointer, noset unsafe.Pointer, count int, keepnodata bool) (_r0 unsafe.Pointer, _err error) { +func RasterSetValues(rast unsafe.Pointer, band int, x int, y int, width int, height int, values unsafe.Pointer, nodata unsafe.Pointer, noset unsafe.Pointer, nosetwidth int, nosetheight int, count int, keepnodata bool) (_r0 unsafe.Pointer, _err error) { C.meos_errno_reset() - _cret := C.raster_set_values((*C.Raster)(unsafe.Pointer(rast)), C.int(band), C.int(x), C.int(y), C.int(width), C.int(height), (*C.double)(unsafe.Pointer(values)), (*C.bool)(unsafe.Pointer(nodata)), (*C.bool)(unsafe.Pointer(noset)), C.int(count), C.bool(keepnodata)) + _cret := C.raster_set_values((*C.Raster)(unsafe.Pointer(rast)), C.int(band), C.int(x), C.int(y), C.int(width), C.int(height), (*C.double)(unsafe.Pointer(values)), (*C.bool)(unsafe.Pointer(nodata)), (*C.bool)(unsafe.Pointer(noset)), C.int(nosetwidth), C.int(nosetheight), C.int(count), C.bool(keepnodata)) if _err = meosError(); _err != nil { return } diff --git a/functions/meos_meos_rgeo.go b/functions/meos_meos_rgeo.go index a84655c..f4253fa 100644 --- a/functions/meos_meos_rgeo.go +++ b/functions/meos_meos_rgeo.go @@ -476,6 +476,18 @@ func TrgeometryValueN(temp *Temporal, n int) (_r0 bool, _r1 *Geom, _err error) { } +// TrgeometryValueAtTimestamptz wraps MEOS C function trgeometry_value_at_timestamptz. +func TrgeometryValueAtTimestamptz(temp *Temporal, t int64, strict bool) (_r0 bool, _r1 *Geom, _err error) { + var _out_result *C.GSERIALIZED + C.meos_errno_reset() + _cret := C.trgeometry_value_at_timestamptz(temp._inner, C.TimestampTz(t), C.bool(strict), &_out_result) + if _err = meosError(); _err != nil { + return + } + return bool(_cret), &Geom{_inner: _out_result}, nil +} + + // TrgeometryTraversedArea wraps MEOS C function trgeometry_traversed_area. func TrgeometryTraversedArea(temp *Temporal, unary_union bool) (_r0 *Geom, _err error) { C.meos_errno_reset() diff --git a/functions/meos_meos_s2cell.go b/functions/meos_meos_s2cell.go index fa04a15..01a8276 100644 --- a/functions/meos_meos_s2cell.go +++ b/functions/meos_meos_s2cell.go @@ -1362,3 +1362,14 @@ func Ts2cellCellToToken(temp *Temporal) (_r0 *Temporal, _err error) { return &Temporal{_inner: _cret}, nil } + +// Ts2cellGridDistance wraps MEOS C function ts2cell_grid_distance. +func Ts2cellGridDistance(origin *Temporal, dest *Temporal) (_r0 *Temporal, _err error) { + C.meos_errno_reset() + _cret := C.ts2cell_grid_distance(origin._inner, dest._inner) + if _err = meosError(); _err != nil { + return + } + return &Temporal{_inner: _cret}, nil +} + diff --git a/functions/meos_pg_time.go b/functions/meos_pg_time.go index ca7df7a..1f4f87b 100644 --- a/functions/meos_pg_time.go +++ b/functions/meos_pg_time.go @@ -183,13 +183,13 @@ func PlusTimetzInterval(timetz unsafe.Pointer, interv *Interval) (_r0 unsafe.Poi // TimeCmp wraps MEOS C function time_cmp. -func TimeCmp(time1 int64, time2 int64) (_r0 int, _err error) { +func TimeCmp(time1 int64, time2 int64) (_r0 int32, _err error) { C.meos_errno_reset() _cret := C.time_cmp(C.TimeADT(time1), C.TimeADT(time2)) if _err = meosError(); _err != nil { return } - return int(_cret), nil + return int32(_cret), nil } diff --git a/functions/meos_pg_timestamp.go b/functions/meos_pg_timestamp.go index 1488197..15c404b 100644 --- a/functions/meos_pg_timestamp.go +++ b/functions/meos_pg_timestamp.go @@ -662,13 +662,13 @@ func TimestamptzBin(tstz int64, stride *Interval, origin int64) (_r0 int64, _err // TimestamptzHash wraps MEOS C function timestamptz_hash. -func TimestamptzHash(tstz int64) (_r0 int32, _err error) { +func TimestamptzHash(tstz int64) (_r0 uint32, _err error) { C.meos_errno_reset() _cret := C.timestamptz_hash(C.TimestampTz(tstz)) if _err = meosError(); _err != nil { return } - return int32(_cret), nil + return uint32(_cret), nil } diff --git a/tools/objectgen.py b/tools/objectgen.py index 2cbe4bd..359cf00 100644 --- a/tools/objectgen.py +++ b/tools/objectgen.py @@ -37,6 +37,7 @@ import shutil import sys from collections import defaultdict +from dataclasses import dataclass from pathlib import Path import codegen @@ -109,12 +110,18 @@ def __init__(self, idl: dict): self.functions = {f["name"]: f for f in idl["functions"]} self.parent: dict[str, str | None] = {} self.ctype: dict[str, str] = {} + self.meostype: dict[str, str] = {} # class -> the MeosType it stands for self.wrap_root: dict[str, str] = {} self._build() def _build(self) -> None: + # A leaf naming one type stands for it, as #_build of MEOS.NET's + # tools/objectgen.py reads the lattice and the companions. for name, node in self.om["lattice"].items(): self.parent[name] = node["parent"] + temptypes = node.get("temptypes") or [] + if node.get("kind") == "leaf" and len(temptypes) == 1: + self.meostype[name] = temptypes[0] # The template subtypes are classes of their own, under the root. for value in self.om["axes"]["subtype"]["values"]: @@ -127,6 +134,8 @@ def _build(self) -> None: if name.startswith("_"): continue self.parent[name] = node["parent"] + if node.get("temptype"): + self.meostype[name] = node["temptype"] # What a class's instances point to is the catalog's to say, so every class # takes the cType the model derives from MEOS's own signatures. A binding @@ -181,11 +190,34 @@ def class_for_ctype(self, struct: str) -> str | None: return self.wrap_root.get(struct) +@dataclass +class Emitted: + """A method #method_for emitted: the C function behind it, its Go name, its + parameter declarations and names, its result clause, and whether it is a + method on the value or a function of the class.""" + function: str + name: str + decl: list + args: list + result: str + instance: bool + + class Generator: def __init__(self, model: Model): self.m = model self.deferred: dict[str, list[str]] = defaultdict(list) self.emitted = 0 + self.last: Emitted | None = None + # class -> {C function: instance method}, its ancestors' included, since + # an embedded parent passes its methods down. + self.class_functions: dict[str | None, dict[str, Emitted]] = {} + # C function -> function of a class, for every class emitted before. + self.static_functions: dict[str, Emitted] = {} + # class -> the text writer its String calls. + self.class_text_writer: dict[str | None, str | None] = {} + # Every function of the package, since Go keeps one name per package. + self.package_names: set[str] = set() # The Go handle each wrapper struct reaches the flat layer as, read from the # flat generator rather than restated: WRAPPER_TYPES is what decides it. Its # value carries the star and need not echo the struct -- GSERIALIZED reaches @@ -294,6 +326,13 @@ def method_for(self, cls: str, entry: dict) -> str | None: args.insert(0, f"functions.{handle}FromPointer(x.Pointer())") name = pascal(oo) if recv is not None else cls + pascal(oo) + # A method may not share the name of the struct its class embeds, the + # field Go gives that parent (JsonbSet embeds Set, and jsonbset_set reads + # `set`), so such a method takes the name of its SQL function, which + # carries the type as the SQL dialect writes it (jsonbsetSet), spelled as + # #pascal spells every method. + if recv is not None and name == self.m.parent.get(cls): + name = pascal(f.get("sqlfn") or cls[:1].lower() + cls[1:] + name) # THE OUT-PARAMETER FOLD, and the shape is the repository's own: MEOS answers # a bool saying whether a value is there and writes the value out, so the @@ -338,13 +377,142 @@ def method_for(self, cls: str, entry: dict) -> str | None: if recv is not None else f"func {name}({', '.join(decl)}) {result} {{") self.emitted += 1 + # What #portable_methods and #string_method call it by. + self.last = Emitted(fname, name, decl, [d.split(" ", 1)[0] for d in decl], + result, recv is not None) return f"// {name} is MEOS {fname}.\n{head}\n" + "\n".join(body) + "\n}\n" + # The portable spelling of each encoding the catalog's typeEncodings names, + # the SQL dialect's (asText, asEWKT, asWKB, asHexWKB, asEWKB, asHexEWKB, + # asMFJSON and their From readers), as #FORMAT_SPELLING of MEOS.NET's + # tools/objectgen.py spells them. + FORMAT_SPELLING = {"text": "Text", "ewkt": "EWKT", "wkb": "WKB", + "hexwkb": "HexWKB", "ewkb": "EWKB", "hexewkb": "HexEWKB", + "mfjson": "MFJSON"} + + def encoding(self, cls: str) -> tuple[dict | None, str | None]: + """The typeEncodings entry of the class's C type and its SQL type name, + the MeosType without its T_, lower-cased, as meos_catalog.c names it.""" + enc = self.m.idl.get("typeEncodings", {}).get(self.m.ctype.get(cls)) + mt = self.m.meostype.get(cls) + return enc, (mt[2:].lower() if mt else None) + + def portable_methods(self, cls: str, own: list, functions: dict) -> list[str]: + """The portable reader and writer of every encoding typeEncodings gives the + class's type, as #portable_methods of MEOS.NET's tools/objectgen.py emits + them: the function of the type's SQL name in readers/writers, else the C + type's decoders/encoders. Where the class or an ancestor has no method of + that name, As forwards to the method behind the writer and + From to the function behind the reader, so + TGeomPointFromEWKB is TemporalFromWKB, one function under two names as in + SQL.""" + enc, sqltype = self.encoding(cls) + if not enc or not sqltype: + return [] + taken = {e.name for e in own} | {e.name for e in functions.values()} + out = [] + for e in enc.get("encodings", []): + spelling = self.FORMAT_SPELLING.get(e) + if not spelling: + continue + for verb, by_type, by_class in (("As", "writers", "encoders"), + ("From", "readers", "decoders")): + fn = (enc.get(by_type, {}).get(e, {}).get(sqltype) + or enc.get(by_class, {}).get(e)) + if not fn: + continue + if verb == "As": + target, name = functions.get(fn), verb + spelling + call = f"x.{target.name}" if target else None + else: + target, name = self.static_functions.get(fn), cls + verb + spelling + call = target.name if target else None + if target is None or name in taken or name in self.package_names: + continue + result, body = target.result, f"\treturn {call}({', '.join(target.args)})" + # A reader answers the class it reads: a function returning an + # ancestor (TemporalFromWKB answers *Temporal) is wrapped in this + # class, so TGeomPointFromEWKB answers a *TGeomPoint, nil kept nil. + answered = result[2:].split(",", 1)[0] if result.startswith("(*") else None + if (verb == "From" and answered and answered != cls + and answered in self.m.ancestors(cls)): + result = f"(*{cls}, error)" + body = (f"\tr, err := {call}({', '.join(target.args)})\n" + f"\tif err != nil || r == nil {{\n\t\treturn nil, err\n\t}}\n" + f"\treturn {cls}FromPointer(r.Pointer()), nil") + head = (f"func (x *{cls}) {name}({', '.join(target.decl)}) {result}" + if verb == "As" else + f"func {name}({', '.join(target.decl)}) {result}") + out.append(f"// {name} is the portable {verb.lower()}{spelling} of " + f"MEOS {fn}.\n{head} {{\n{body}\n}}\n") + taken.add(name) + if verb == "From": + self.package_names.add(name) + self.emitted += 1 + return out + + def text_writer(self, cls: str) -> str | None: + """The text writer typeEncodings names for the class, as #text_writer of + MEOS.NET's tools/objectgen.py reads it: the writer of its SQL type, else + the text encoder of its C type, else, for a C type the catalog keeps out + of its codecs (text, which MEOS-API counts with the strings), the class's + own *_out.""" + enc, sqltype = self.encoding(cls) + if enc is None: + return next((f for f in self.class_functions.get(cls, {}) + if f.endswith("_out")), None) + if sqltype: + writer = enc.get("writers", {}).get("text", {}).get(sqltype) + if writer: + return writer + return enc.get("encoders", {}).get("text") + + def string_method(self, cls: str, functions: dict) -> list[str]: + """String over the text writer #text_writer names, the function behind the + SQL asText of the type (rule 2 of the bindings in the I/O plan, MobilityDB + #3353): AsText for a spatial value, which writes its points as WKT, and + Out for the others; a class writing what it inherits emits none. A Go + String answers no error, so a MEOS error is written as fmt writes a + failure, %!s(MEOS error: ...), never as an empty string.""" + inherited = self.class_text_writer.get(self.m.parent.get(cls)) + writer = self.text_writer(cls) or inherited + self.class_text_writer[cls] = writer + if writer is None or writer == inherited: + return [] + target = functions.get(writer) + if target is None or target.result != "(string, error)": + return [] + args = [] + if target.decl: + if [d.split(" ", 1)[1] for d in target.decl] != ["int"]: + return [] + digits = self.default_digits(cls) + if digits is None: + return [] + args = [str(digits)] + return [f"// String is the text MEOS writes this value as, MEOS {writer}.\n" + f"func (x *{cls}) String() string {{\n" + f"\ts, err := x.{target.name}({', '.join(args)})\n" + f"\tif err != nil {{\n\t\treturn \"%!s(MEOS error: \" + err.Error() + \")\"\n\t}}\n" + f"\treturn s\n}}\n"] + + def default_digits(self, cls: str) -> int | None: + """The digits a text writer takes by default: the text encoding's own, + else MEOS's OUT_DEFAULT_DECIMAL_DIGITS, as MEOS.NET's ToString reads them.""" + enc, _ = self.encoding(cls) + aux = {a["name"]: a["default"] + for a in (enc or {}).get("encoderAux", {}).get("text", []) + or (enc or {}).get("out_aux", [])} + if "maxdd" in aux: + return aux["maxdd"] + return next((m.get("value") for m in self.m.idl.get("macros", []) + if m.get("name") == "OUT_DEFAULT_DECIMAL_DIGITS"), None) + def emit_class(self, cls: str) -> str: spec = self.m.om["classes"].get(cls) or {"methods": []} parent = self.m.parent.get(cls) - methods, seen = [], set() + methods, seen, own = [], set(), [] for entry in spec["methods"]: if entry.get("ooExclude"): continue @@ -356,6 +524,15 @@ def emit_class(self, cls: str) -> str: continue seen.add(head) methods.append(code) + own.append(self.last) + + functions = dict(self.class_functions.get(parent, {})) + functions.update({e.function: e for e in own if e.instance}) + self.class_functions[cls] = functions + self.static_functions.update({e.function: e for e in own if not e.instance}) + self.package_names |= {e.name for e in own if not e.instance} + methods += self.portable_methods(cls, own, functions) + methods += self.string_method(cls, functions) uses_functions = any("functions." in m for m in methods) imports = ['\t"unsafe"'] @@ -425,7 +602,9 @@ def main() -> int: shutil.rmtree(out_dir) out_dir.mkdir(parents=True) (out_dir / "meos.go").write_text(gen.base_file()) - for cls in model.classes(): + # A parent before its children, so a class reaches the methods its ancestors + # emit (#emit_class reads them for String and the portable forms). + for cls in sorted(model.classes(), key=lambda c: (model.depth(c), c)): (out_dir / f"{cls.lower()}.go").write_text(gen.emit_class(cls)) total_deferred = sum(len(v) for v in gen.deferred.values()) diff --git a/types/bigintset.go b/types/bigintset.go index 2e40f1a..062e50f 100644 --- a/types/bigintset.go +++ b/types/bigintset.go @@ -97,3 +97,44 @@ func (x *BigIntSet) ShiftScale(shift int64, width int64, hasshift bool, haswidth } return SetFromPointer(_r0.Pointer()), nil } + +// BigIntSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func BigIntSetFromHexWKB(hexwkb string) (*BigIntSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return BigIntSetFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS bigintset_out. +func (x *BigIntSet) AsText() (string, error) { + return x.Out() +} + +// BigIntSetFromText is the portable fromText of MEOS bigintset_in. +func BigIntSetFromText(str string) (*BigIntSet, error) { + r, err := BigIntSetIn(str) + if err != nil || r == nil { + return nil, err + } + return BigIntSetFromPointer(r.Pointer()), nil +} + +// BigIntSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func BigIntSetFromWKB(wkb unsafe.Pointer, size uint) (*BigIntSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return BigIntSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS bigintset_out. +func (x *BigIntSet) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/bigintspan.go b/types/bigintspan.go index 3db078b..230a001 100644 --- a/types/bigintspan.go +++ b/types/bigintspan.go @@ -130,3 +130,44 @@ func BigIntSpanGetBin(value int64, vsize int64, vorigin int64) (*Span, error) { } return SpanFromPointer(_r0.Pointer()), nil } + +// BigIntSpanFromHexWKB is the portable fromHexWKB of MEOS span_from_hexwkb. +func BigIntSpanFromHexWKB(hexwkb string) (*BigIntSpan, error) { + r, err := SpanFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return BigIntSpanFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS bigintspan_out. +func (x *BigIntSpan) AsText() (string, error) { + return x.Out() +} + +// BigIntSpanFromText is the portable fromText of MEOS bigintspan_in. +func BigIntSpanFromText(str string) (*BigIntSpan, error) { + r, err := BigIntSpanIn(str) + if err != nil || r == nil { + return nil, err + } + return BigIntSpanFromPointer(r.Pointer()), nil +} + +// BigIntSpanFromWKB is the portable fromWKB of MEOS span_from_wkb. +func BigIntSpanFromWKB(wkb unsafe.Pointer, size uint) (*BigIntSpan, error) { + r, err := SpanFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return BigIntSpanFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS bigintspan_out. +func (x *BigIntSpan) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/bigintspanset.go b/types/bigintspanset.go index c21e6b8..605d571 100644 --- a/types/bigintspanset.go +++ b/types/bigintspanset.go @@ -85,3 +85,44 @@ func (x *BigIntSpanSet) Bins(vsize int64, vorigin int64, border_inc bool, count } return SpanFromPointer(_r0.Pointer()), nil } + +// BigIntSpanSetFromHexWKB is the portable fromHexWKB of MEOS spanset_from_hexwkb. +func BigIntSpanSetFromHexWKB(hexwkb string) (*BigIntSpanSet, error) { + r, err := SpanSetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return BigIntSpanSetFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS bigintspanset_out. +func (x *BigIntSpanSet) AsText() (string, error) { + return x.Out() +} + +// BigIntSpanSetFromText is the portable fromText of MEOS bigintspanset_in. +func BigIntSpanSetFromText(str string) (*BigIntSpanSet, error) { + r, err := BigIntSpanSetIn(str) + if err != nil || r == nil { + return nil, err + } + return BigIntSpanSetFromPointer(r.Pointer()), nil +} + +// BigIntSpanSetFromWKB is the portable fromWKB of MEOS spanset_from_wkb. +func BigIntSpanSetFromWKB(wkb unsafe.Pointer, size uint) (*BigIntSpanSet, error) { + r, err := SpanSetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return BigIntSpanSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS bigintspanset_out. +func (x *BigIntSpanSet) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/cbuffer.go b/types/cbuffer.go index 9c7aa92..4f1e1bc 100644 --- a/types/cbuffer.go +++ b/types/cbuffer.go @@ -41,8 +41,8 @@ func (x *Cbuffer) AsEWKT(maxdd int) (string, error) { return _r0, nil } -// AsHEXEWKB is MEOS cbuffer_as_hexewkb. -func (x *Cbuffer) AsHEXEWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexEWKB is MEOS cbuffer_as_hexewkb. +func (x *Cbuffer) AsHexEWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.CbufferAsHexewkb(functions.CbufferFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -50,8 +50,8 @@ func (x *Cbuffer) AsHEXEWKB(variant uint8, size_out unsafe.Pointer) (string, err return _r0, nil } -// AsHEXWKB is MEOS cbuffer_as_hexwkb. -func (x *Cbuffer) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexWKB is MEOS cbuffer_as_hexwkb. +func (x *Cbuffer) AsHexWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.CbufferAsHexwkb(functions.CbufferFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -77,8 +77,8 @@ func (x *Cbuffer) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, return _r0, nil } -// CbufferFromHEXWKB is MEOS cbuffer_from_hexwkb. -func CbufferFromHEXWKB(hexwkb string) (*Cbuffer, error) { +// CbufferFromHexWKB is MEOS cbuffer_from_hexwkb. +func CbufferFromHexWKB(hexwkb string) (*Cbuffer, error) { _r0, _err := functions.CbufferFromHexwkb(hexwkb) if _err != nil { return nil, _err @@ -328,3 +328,32 @@ func (x *Cbuffer) ToSet() (*Set, error) { } return SetFromPointer(_r0.Pointer()), nil } + +// CbufferFromEWKB is the portable fromEWKB of MEOS cbuffer_from_wkb. +func CbufferFromEWKB(wkb unsafe.Pointer, size uint) (*Cbuffer, error) { + return CbufferFromWKB(wkb, size) +} + +// CbufferFromEWKT is the portable fromEWKT of MEOS cbuffer_in. +func CbufferFromEWKT(str string) (*Cbuffer, error) { + return CbufferIn(str) +} + +// CbufferFromHexEWKB is the portable fromHexEWKB of MEOS cbuffer_from_hexwkb. +func CbufferFromHexEWKB(hexwkb string) (*Cbuffer, error) { + return CbufferFromHexWKB(hexwkb) +} + +// CbufferFromText is the portable fromText of MEOS cbuffer_in. +func CbufferFromText(str string) (*Cbuffer, error) { + return CbufferIn(str) +} + +// String is the text MEOS writes this value as, MEOS cbuffer_as_text. +func (x *Cbuffer) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/cbufferset.go b/types/cbufferset.go index f17d6dd..727dab4 100644 --- a/types/cbufferset.go +++ b/types/cbufferset.go @@ -9,7 +9,7 @@ import ( ) type CbufferSet struct { - Set + SpatialSet } // CbufferSetFromPointer wraps a MEOS pointer, answering nil for nil so an @@ -88,3 +88,66 @@ func (x *CbufferSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { } return _r0, nil } + +// CbufferSetFromEWKB is the portable fromEWKB of MEOS set_from_wkb. +func CbufferSetFromEWKB(wkb unsafe.Pointer, size uint) (*CbufferSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return CbufferSetFromPointer(r.Pointer()), nil +} + +// CbufferSetFromEWKT is the portable fromEWKT of MEOS cbufferset_in. +func CbufferSetFromEWKT(str string) (*CbufferSet, error) { + r, err := CbufferSetIn(str) + if err != nil || r == nil { + return nil, err + } + return CbufferSetFromPointer(r.Pointer()), nil +} + +// CbufferSetFromHexEWKB is the portable fromHexEWKB of MEOS set_from_hexwkb. +func CbufferSetFromHexEWKB(hexwkb string) (*CbufferSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return CbufferSetFromPointer(r.Pointer()), nil +} + +// CbufferSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func CbufferSetFromHexWKB(hexwkb string) (*CbufferSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return CbufferSetFromPointer(r.Pointer()), nil +} + +// CbufferSetFromText is the portable fromText of MEOS cbufferset_in. +func CbufferSetFromText(str string) (*CbufferSet, error) { + r, err := CbufferSetIn(str) + if err != nil || r == nil { + return nil, err + } + return CbufferSetFromPointer(r.Pointer()), nil +} + +// CbufferSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func CbufferSetFromWKB(wkb unsafe.Pointer, size uint) (*CbufferSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return CbufferSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS spatialset_as_text. +func (x *CbufferSet) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/dateset.go b/types/dateset.go index 5234bb5..cce1e70 100644 --- a/types/dateset.go +++ b/types/dateset.go @@ -106,3 +106,44 @@ func (x *DateSet) ShiftScale(shift int, width int, hasshift bool, haswidth bool) } return SetFromPointer(_r0.Pointer()), nil } + +// DateSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func DateSetFromHexWKB(hexwkb string) (*DateSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return DateSetFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS dateset_out. +func (x *DateSet) AsText() (string, error) { + return x.Out() +} + +// DateSetFromText is the portable fromText of MEOS dateset_in. +func DateSetFromText(str string) (*DateSet, error) { + r, err := DateSetIn(str) + if err != nil || r == nil { + return nil, err + } + return DateSetFromPointer(r.Pointer()), nil +} + +// DateSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func DateSetFromWKB(wkb unsafe.Pointer, size uint) (*DateSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return DateSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS dateset_out. +func (x *DateSet) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/datespan.go b/types/datespan.go index 44d9b70..10cbb01 100644 --- a/types/datespan.go +++ b/types/datespan.go @@ -85,3 +85,44 @@ func (x *DateSpan) ShiftScale(shift int, width int, hasshift bool, haswidth bool } return SpanFromPointer(_r0.Pointer()), nil } + +// DateSpanFromHexWKB is the portable fromHexWKB of MEOS span_from_hexwkb. +func DateSpanFromHexWKB(hexwkb string) (*DateSpan, error) { + r, err := SpanFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return DateSpanFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS datespan_out. +func (x *DateSpan) AsText() (string, error) { + return x.Out() +} + +// DateSpanFromText is the portable fromText of MEOS datespan_in. +func DateSpanFromText(str string) (*DateSpan, error) { + r, err := DateSpanIn(str) + if err != nil || r == nil { + return nil, err + } + return DateSpanFromPointer(r.Pointer()), nil +} + +// DateSpanFromWKB is the portable fromWKB of MEOS span_from_wkb. +func DateSpanFromWKB(wkb unsafe.Pointer, size uint) (*DateSpan, error) { + r, err := SpanFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return DateSpanFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS datespan_out. +func (x *DateSpan) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/datespanset.go b/types/datespanset.go index ec592d3..f690349 100644 --- a/types/datespanset.go +++ b/types/datespanset.go @@ -124,3 +124,44 @@ func (x *DateSpanSet) ShiftScale(shift int, width int, hasshift bool, haswidth b } return SpanSetFromPointer(_r0.Pointer()), nil } + +// DateSpanSetFromHexWKB is the portable fromHexWKB of MEOS spanset_from_hexwkb. +func DateSpanSetFromHexWKB(hexwkb string) (*DateSpanSet, error) { + r, err := SpanSetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return DateSpanSetFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS datespanset_out. +func (x *DateSpanSet) AsText() (string, error) { + return x.Out() +} + +// DateSpanSetFromText is the portable fromText of MEOS datespanset_in. +func DateSpanSetFromText(str string) (*DateSpanSet, error) { + r, err := DateSpanSetIn(str) + if err != nil || r == nil { + return nil, err + } + return DateSpanSetFromPointer(r.Pointer()), nil +} + +// DateSpanSetFromWKB is the portable fromWKB of MEOS spanset_from_wkb. +func DateSpanSetFromWKB(wkb unsafe.Pointer, size uint) (*DateSpanSet, error) { + r, err := SpanSetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return DateSpanSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS datespanset_out. +func (x *DateSpanSet) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/floatset.go b/types/floatset.go index ba8305e..2f4153a 100644 --- a/types/floatset.go +++ b/types/floatset.go @@ -142,3 +142,44 @@ func (x *FloatSet) ShiftScale(shift float64, width float64, hasshift bool, haswi } return SetFromPointer(_r0.Pointer()), nil } + +// FloatSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func FloatSetFromHexWKB(hexwkb string) (*FloatSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return FloatSetFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS floatset_out. +func (x *FloatSet) AsText(maxdd int) (string, error) { + return x.Out(maxdd) +} + +// FloatSetFromText is the portable fromText of MEOS floatset_in. +func FloatSetFromText(str string) (*FloatSet, error) { + r, err := FloatSetIn(str) + if err != nil || r == nil { + return nil, err + } + return FloatSetFromPointer(r.Pointer()), nil +} + +// FloatSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func FloatSetFromWKB(wkb unsafe.Pointer, size uint) (*FloatSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return FloatSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS floatset_out. +func (x *FloatSet) String() string { + s, err := x.Out(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/floatspan.go b/types/floatspan.go index 326626d..4d8f566 100644 --- a/types/floatspan.go +++ b/types/floatspan.go @@ -175,3 +175,44 @@ func FloatSpanGetBin(value float64, vsize float64, vorigin float64) (*Span, erro } return SpanFromPointer(_r0.Pointer()), nil } + +// FloatSpanFromHexWKB is the portable fromHexWKB of MEOS span_from_hexwkb. +func FloatSpanFromHexWKB(hexwkb string) (*FloatSpan, error) { + r, err := SpanFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return FloatSpanFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS floatspan_out. +func (x *FloatSpan) AsText(maxdd int) (string, error) { + return x.Out(maxdd) +} + +// FloatSpanFromText is the portable fromText of MEOS floatspan_in. +func FloatSpanFromText(str string) (*FloatSpan, error) { + r, err := FloatSpanIn(str) + if err != nil || r == nil { + return nil, err + } + return FloatSpanFromPointer(r.Pointer()), nil +} + +// FloatSpanFromWKB is the portable fromWKB of MEOS span_from_wkb. +func FloatSpanFromWKB(wkb unsafe.Pointer, size uint) (*FloatSpan, error) { + r, err := SpanFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return FloatSpanFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS floatspan_out. +func (x *FloatSpan) String() string { + s, err := x.Out(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/floatspanset.go b/types/floatspanset.go index 62ab759..2202221 100644 --- a/types/floatspanset.go +++ b/types/floatspanset.go @@ -139,3 +139,44 @@ func (x *FloatSpanSet) Bins(vsize float64, vorigin float64, border_inc bool, cou } return SpanFromPointer(_r0.Pointer()), nil } + +// FloatSpanSetFromHexWKB is the portable fromHexWKB of MEOS spanset_from_hexwkb. +func FloatSpanSetFromHexWKB(hexwkb string) (*FloatSpanSet, error) { + r, err := SpanSetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return FloatSpanSetFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS floatspanset_out. +func (x *FloatSpanSet) AsText(maxdd int) (string, error) { + return x.Out(maxdd) +} + +// FloatSpanSetFromText is the portable fromText of MEOS floatspanset_in. +func FloatSpanSetFromText(str string) (*FloatSpanSet, error) { + r, err := FloatSpanSetIn(str) + if err != nil || r == nil { + return nil, err + } + return FloatSpanSetFromPointer(r.Pointer()), nil +} + +// FloatSpanSetFromWKB is the portable fromWKB of MEOS spanset_from_wkb. +func FloatSpanSetFromWKB(wkb unsafe.Pointer, size uint) (*FloatSpanSet, error) { + r, err := SpanSetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return FloatSpanSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS floatspanset_out. +func (x *FloatSpanSet) String() string { + s, err := x.Out(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/geo.go b/types/geo.go index 16dae43..3c29aae 100644 --- a/types/geo.go +++ b/types/geo.go @@ -41,8 +41,8 @@ func GeoAsEWKT(gs *TRGeometrySeqSet, precision int) (string, error) { return _r0, nil } -// GeoAsGEOJSON is MEOS geo_as_geojson. -func GeoAsGEOJSON(gs *TRGeometrySeqSet, option int, precision int, srs *string) (string, error) { +// GeoAsGeoJSON is MEOS geo_as_geojson. +func GeoAsGeoJSON(gs *TRGeometrySeqSet, option int, precision int, srs *string) (string, error) { _r0, _err := functions.GeoAsGeojson(functions.GeomFromPointer(gs.Pointer()), option, precision, srs) if _err != nil { return "", _err @@ -50,8 +50,8 @@ func GeoAsGEOJSON(gs *TRGeometrySeqSet, option int, precision int, srs *string) return _r0, nil } -// GeoAsHEXEWKB is MEOS geo_as_hexewkb. -func GeoAsHEXEWKB(gs *TRGeometrySeqSet, endian *string) (string, error) { +// GeoAsHexEWKB is MEOS geo_as_hexewkb. +func GeoAsHexEWKB(gs *TRGeometrySeqSet, endian *string) (string, error) { _r0, _err := functions.GeoAsHexewkb(functions.GeomFromPointer(gs.Pointer()), endian) if _err != nil { return "", _err @@ -77,8 +77,8 @@ func GeoFromEWKB(wkb unsafe.Pointer, wkb_size uint, srid int32) (*TRGeometrySeqS return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil } -// GeoFromGEOJSON is MEOS geo_from_geojson. -func GeoFromGEOJSON(geojson string) (*TRGeometrySeqSet, error) { +// GeoFromGeoJSON is MEOS geo_from_geojson. +func GeoFromGeoJSON(geojson string) (*TRGeometrySeqSet, error) { _r0, _err := functions.GeoFromGeojson(geojson) if _err != nil { return nil, _err @@ -267,8 +267,17 @@ func GeoScale(gs *TRGeometrySeqSet, xfactor float64, yfactor float64, zfactor fl } // GeoScaleGeo is MEOS geo_scale_geo. -func GeoScaleGeo(gs *TRGeometrySeqSet, scale *TRGeometrySeqSet, sorigin *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { - _r0, _err := functions.GeoScaleGeo(functions.GeomFromPointer(gs.Pointer()), functions.GeomFromPointer(scale.Pointer()), functions.GeomFromPointer(sorigin.Pointer())) +func GeoScaleGeo(gs *TRGeometrySeqSet, scale *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeoScaleGeo(functions.GeomFromPointer(gs.Pointer()), functions.GeomFromPointer(scale.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeoScaleGeoOrigin is MEOS geo_scale_geo_origin. +func GeoScaleGeoOrigin(gs *TRGeometrySeqSet, scale *TRGeometrySeqSet, sorigin *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeoScaleGeoOrigin(functions.GeomFromPointer(gs.Pointer()), functions.GeomFromPointer(scale.Pointer()), functions.GeomFromPointer(sorigin.Pointer())) if _err != nil { return nil, _err } diff --git a/types/geography.go b/types/geography.go index 3f05449..d16a645 100644 --- a/types/geography.go +++ b/types/geography.go @@ -23,8 +23,8 @@ func GeographyFromPointer(p unsafe.Pointer) *Geography { return v } -// GeographyFromHEXEWKB is MEOS geog_from_hexewkb. -func GeographyFromHEXEWKB(hexwkb string) (*TRGeometrySeqSet, error) { +// GeographyFromHexEWKB is MEOS geog_from_hexewkb. +func GeographyFromHexEWKB(hexwkb string) (*TRGeometrySeqSet, error) { _r0, _err := functions.GeogFromHexewkb(hexwkb) if _err != nil { return nil, _err @@ -139,3 +139,18 @@ func GeographyShortestline(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet, use_sph } return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil } + +// GeographyFromEWKB is the portable fromEWKB of MEOS geo_from_ewkb. +func GeographyFromEWKB(wkb unsafe.Pointer, wkb_size uint, srid int32) (*TRGeometrySeqSet, error) { + return GeoFromEWKB(wkb, wkb_size, srid) +} + +// GeographyFromMFJSON is the portable fromMFJSON of MEOS geo_from_geojson. +func GeographyFromMFJSON(geojson string) (*TRGeometrySeqSet, error) { + return GeoFromGeoJSON(geojson) +} + +// GeographyFromText is the portable fromText of MEOS geo_from_text. +func GeographyFromText(wkt string, srid int32) (*TRGeometrySeqSet, error) { + return GeoFromText(wkt, srid) +} diff --git a/types/geogset.go b/types/geogset.go index f56730e..804a7ca 100644 --- a/types/geogset.go +++ b/types/geogset.go @@ -9,7 +9,7 @@ import ( ) type GeogSet struct { - Set + GeoSet } // GeogSetFromPointer wraps a MEOS pointer, answering nil for nil so an @@ -31,3 +31,66 @@ func GeogSetIn(str string) (*Set, error) { } return SetFromPointer(_r0.Pointer()), nil } + +// GeogSetFromEWKB is the portable fromEWKB of MEOS set_from_wkb. +func GeogSetFromEWKB(wkb unsafe.Pointer, size uint) (*GeogSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return GeogSetFromPointer(r.Pointer()), nil +} + +// GeogSetFromEWKT is the portable fromEWKT of MEOS geogset_in. +func GeogSetFromEWKT(str string) (*GeogSet, error) { + r, err := GeogSetIn(str) + if err != nil || r == nil { + return nil, err + } + return GeogSetFromPointer(r.Pointer()), nil +} + +// GeogSetFromHexEWKB is the portable fromHexEWKB of MEOS set_from_hexwkb. +func GeogSetFromHexEWKB(hexwkb string) (*GeogSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return GeogSetFromPointer(r.Pointer()), nil +} + +// GeogSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func GeogSetFromHexWKB(hexwkb string) (*GeogSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return GeogSetFromPointer(r.Pointer()), nil +} + +// GeogSetFromText is the portable fromText of MEOS geogset_in. +func GeogSetFromText(str string) (*GeogSet, error) { + r, err := GeogSetIn(str) + if err != nil || r == nil { + return nil, err + } + return GeogSetFromPointer(r.Pointer()), nil +} + +// GeogSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func GeogSetFromWKB(wkb unsafe.Pointer, size uint) (*GeogSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return GeogSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS spatialset_as_text. +func (x *GeogSet) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/geometry.go b/types/geometry.go index 24f1f46..d29f1e0 100644 --- a/types/geometry.go +++ b/types/geometry.go @@ -23,8 +23,8 @@ func GeometryFromPointer(p unsafe.Pointer) *Geometry { return v } -// GeometryFromHEXEWKB is MEOS geom_from_hexewkb. -func GeometryFromHEXEWKB(hexwkb string) (*TRGeometrySeqSet, error) { +// GeometryFromHexEWKB is MEOS geom_from_hexewkb. +func GeometryFromHexEWKB(hexwkb string) (*TRGeometrySeqSet, error) { _r0, _err := functions.GeomFromHexewkb(hexwkb) if _err != nil { return nil, _err @@ -439,3 +439,18 @@ func GeometryTposeToTrgeometry(gs *TRGeometrySeqSet, temp *Temporal) (*Temporal, } return TemporalFromPointer(_r0.Pointer()), nil } + +// GeometryFromEWKB is the portable fromEWKB of MEOS geo_from_ewkb. +func GeometryFromEWKB(wkb unsafe.Pointer, wkb_size uint, srid int32) (*TRGeometrySeqSet, error) { + return GeoFromEWKB(wkb, wkb_size, srid) +} + +// GeometryFromMFJSON is the portable fromMFJSON of MEOS geo_from_geojson. +func GeometryFromMFJSON(geojson string) (*TRGeometrySeqSet, error) { + return GeoFromGeoJSON(geojson) +} + +// GeometryFromText is the portable fromText of MEOS geo_from_text. +func GeometryFromText(wkt string, srid int32) (*TRGeometrySeqSet, error) { + return GeoFromText(wkt, srid) +} diff --git a/types/geomset.go b/types/geomset.go index b0ca24e..6433c84 100644 --- a/types/geomset.go +++ b/types/geomset.go @@ -9,7 +9,7 @@ import ( ) type GeomSet struct { - Set + GeoSet } // GeomSetFromPointer wraps a MEOS pointer, answering nil for nil so an @@ -32,59 +32,65 @@ func GeomSetIn(str string) (*Set, error) { return SetFromPointer(_r0.Pointer()), nil } -// GeomSetMake is MEOS geoset_make. -func GeomSetMake(values unsafe.Pointer, count int) (*Set, error) { - _r0, _err := functions.GeosetMake(values, count) - if _err != nil { - return nil, _err +// GeomSetFromEWKB is the portable fromEWKB of MEOS set_from_wkb. +func GeomSetFromEWKB(wkb unsafe.Pointer, size uint) (*GeomSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err } - return SetFromPointer(_r0.Pointer()), nil + return GeomSetFromPointer(r.Pointer()), nil } -// ToGeo is MEOS geoset_to_geo. -func (x *GeomSet) ToGeo() (*TRGeometrySeqSet, error) { - _r0, _err := functions.GeosetToGeo(functions.SetFromPointer(x.Pointer())) - if _err != nil { - return nil, _err +// GeomSetFromEWKT is the portable fromEWKT of MEOS geomset_in. +func GeomSetFromEWKT(str string) (*GeomSet, error) { + r, err := GeomSetIn(str) + if err != nil || r == nil { + return nil, err } - return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil + return GeomSetFromPointer(r.Pointer()), nil } -// EndValue is MEOS geoset_end_value. -func (x *GeomSet) EndValue() (*TRGeometrySeqSet, error) { - _r0, _err := functions.GeosetEndValue(functions.SetFromPointer(x.Pointer())) - if _err != nil { - return nil, _err +// GeomSetFromHexEWKB is the portable fromHexEWKB of MEOS set_from_hexwkb. +func GeomSetFromHexEWKB(hexwkb string) (*GeomSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err } - return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil + return GeomSetFromPointer(r.Pointer()), nil } -// StartValue is MEOS geoset_start_value. -func (x *GeomSet) StartValue() (*TRGeometrySeqSet, error) { - _r0, _err := functions.GeosetStartValue(functions.SetFromPointer(x.Pointer())) - if _err != nil { - return nil, _err +// GeomSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func GeomSetFromHexWKB(hexwkb string) (*GeomSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err } - return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil + return GeomSetFromPointer(r.Pointer()), nil } -// ValueN is MEOS geoset_value_n. -func (x *GeomSet) ValueN(n int) (*TRGeometrySeqSet, bool, error) { - _found, _value, _err := functions.GeosetValueN(functions.SetFromPointer(x.Pointer()), n) - if _err != nil { - return nil, false, _err +// GeomSetFromText is the portable fromText of MEOS geomset_in. +func GeomSetFromText(str string) (*GeomSet, error) { + r, err := GeomSetIn(str) + if err != nil || r == nil { + return nil, err } - if !_found { - return nil, false, nil + return GeomSetFromPointer(r.Pointer()), nil +} + +// GeomSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func GeomSetFromWKB(wkb unsafe.Pointer, size uint) (*GeomSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err } - return TRGeometrySeqSetFromPointer(_value.Pointer()), true, nil + return GeomSetFromPointer(r.Pointer()), nil } -// Values is MEOS geoset_values. -func (x *GeomSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { - _r0, _err := functions.GeosetValues(functions.SetFromPointer(x.Pointer()), count) - if _err != nil { - return nil, _err +// String is the text MEOS writes this value as, MEOS spatialset_as_text. +func (x *GeomSet) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" } - return _r0, nil + return s } diff --git a/types/geoset.go b/types/geoset.go new file mode 100644 index 0000000..e083748 --- /dev/null +++ b/types/geoset.go @@ -0,0 +1,81 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type GeoSet struct { + SpatialSet +} + +// GeoSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func GeoSetFromPointer(p unsafe.Pointer) *GeoSet { + if p == nil { + return nil + } + v := &GeoSet{} + v.ptr = p + return v +} + +// GeoSetMake is MEOS geoset_make. +func GeoSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.GeosetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ToGeo is MEOS geoset_to_geo. +func (x *GeoSet) ToGeo() (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeosetToGeo(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS geoset_end_value. +func (x *GeoSet) EndValue() (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeosetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS geoset_start_value. +func (x *GeoSet) StartValue() (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeosetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// ValueN is MEOS geoset_value_n. +func (x *GeoSet) ValueN(n int) (*TRGeometrySeqSet, bool, error) { + _found, _value, _err := functions.GeosetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return TRGeometrySeqSetFromPointer(_value.Pointer()), true, nil +} + +// Values is MEOS geoset_values. +func (x *GeoSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.GeosetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} diff --git a/types/h3indexset.go b/types/h3indexset.go new file mode 100644 index 0000000..b9d74c8 --- /dev/null +++ b/types/h3indexset.go @@ -0,0 +1,171 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type H3IndexSet struct { + SpatialSet +} + +// H3IndexSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func H3IndexSetFromPointer(p unsafe.Pointer) *H3IndexSet { + if p == nil { + return nil + } + v := &H3IndexSet{} + v.ptr = p + return v +} + +// H3IndexSetIn is MEOS h3indexset_in. +func H3IndexSetIn(str string) (*Set, error) { + _r0, _err := functions.H3indexsetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS h3indexset_out. +func (x *H3IndexSet) Out() (string, error) { + _r0, _err := functions.H3indexsetOut(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// H3IndexSetMake is MEOS h3indexset_make. +func H3IndexSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.H3indexsetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS h3indexset_end_value. +func (x *H3IndexSet) EndValue() (uint64, error) { + _r0, _err := functions.H3indexsetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartValue is MEOS h3indexset_start_value. +func (x *H3IndexSet) StartValue() (uint64, error) { + _r0, _err := functions.H3indexsetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ValueN is MEOS h3indexset_value_n. +func (x *H3IndexSet) ValueN(n int) (uint64, bool, error) { + _found, _value, _err := functions.H3indexsetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Values is MEOS h3indexset_values. +func (x *H3IndexSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.H3indexsetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// GridDisk is MEOS h3indexset_grid_disk. +func (x *H3IndexSet) GridDisk(k int) (*Set, error) { + _r0, _err := functions.H3indexsetGridDisk(functions.SetFromPointer(x.Pointer()), k) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// CoverCells is MEOS h3indexset_cover_cells. +func (x *H3IndexSet) CoverCells(resolution int32) (*Set, error) { + _r0, _err := functions.H3indexsetCoverCells(functions.SetFromPointer(x.Pointer()), resolution) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// H3IndexSetFromEWKB is the portable fromEWKB of MEOS set_from_wkb. +func H3IndexSetFromEWKB(wkb unsafe.Pointer, size uint) (*H3IndexSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return H3IndexSetFromPointer(r.Pointer()), nil +} + +// H3IndexSetFromEWKT is the portable fromEWKT of MEOS h3indexset_in. +func H3IndexSetFromEWKT(str string) (*H3IndexSet, error) { + r, err := H3IndexSetIn(str) + if err != nil || r == nil { + return nil, err + } + return H3IndexSetFromPointer(r.Pointer()), nil +} + +// H3IndexSetFromHexEWKB is the portable fromHexEWKB of MEOS set_from_hexwkb. +func H3IndexSetFromHexEWKB(hexwkb string) (*H3IndexSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return H3IndexSetFromPointer(r.Pointer()), nil +} + +// H3IndexSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func H3IndexSetFromHexWKB(hexwkb string) (*H3IndexSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return H3IndexSetFromPointer(r.Pointer()), nil +} + +// H3IndexSetFromText is the portable fromText of MEOS h3indexset_in. +func H3IndexSetFromText(str string) (*H3IndexSet, error) { + r, err := H3IndexSetIn(str) + if err != nil || r == nil { + return nil, err + } + return H3IndexSetFromPointer(r.Pointer()), nil +} + +// H3IndexSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func H3IndexSetFromWKB(wkb unsafe.Pointer, size uint) (*H3IndexSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return H3IndexSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS h3indexset_out. +func (x *H3IndexSet) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/intset.go b/types/intset.go index 394846a..842508a 100644 --- a/types/intset.go +++ b/types/intset.go @@ -106,3 +106,44 @@ func (x *IntSet) ShiftScale(shift int, width int, hasshift bool, haswidth bool) } return SetFromPointer(_r0.Pointer()), nil } + +// IntSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func IntSetFromHexWKB(hexwkb string) (*IntSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return IntSetFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS intset_out. +func (x *IntSet) AsText() (string, error) { + return x.Out() +} + +// IntSetFromText is the portable fromText of MEOS intset_in. +func IntSetFromText(str string) (*IntSet, error) { + r, err := IntSetIn(str) + if err != nil || r == nil { + return nil, err + } + return IntSetFromPointer(r.Pointer()), nil +} + +// IntSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func IntSetFromWKB(wkb unsafe.Pointer, size uint) (*IntSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return IntSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS intset_out. +func (x *IntSet) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/intspan.go b/types/intspan.go index 2c4a1e7..ab72d58 100644 --- a/types/intspan.go +++ b/types/intspan.go @@ -130,3 +130,44 @@ func IntSpanGetBin(value int, vsize int, vorigin int) (*Span, error) { } return SpanFromPointer(_r0.Pointer()), nil } + +// IntSpanFromHexWKB is the portable fromHexWKB of MEOS span_from_hexwkb. +func IntSpanFromHexWKB(hexwkb string) (*IntSpan, error) { + r, err := SpanFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return IntSpanFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS intspan_out. +func (x *IntSpan) AsText() (string, error) { + return x.Out() +} + +// IntSpanFromText is the portable fromText of MEOS intspan_in. +func IntSpanFromText(str string) (*IntSpan, error) { + r, err := IntSpanIn(str) + if err != nil || r == nil { + return nil, err + } + return IntSpanFromPointer(r.Pointer()), nil +} + +// IntSpanFromWKB is the portable fromWKB of MEOS span_from_wkb. +func IntSpanFromWKB(wkb unsafe.Pointer, size uint) (*IntSpan, error) { + r, err := SpanFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return IntSpanFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS intspan_out. +func (x *IntSpan) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/intspanset.go b/types/intspanset.go index cca2a0b..a0a2b15 100644 --- a/types/intspanset.go +++ b/types/intspanset.go @@ -94,3 +94,44 @@ func (x *IntSpanSet) Bins(vsize int, vorigin int, border_inc bool, count unsafe. } return SpanFromPointer(_r0.Pointer()), nil } + +// IntSpanSetFromHexWKB is the portable fromHexWKB of MEOS spanset_from_hexwkb. +func IntSpanSetFromHexWKB(hexwkb string) (*IntSpanSet, error) { + r, err := SpanSetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return IntSpanSetFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS intspanset_out. +func (x *IntSpanSet) AsText() (string, error) { + return x.Out() +} + +// IntSpanSetFromText is the portable fromText of MEOS intspanset_in. +func IntSpanSetFromText(str string) (*IntSpanSet, error) { + r, err := IntSpanSetIn(str) + if err != nil || r == nil { + return nil, err + } + return IntSpanSetFromPointer(r.Pointer()), nil +} + +// IntSpanSetFromWKB is the portable fromWKB of MEOS spanset_from_wkb. +func IntSpanSetFromWKB(wkb unsafe.Pointer, size uint) (*IntSpanSet, error) { + r, err := SpanSetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return IntSpanSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS intspanset_out. +func (x *IntSpanSet) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/jsonb.go b/types/jsonb.go index 680c782..8395026 100644 --- a/types/jsonb.go +++ b/types/jsonb.go @@ -508,3 +508,17 @@ func (x *Jsonb) ToSet() (*Set, error) { } return SetFromPointer(_r0.Pointer()), nil } + +// AsText is the portable asText of MEOS jsonb_out. +func (x *Jsonb) AsText() (string, error) { + return x.Out() +} + +// String is the text MEOS writes this value as, MEOS jsonb_out. +func (x *Jsonb) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/jsonbset.go b/types/jsonbset.go new file mode 100644 index 0000000..b5f9060 --- /dev/null +++ b/types/jsonbset.go @@ -0,0 +1,374 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type JsonbSet struct { + Set +} + +// JsonbSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func JsonbSetFromPointer(p unsafe.Pointer) *JsonbSet { + if p == nil { + return nil + } + v := &JsonbSet{} + v.ptr = p + return v +} + +// JsonbSetIn is MEOS jsonbset_in. +func JsonbSetIn(str string) (*Set, error) { + _r0, _err := functions.JsonbsetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS jsonbset_out. +func (x *JsonbSet) Out() (string, error) { + _r0, _err := functions.JsonbsetOut(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// JsonbSetMake is MEOS jsonbset_make. +func JsonbSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.JsonbsetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ToTextset is MEOS jsonbset_to_textset. +func (x *JsonbSet) ToTextset() (*Set, error) { + _r0, _err := functions.JsonbsetToTextset(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS jsonbset_end_value. +func (x *JsonbSet) EndValue() (*Jsonb, error) { + _r0, _err := functions.JsonbsetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS jsonbset_start_value. +func (x *JsonbSet) StartValue() (*Jsonb, error) { + _r0, _err := functions.JsonbsetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// ValueN is MEOS jsonbset_value_n. +func (x *JsonbSet) ValueN(n int) (*Jsonb, bool, error) { + _found, _value, _err := functions.JsonbsetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return JsonbFromPointer(_value.Pointer()), true, nil +} + +// Values is MEOS jsonbset_values. +func (x *JsonbSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.JsonbsetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ArrayLength is MEOS jsonbset_array_length. +func (x *JsonbSet) ArrayLength() (*Set, error) { + _r0, _err := functions.JsonbsetArrayLength(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ObjectField is MEOS jsonbset_object_field. +func (x *JsonbSet) ObjectField(key string, null_handle functions.NullHandleType) (*Set, error) { + _r0, _err := functions.JsonbsetObjectField(functions.SetFromPointer(x.Pointer()), key, null_handle) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ObjectFieldText is MEOS jsonbset_object_field_text. +func (x *JsonbSet) ObjectFieldText(key string, null_handle functions.NullHandleType) (*Set, error) { + _r0, _err := functions.JsonbsetObjectFieldText(functions.SetFromPointer(x.Pointer()), key, null_handle) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ArrayElement is MEOS jsonbset_array_element. +func (x *JsonbSet) ArrayElement(idx int, null_handle functions.NullHandleType) (*Set, error) { + _r0, _err := functions.JsonbsetArrayElement(functions.SetFromPointer(x.Pointer()), idx, null_handle) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ArrayElementText is MEOS jsonbset_array_element_text. +func (x *JsonbSet) ArrayElementText(idx int, null_handle functions.NullHandleType) (*Set, error) { + _r0, _err := functions.JsonbsetArrayElementText(functions.SetFromPointer(x.Pointer()), idx, null_handle) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// DeleteIndex is MEOS jsonbset_delete_index. +func (x *JsonbSet) DeleteIndex(idx int) (*Set, error) { + _r0, _err := functions.JsonbsetDeleteIndex(functions.SetFromPointer(x.Pointer()), idx) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Delete is MEOS jsonbset_delete. +func (x *JsonbSet) Delete(key string) (*Set, error) { + _r0, _err := functions.JsonbsetDelete(functions.SetFromPointer(x.Pointer()), key) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// DeleteArray is MEOS jsonbset_delete_array. +func (x *JsonbSet) DeleteArray(keys unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.JsonbsetDeleteArray(functions.SetFromPointer(x.Pointer()), keys, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Exists is MEOS jsonbset_exists. +func (x *JsonbSet) Exists(key string, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.JsonbsetExists(functions.SetFromPointer(x.Pointer()), key, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ExistsArray is MEOS jsonbset_exists_array. +func (x *JsonbSet) ExistsArray(keys unsafe.Pointer, count int, any bool, rescount unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.JsonbsetExistsArray(functions.SetFromPointer(x.Pointer()), keys, count, any, rescount) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// JsonbsetSet is MEOS jsonbset_set. +func (x *JsonbSet) JsonbsetSet(keys unsafe.Pointer, count int, newjb *Jsonb, create bool, null_handle string, lax bool) (*Set, error) { + _r0, _err := functions.JsonbsetSet(functions.SetFromPointer(x.Pointer()), keys, count, functions.JsonbFromPointer(newjb.Pointer()), create, null_handle, lax) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ToAlphanumset is MEOS jsonbset_to_alphanumset. +func (x *JsonbSet) ToAlphanumset(key string, settype functions.MeosType, null_handle functions.NullHandleType) (*Set, error) { + _r0, _err := functions.JsonbsetToAlphanumset(functions.SetFromPointer(x.Pointer()), key, settype, null_handle) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ToIntset is MEOS jsonbset_to_intset. +func (x *JsonbSet) ToIntset(key string, null_handle functions.NullHandleType) (*Set, error) { + _r0, _err := functions.JsonbsetToIntset(functions.SetFromPointer(x.Pointer()), key, null_handle) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ToBigintset is MEOS jsonbset_to_bigintset. +func (x *JsonbSet) ToBigintset(key string, null_handle functions.NullHandleType) (*Set, error) { + _r0, _err := functions.JsonbsetToBigintset(functions.SetFromPointer(x.Pointer()), key, null_handle) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ToFloatset is MEOS jsonbset_to_floatset. +func (x *JsonbSet) ToFloatset(key string, null_handle functions.NullHandleType) (*Set, error) { + _r0, _err := functions.JsonbsetToFloatset(functions.SetFromPointer(x.Pointer()), key, null_handle) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ToTextsetKey is MEOS jsonbset_to_textset_key. +func (x *JsonbSet) ToTextsetKey(key string, null_handle functions.NullHandleType) (*Set, error) { + _r0, _err := functions.JsonbsetToTextsetKey(functions.SetFromPointer(x.Pointer()), key, null_handle) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// StripNulls is MEOS jsonbset_strip_nulls. +func (x *JsonbSet) StripNulls(strip_in_arrays bool) (*Set, error) { + _r0, _err := functions.JsonbsetStripNulls(functions.SetFromPointer(x.Pointer()), strip_in_arrays) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Pretty is MEOS jsonbset_pretty. +func (x *JsonbSet) Pretty() (*Set, error) { + _r0, _err := functions.JsonbsetPretty(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// DeletePath is MEOS jsonbset_delete_path. +func (x *JsonbSet) DeletePath(path_elems unsafe.Pointer, path_len int) (*Set, error) { + _r0, _err := functions.JsonbsetDeletePath(functions.SetFromPointer(x.Pointer()), path_elems, path_len) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ExtractPath is MEOS jsonbset_extract_path. +func (x *JsonbSet) ExtractPath(path_elems unsafe.Pointer, path_len int, null_handle functions.NullHandleType) (*Set, error) { + _r0, _err := functions.JsonbsetExtractPath(functions.SetFromPointer(x.Pointer()), path_elems, path_len, null_handle) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ExtractPathText is MEOS jsonbset_extract_path_text. +func (x *JsonbSet) ExtractPathText(path_elems unsafe.Pointer, path_len int, null_handle functions.NullHandleType) (*Set, error) { + _r0, _err := functions.JsonbsetExtractPathText(functions.SetFromPointer(x.Pointer()), path_elems, path_len, null_handle) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Insert is MEOS jsonbset_insert. +func (x *JsonbSet) Insert(path_elems unsafe.Pointer, path_len int, newjb *Jsonb, after bool) (*Set, error) { + _r0, _err := functions.JsonbsetInsert(functions.SetFromPointer(x.Pointer()), path_elems, path_len, functions.JsonbFromPointer(newjb.Pointer()), after) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// PathExists is MEOS jsonbset_path_exists. +func (x *JsonbSet) PathExists(jp *JsonPath, vars *Jsonb, silent bool, tz bool, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.JsonbsetPathExists(functions.SetFromPointer(x.Pointer()), functions.JsonPathFromPointer(jp.Pointer()), functions.JsonbFromPointer(vars.Pointer()), silent, tz, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PathMatch is MEOS jsonbset_path_match. +func (x *JsonbSet) PathMatch(jp *JsonPath, vars *Jsonb, silent bool, tz bool, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.JsonbsetPathMatch(functions.SetFromPointer(x.Pointer()), functions.JsonPathFromPointer(jp.Pointer()), functions.JsonbFromPointer(vars.Pointer()), silent, tz, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PathQueryArray is MEOS jsonbset_path_query_array. +func (x *JsonbSet) PathQueryArray(jp *JsonPath, vars *Jsonb, silent bool, tz bool) (*Set, error) { + _r0, _err := functions.JsonbsetPathQueryArray(functions.SetFromPointer(x.Pointer()), functions.JsonPathFromPointer(jp.Pointer()), functions.JsonbFromPointer(vars.Pointer()), silent, tz) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// PathQueryFirst is MEOS jsonbset_path_query_first. +func (x *JsonbSet) PathQueryFirst(jp *JsonPath, vars *Jsonb, silent bool, tz bool) (*Set, error) { + _r0, _err := functions.JsonbsetPathQueryFirst(functions.SetFromPointer(x.Pointer()), functions.JsonPathFromPointer(jp.Pointer()), functions.JsonbFromPointer(vars.Pointer()), silent, tz) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// JsonbSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func JsonbSetFromHexWKB(hexwkb string) (*JsonbSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return JsonbSetFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS jsonbset_out. +func (x *JsonbSet) AsText() (string, error) { + return x.Out() +} + +// JsonbSetFromText is the portable fromText of MEOS jsonbset_in. +func JsonbSetFromText(str string) (*JsonbSet, error) { + r, err := JsonbSetIn(str) + if err != nil || r == nil { + return nil, err + } + return JsonbSetFromPointer(r.Pointer()), nil +} + +// JsonbSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func JsonbSetFromWKB(wkb unsafe.Pointer, size uint) (*JsonbSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return JsonbSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS jsonbset_out. +func (x *JsonbSet) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/jsonpath.go b/types/jsonpath.go index fbd035c..aec6744 100644 --- a/types/jsonpath.go +++ b/types/jsonpath.go @@ -58,3 +58,22 @@ func (x *JsonPath) Out() (string, error) { } return _r0, nil } + +// AsText is the portable asText of MEOS jsonpath_out. +func (x *JsonPath) AsText() (string, error) { + return x.Out() +} + +// JsonPathFromText is the portable fromText of MEOS jsonpath_in. +func JsonPathFromText(str string) (*JsonPath, error) { + return JsonPathIn(str) +} + +// String is the text MEOS writes this value as, MEOS jsonpath_out. +func (x *JsonPath) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/npoint.go b/types/npoint.go index ac1b446..6f5b058 100644 --- a/types/npoint.go +++ b/types/npoint.go @@ -41,8 +41,8 @@ func (x *Npoint) AsEWKT(maxdd int) (string, error) { return _r0, nil } -// AsHEXEWKB is MEOS npoint_as_hexewkb. -func (x *Npoint) AsHEXEWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexEWKB is MEOS npoint_as_hexewkb. +func (x *Npoint) AsHexEWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.NpointAsHexewkb(functions.NpointFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -50,8 +50,8 @@ func (x *Npoint) AsHEXEWKB(variant uint8, size_out unsafe.Pointer) (string, erro return _r0, nil } -// AsHEXWKB is MEOS npoint_as_hexwkb. -func (x *Npoint) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexWKB is MEOS npoint_as_hexwkb. +func (x *Npoint) AsHexWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.NpointAsHexwkb(functions.NpointFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -77,8 +77,8 @@ func (x *Npoint) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, return _r0, nil } -// NpointFromHEXWKB is MEOS npoint_from_hexwkb. -func NpointFromHEXWKB(hexwkb string) (*Npoint, error) { +// NpointFromHexWKB is MEOS npoint_from_hexwkb. +func NpointFromHexWKB(hexwkb string) (*Npoint, error) { _r0, _err := functions.NpointFromHexwkb(hexwkb) if _err != nil { return nil, _err @@ -301,3 +301,32 @@ func (x *Npoint) ToSet() (*Set, error) { } return SetFromPointer(_r0.Pointer()), nil } + +// NpointFromEWKB is the portable fromEWKB of MEOS npoint_from_wkb. +func NpointFromEWKB(wkb unsafe.Pointer, size uint) (*Npoint, error) { + return NpointFromWKB(wkb, size) +} + +// NpointFromEWKT is the portable fromEWKT of MEOS npoint_in. +func NpointFromEWKT(str string) (*Npoint, error) { + return NpointIn(str) +} + +// NpointFromHexEWKB is the portable fromHexEWKB of MEOS npoint_from_hexwkb. +func NpointFromHexEWKB(hexwkb string) (*Npoint, error) { + return NpointFromHexWKB(hexwkb) +} + +// NpointFromText is the portable fromText of MEOS npoint_in. +func NpointFromText(str string) (*Npoint, error) { + return NpointIn(str) +} + +// String is the text MEOS writes this value as, MEOS npoint_as_text. +func (x *Npoint) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/npointset.go b/types/npointset.go index 6421dc7..633fd06 100644 --- a/types/npointset.go +++ b/types/npointset.go @@ -9,7 +9,7 @@ import ( ) type NpointSet struct { - Set + SpatialSet } // NpointSetFromPointer wraps a MEOS pointer, answering nil for nil so an @@ -97,3 +97,66 @@ func (x *NpointSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { } return _r0, nil } + +// NpointSetFromEWKB is the portable fromEWKB of MEOS set_from_wkb. +func NpointSetFromEWKB(wkb unsafe.Pointer, size uint) (*NpointSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return NpointSetFromPointer(r.Pointer()), nil +} + +// NpointSetFromEWKT is the portable fromEWKT of MEOS npointset_in. +func NpointSetFromEWKT(str string) (*NpointSet, error) { + r, err := NpointSetIn(str) + if err != nil || r == nil { + return nil, err + } + return NpointSetFromPointer(r.Pointer()), nil +} + +// NpointSetFromHexEWKB is the portable fromHexEWKB of MEOS set_from_hexwkb. +func NpointSetFromHexEWKB(hexwkb string) (*NpointSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return NpointSetFromPointer(r.Pointer()), nil +} + +// NpointSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func NpointSetFromHexWKB(hexwkb string) (*NpointSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return NpointSetFromPointer(r.Pointer()), nil +} + +// NpointSetFromText is the portable fromText of MEOS npointset_in. +func NpointSetFromText(str string) (*NpointSet, error) { + r, err := NpointSetIn(str) + if err != nil || r == nil { + return nil, err + } + return NpointSetFromPointer(r.Pointer()), nil +} + +// NpointSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func NpointSetFromWKB(wkb unsafe.Pointer, size uint) (*NpointSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return NpointSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS spatialset_as_text. +func (x *NpointSet) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/nsegment.go b/types/nsegment.go index 5f91a02..7829954 100644 --- a/types/nsegment.go +++ b/types/nsegment.go @@ -23,8 +23,8 @@ func NsegmentFromPointer(p unsafe.Pointer) *Nsegment { return v } -// AsHEXEWKB is MEOS nsegment_as_hexewkb. -func (x *Nsegment) AsHEXEWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexEWKB is MEOS nsegment_as_hexewkb. +func (x *Nsegment) AsHexEWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.NsegmentAsHexewkb(functions.NsegmentFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -32,8 +32,8 @@ func (x *Nsegment) AsHEXEWKB(variant uint8, size_out unsafe.Pointer) (string, er return _r0, nil } -// AsHEXWKB is MEOS nsegment_as_hexwkb. -func (x *Nsegment) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexWKB is MEOS nsegment_as_hexwkb. +func (x *Nsegment) AsHexWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.NsegmentAsHexwkb(functions.NsegmentFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -50,8 +50,8 @@ func (x *Nsegment) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer return _r0, nil } -// NsegmentFromHEXWKB is MEOS nsegment_from_hexwkb. -func NsegmentFromHEXWKB(hexwkb string) (*Nsegment, error) { +// NsegmentFromHexWKB is MEOS nsegment_from_hexwkb. +func NsegmentFromHexWKB(hexwkb string) (*Nsegment, error) { _r0, _err := functions.NsegmentFromHexwkb(hexwkb) if _err != nil { return nil, _err @@ -256,3 +256,32 @@ func (x *Nsegment) Ne(ns2 *Nsegment) (bool, error) { } return _r0, nil } + +// NsegmentFromEWKB is the portable fromEWKB of MEOS nsegment_from_wkb. +func NsegmentFromEWKB(wkb unsafe.Pointer, size uint) (*Nsegment, error) { + return NsegmentFromWKB(wkb, size) +} + +// NsegmentFromEWKT is the portable fromEWKT of MEOS nsegment_in. +func NsegmentFromEWKT(str string) (*Nsegment, error) { + return NsegmentIn(str) +} + +// NsegmentFromHexEWKB is the portable fromHexEWKB of MEOS nsegment_from_hexwkb. +func NsegmentFromHexEWKB(hexwkb string) (*Nsegment, error) { + return NsegmentFromHexWKB(hexwkb) +} + +// NsegmentFromText is the portable fromText of MEOS nsegment_in. +func NsegmentFromText(str string) (*Nsegment, error) { + return NsegmentIn(str) +} + +// String is the text MEOS writes this value as, MEOS nsegment_as_text. +func (x *Nsegment) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/pcpatch.go b/types/pcpatch.go index 44f8d79..155e1db 100644 --- a/types/pcpatch.go +++ b/types/pcpatch.go @@ -41,8 +41,8 @@ func (x *Pcpatch) HexOut(maxdd int) (string, error) { return _r0, nil } -// PcpatchFromHEXWKB is MEOS pcpatch_from_hexwkb. -func PcpatchFromHEXWKB(hexwkb string) (*Pcpatch, error) { +// PcpatchFromHexWKB is MEOS pcpatch_from_hexwkb. +func PcpatchFromHexWKB(hexwkb string) (*Pcpatch, error) { _r0, _err := functions.PcpatchFromHexwkb(hexwkb) if _err != nil { return nil, _err @@ -50,8 +50,8 @@ func PcpatchFromHEXWKB(hexwkb string) (*Pcpatch, error) { return PcpatchFromPointer(_r0.Pointer()), nil } -// AsHEXWKB is MEOS pcpatch_as_hexwkb. -func (x *Pcpatch) AsHEXWKB() (string, error) { +// AsHexWKB is MEOS pcpatch_as_hexwkb. +func (x *Pcpatch) AsHexWKB() (string, error) { _r0, _err := functions.PcpatchAsHexwkb(functions.PcpatchFromPointer(x.Pointer())) if _err != nil { return "", _err @@ -238,3 +238,22 @@ func (x *Pcpatch) ToTpcbox() (*TPCBox, error) { } return TPCBoxFromPointer(_r0.Pointer()), nil } + +// AsText is the portable asText of MEOS pcpatch_hex_out. +func (x *Pcpatch) AsText(maxdd int) (string, error) { + return x.HexOut(maxdd) +} + +// PcpatchFromText is the portable fromText of MEOS pcpatch_hex_in. +func PcpatchFromText(str string) (*Pcpatch, error) { + return PcpatchHexIn(str) +} + +// String is the text MEOS writes this value as, MEOS pcpatch_hex_out. +func (x *Pcpatch) String() string { + s, err := x.HexOut(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/pcpatchset.go b/types/pcpatchset.go new file mode 100644 index 0000000..f3074b1 --- /dev/null +++ b/types/pcpatchset.go @@ -0,0 +1,153 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type PcpatchSet struct { + SpatialSet +} + +// PcpatchSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func PcpatchSetFromPointer(p unsafe.Pointer) *PcpatchSet { + if p == nil { + return nil + } + v := &PcpatchSet{} + v.ptr = p + return v +} + +// PcpatchSetIn is MEOS pcpatchset_in. +func PcpatchSetIn(str string) (*Set, error) { + _r0, _err := functions.PcpatchsetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS pcpatchset_out. +func (x *PcpatchSet) Out(maxdd int) (string, error) { + _r0, _err := functions.PcpatchsetOut(functions.SetFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// PcpatchSetMake is MEOS pcpatchset_make. +func PcpatchSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.PcpatchsetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS pcpatchset_start_value. +func (x *PcpatchSet) StartValue() (*Pcpatch, error) { + _r0, _err := functions.PcpatchsetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PcpatchFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS pcpatchset_end_value. +func (x *PcpatchSet) EndValue() (*Pcpatch, error) { + _r0, _err := functions.PcpatchsetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PcpatchFromPointer(_r0.Pointer()), nil +} + +// ValueN is MEOS pcpatchset_value_n. +func (x *PcpatchSet) ValueN(n int) (*Pcpatch, bool, error) { + _found, _value, _err := functions.PcpatchsetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return PcpatchFromPointer(_value.Pointer()), true, nil +} + +// Values is MEOS pcpatchset_values. +func (x *PcpatchSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.PcpatchsetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PcpatchSetFromEWKB is the portable fromEWKB of MEOS set_from_wkb. +func PcpatchSetFromEWKB(wkb unsafe.Pointer, size uint) (*PcpatchSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return PcpatchSetFromPointer(r.Pointer()), nil +} + +// PcpatchSetFromEWKT is the portable fromEWKT of MEOS pcpatchset_in. +func PcpatchSetFromEWKT(str string) (*PcpatchSet, error) { + r, err := PcpatchSetIn(str) + if err != nil || r == nil { + return nil, err + } + return PcpatchSetFromPointer(r.Pointer()), nil +} + +// PcpatchSetFromHexEWKB is the portable fromHexEWKB of MEOS set_from_hexwkb. +func PcpatchSetFromHexEWKB(hexwkb string) (*PcpatchSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return PcpatchSetFromPointer(r.Pointer()), nil +} + +// PcpatchSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func PcpatchSetFromHexWKB(hexwkb string) (*PcpatchSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return PcpatchSetFromPointer(r.Pointer()), nil +} + +// PcpatchSetFromText is the portable fromText of MEOS pcpatchset_in. +func PcpatchSetFromText(str string) (*PcpatchSet, error) { + r, err := PcpatchSetIn(str) + if err != nil || r == nil { + return nil, err + } + return PcpatchSetFromPointer(r.Pointer()), nil +} + +// PcpatchSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func PcpatchSetFromWKB(wkb unsafe.Pointer, size uint) (*PcpatchSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return PcpatchSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS spatialset_as_text. +func (x *PcpatchSet) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/pcpoint.go b/types/pcpoint.go index fdd4d1b..8feacf2 100644 --- a/types/pcpoint.go +++ b/types/pcpoint.go @@ -41,8 +41,8 @@ func (x *Pcpoint) HexOut(maxdd int) (string, error) { return _r0, nil } -// PcpointFromHEXWKB is MEOS pcpoint_from_hexwkb. -func PcpointFromHEXWKB(hexwkb string) (*Pcpoint, error) { +// PcpointFromHexWKB is MEOS pcpoint_from_hexwkb. +func PcpointFromHexWKB(hexwkb string) (*Pcpoint, error) { _r0, _err := functions.PcpointFromHexwkb(hexwkb) if _err != nil { return nil, _err @@ -50,8 +50,8 @@ func PcpointFromHEXWKB(hexwkb string) (*Pcpoint, error) { return PcpointFromPointer(_r0.Pointer()), nil } -// AsHEXWKB is MEOS pcpoint_as_hexwkb. -func (x *Pcpoint) AsHEXWKB() (string, error) { +// AsHexWKB is MEOS pcpoint_as_hexwkb. +func (x *Pcpoint) AsHexWKB() (string, error) { _r0, _err := functions.PcpointAsHexwkb(functions.PcpointFromPointer(x.Pointer())) if _err != nil { return "", _err @@ -229,3 +229,22 @@ func (x *Pcpoint) ToSet() (*Set, error) { } return SetFromPointer(_r0.Pointer()), nil } + +// AsText is the portable asText of MEOS pcpoint_hex_out. +func (x *Pcpoint) AsText(maxdd int) (string, error) { + return x.HexOut(maxdd) +} + +// PcpointFromText is the portable fromText of MEOS pcpoint_hex_in. +func PcpointFromText(str string) (*Pcpoint, error) { + return PcpointHexIn(str) +} + +// String is the text MEOS writes this value as, MEOS pcpoint_hex_out. +func (x *Pcpoint) String() string { + s, err := x.HexOut(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/pcpointset.go b/types/pcpointset.go new file mode 100644 index 0000000..d1cdde3 --- /dev/null +++ b/types/pcpointset.go @@ -0,0 +1,153 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type PcpointSet struct { + SpatialSet +} + +// PcpointSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func PcpointSetFromPointer(p unsafe.Pointer) *PcpointSet { + if p == nil { + return nil + } + v := &PcpointSet{} + v.ptr = p + return v +} + +// PcpointSetIn is MEOS pcpointset_in. +func PcpointSetIn(str string) (*Set, error) { + _r0, _err := functions.PcpointsetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS pcpointset_out. +func (x *PcpointSet) Out(maxdd int) (string, error) { + _r0, _err := functions.PcpointsetOut(functions.SetFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// PcpointSetMake is MEOS pcpointset_make. +func PcpointSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.PcpointsetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS pcpointset_start_value. +func (x *PcpointSet) StartValue() (*Pcpoint, error) { + _r0, _err := functions.PcpointsetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PcpointFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS pcpointset_end_value. +func (x *PcpointSet) EndValue() (*Pcpoint, error) { + _r0, _err := functions.PcpointsetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PcpointFromPointer(_r0.Pointer()), nil +} + +// ValueN is MEOS pcpointset_value_n. +func (x *PcpointSet) ValueN(n int) (*Pcpoint, bool, error) { + _found, _value, _err := functions.PcpointsetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return PcpointFromPointer(_value.Pointer()), true, nil +} + +// Values is MEOS pcpointset_values. +func (x *PcpointSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.PcpointsetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PcpointSetFromEWKB is the portable fromEWKB of MEOS set_from_wkb. +func PcpointSetFromEWKB(wkb unsafe.Pointer, size uint) (*PcpointSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return PcpointSetFromPointer(r.Pointer()), nil +} + +// PcpointSetFromEWKT is the portable fromEWKT of MEOS pcpointset_in. +func PcpointSetFromEWKT(str string) (*PcpointSet, error) { + r, err := PcpointSetIn(str) + if err != nil || r == nil { + return nil, err + } + return PcpointSetFromPointer(r.Pointer()), nil +} + +// PcpointSetFromHexEWKB is the portable fromHexEWKB of MEOS set_from_hexwkb. +func PcpointSetFromHexEWKB(hexwkb string) (*PcpointSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return PcpointSetFromPointer(r.Pointer()), nil +} + +// PcpointSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func PcpointSetFromHexWKB(hexwkb string) (*PcpointSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return PcpointSetFromPointer(r.Pointer()), nil +} + +// PcpointSetFromText is the portable fromText of MEOS pcpointset_in. +func PcpointSetFromText(str string) (*PcpointSet, error) { + r, err := PcpointSetIn(str) + if err != nil || r == nil { + return nil, err + } + return PcpointSetFromPointer(r.Pointer()), nil +} + +// PcpointSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func PcpointSetFromWKB(wkb unsafe.Pointer, size uint) (*PcpointSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return PcpointSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS spatialset_as_text. +func (x *PcpointSet) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/pose.go b/types/pose.go index 468f3a4..7e6a844 100644 --- a/types/pose.go +++ b/types/pose.go @@ -41,8 +41,8 @@ func (x *Pose) AsEWKT(maxdd int) (string, error) { return _r0, nil } -// AsHEXEWKB is MEOS pose_as_hexewkb. -func (x *Pose) AsHEXEWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexEWKB is MEOS pose_as_hexewkb. +func (x *Pose) AsHexEWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.PoseAsHexewkb(functions.PoseFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -50,8 +50,8 @@ func (x *Pose) AsHEXEWKB(variant uint8, size_out unsafe.Pointer) (string, error) return _r0, nil } -// AsHEXWKB is MEOS pose_as_hexwkb. -func (x *Pose) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexWKB is MEOS pose_as_hexwkb. +func (x *Pose) AsHexWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.PoseAsHexwkb(functions.PoseFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -86,8 +86,8 @@ func PoseFromWKB(wkb unsafe.Pointer, size uint) (*Pose, error) { return PoseFromPointer(_r0.Pointer()), nil } -// PoseFromHEXWKB is MEOS pose_from_hexwkb. -func PoseFromHEXWKB(hexwkb string) (*Pose, error) { +// PoseFromHexWKB is MEOS pose_from_hexwkb. +func PoseFromHexWKB(hexwkb string) (*Pose, error) { _r0, _err := functions.PoseFromHexwkb(hexwkb) if _err != nil { return nil, _err @@ -481,3 +481,27 @@ func (x *Pose) ToPosechain() (unsafe.Pointer, error) { } return _r0, nil } + +// PoseFromEWKB is the portable fromEWKB of MEOS pose_from_wkb. +func PoseFromEWKB(wkb unsafe.Pointer, size uint) (*Pose, error) { + return PoseFromWKB(wkb, size) +} + +// PoseFromEWKT is the portable fromEWKT of MEOS pose_from_text. +func PoseFromEWKT(str string) (*Pose, error) { + return PoseFromText(str) +} + +// PoseFromHexEWKB is the portable fromHexEWKB of MEOS pose_from_hexwkb. +func PoseFromHexEWKB(hexwkb string) (*Pose, error) { + return PoseFromHexWKB(hexwkb) +} + +// String is the text MEOS writes this value as, MEOS pose_as_text. +func (x *Pose) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/posechain.go b/types/posechain.go index d7ecc44..be4000f 100644 --- a/types/posechain.go +++ b/types/posechain.go @@ -77,8 +77,8 @@ func PoseChainAsWKB(pc unsafe.Pointer, variant uint8, size_out unsafe.Pointer) ( return _r0, nil } -// PoseChainAsHEXEWKB is MEOS posechain_as_hexewkb. -func PoseChainAsHEXEWKB(pc unsafe.Pointer, variant uint8, size_out unsafe.Pointer) (string, error) { +// PoseChainAsHexEWKB is MEOS posechain_as_hexewkb. +func PoseChainAsHexEWKB(pc unsafe.Pointer, variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.PosechainAsHexewkb(pc, variant, size_out) if _err != nil { return "", _err @@ -86,8 +86,8 @@ func PoseChainAsHEXEWKB(pc unsafe.Pointer, variant uint8, size_out unsafe.Pointe return _r0, nil } -// PoseChainAsHEXWKB is MEOS posechain_as_hexwkb. -func PoseChainAsHEXWKB(pc unsafe.Pointer, variant uint8, size_out unsafe.Pointer) (string, error) { +// PoseChainAsHexWKB is MEOS posechain_as_hexwkb. +func PoseChainAsHexWKB(pc unsafe.Pointer, variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.PosechainAsHexwkb(pc, variant, size_out) if _err != nil { return "", _err @@ -104,8 +104,8 @@ func PoseChainFromWKB(wkb unsafe.Pointer, size uint) (unsafe.Pointer, error) { return _r0, nil } -// PoseChainFromHEXWKB is MEOS posechain_from_hexwkb. -func PoseChainFromHEXWKB(hexwkb string) (unsafe.Pointer, error) { +// PoseChainFromHexWKB is MEOS posechain_from_hexwkb. +func PoseChainFromHexWKB(hexwkb string) (unsafe.Pointer, error) { _r0, _err := functions.PosechainFromHexwkb(hexwkb) if _err != nil { return nil, _err @@ -382,3 +382,23 @@ func PoseChainToSet(pc unsafe.Pointer) (*Set, error) { } return SetFromPointer(_r0.Pointer()), nil } + +// PoseChainFromEWKB is the portable fromEWKB of MEOS posechain_from_wkb. +func PoseChainFromEWKB(wkb unsafe.Pointer, size uint) (unsafe.Pointer, error) { + return PoseChainFromWKB(wkb, size) +} + +// PoseChainFromEWKT is the portable fromEWKT of MEOS posechain_in. +func PoseChainFromEWKT(str string) (unsafe.Pointer, error) { + return PoseChainIn(str) +} + +// PoseChainFromHexEWKB is the portable fromHexEWKB of MEOS posechain_from_hexwkb. +func PoseChainFromHexEWKB(hexwkb string) (unsafe.Pointer, error) { + return PoseChainFromHexWKB(hexwkb) +} + +// PoseChainFromText is the portable fromText of MEOS posechain_in. +func PoseChainFromText(str string) (unsafe.Pointer, error) { + return PoseChainIn(str) +} diff --git a/types/posechainset.go b/types/posechainset.go new file mode 100644 index 0000000..31f9400 --- /dev/null +++ b/types/posechainset.go @@ -0,0 +1,141 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type PoseChainSet struct { + SpatialSet +} + +// PoseChainSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func PoseChainSetFromPointer(p unsafe.Pointer) *PoseChainSet { + if p == nil { + return nil + } + v := &PoseChainSet{} + v.ptr = p + return v +} + +// PoseChainSetIn is MEOS posechainset_in. +func PoseChainSetIn(str string) (*Set, error) { + _r0, _err := functions.PosechainsetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS posechainset_out. +func (x *PoseChainSet) Out(maxdd int) (string, error) { + _r0, _err := functions.PosechainsetOut(functions.SetFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// PoseChainSetMake is MEOS posechainset_make. +func PoseChainSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.PosechainsetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS posechainset_end_value. +func (x *PoseChainSet) EndValue() (unsafe.Pointer, error) { + _r0, _err := functions.PosechainsetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// StartValue is MEOS posechainset_start_value. +func (x *PoseChainSet) StartValue() (unsafe.Pointer, error) { + _r0, _err := functions.PosechainsetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Values is MEOS posechainset_values. +func (x *PoseChainSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.PosechainsetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PoseChainSetFromEWKB is the portable fromEWKB of MEOS set_from_wkb. +func PoseChainSetFromEWKB(wkb unsafe.Pointer, size uint) (*PoseChainSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return PoseChainSetFromPointer(r.Pointer()), nil +} + +// PoseChainSetFromEWKT is the portable fromEWKT of MEOS posechainset_in. +func PoseChainSetFromEWKT(str string) (*PoseChainSet, error) { + r, err := PoseChainSetIn(str) + if err != nil || r == nil { + return nil, err + } + return PoseChainSetFromPointer(r.Pointer()), nil +} + +// PoseChainSetFromHexEWKB is the portable fromHexEWKB of MEOS set_from_hexwkb. +func PoseChainSetFromHexEWKB(hexwkb string) (*PoseChainSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return PoseChainSetFromPointer(r.Pointer()), nil +} + +// PoseChainSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func PoseChainSetFromHexWKB(hexwkb string) (*PoseChainSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return PoseChainSetFromPointer(r.Pointer()), nil +} + +// PoseChainSetFromText is the portable fromText of MEOS posechainset_in. +func PoseChainSetFromText(str string) (*PoseChainSet, error) { + r, err := PoseChainSetIn(str) + if err != nil || r == nil { + return nil, err + } + return PoseChainSetFromPointer(r.Pointer()), nil +} + +// PoseChainSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func PoseChainSetFromWKB(wkb unsafe.Pointer, size uint) (*PoseChainSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return PoseChainSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS spatialset_as_text. +func (x *PoseChainSet) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/poseset.go b/types/poseset.go index 98d99a5..a539738 100644 --- a/types/poseset.go +++ b/types/poseset.go @@ -9,7 +9,7 @@ import ( ) type PoseSet struct { - Set + SpatialSet } // PoseSetFromPointer wraps a MEOS pointer, answering nil for nil so an @@ -88,3 +88,66 @@ func (x *PoseSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { } return _r0, nil } + +// PoseSetFromEWKB is the portable fromEWKB of MEOS set_from_wkb. +func PoseSetFromEWKB(wkb unsafe.Pointer, size uint) (*PoseSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return PoseSetFromPointer(r.Pointer()), nil +} + +// PoseSetFromEWKT is the portable fromEWKT of MEOS poseset_in. +func PoseSetFromEWKT(str string) (*PoseSet, error) { + r, err := PoseSetIn(str) + if err != nil || r == nil { + return nil, err + } + return PoseSetFromPointer(r.Pointer()), nil +} + +// PoseSetFromHexEWKB is the portable fromHexEWKB of MEOS set_from_hexwkb. +func PoseSetFromHexEWKB(hexwkb string) (*PoseSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return PoseSetFromPointer(r.Pointer()), nil +} + +// PoseSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func PoseSetFromHexWKB(hexwkb string) (*PoseSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return PoseSetFromPointer(r.Pointer()), nil +} + +// PoseSetFromText is the portable fromText of MEOS poseset_in. +func PoseSetFromText(str string) (*PoseSet, error) { + r, err := PoseSetIn(str) + if err != nil || r == nil { + return nil, err + } + return PoseSetFromPointer(r.Pointer()), nil +} + +// PoseSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func PoseSetFromWKB(wkb unsafe.Pointer, size uint) (*PoseSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return PoseSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS spatialset_as_text. +func (x *PoseSet) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/quadbinset.go b/types/quadbinset.go new file mode 100644 index 0000000..4e588c9 --- /dev/null +++ b/types/quadbinset.go @@ -0,0 +1,189 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type QuadbinSet struct { + SpatialSet +} + +// QuadbinSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func QuadbinSetFromPointer(p unsafe.Pointer) *QuadbinSet { + if p == nil { + return nil + } + v := &QuadbinSet{} + v.ptr = p + return v +} + +// GridDisk is MEOS quadbinset_grid_disk. +func (x *QuadbinSet) GridDisk(k int) (*Set, error) { + _r0, _err := functions.QuadbinsetGridDisk(functions.SetFromPointer(x.Pointer()), k) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// CompactCells is MEOS quadbinset_compact_cells. +func (x *QuadbinSet) CompactCells() (*Set, error) { + _r0, _err := functions.QuadbinsetCompactCells(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// UncompactCells is MEOS quadbinset_uncompact_cells. +func (x *QuadbinSet) UncompactCells(resolution int) (*Set, error) { + _r0, _err := functions.QuadbinsetUncompactCells(functions.SetFromPointer(x.Pointer()), resolution) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// CoverCells is MEOS quadbinset_cover_cells. +func (x *QuadbinSet) CoverCells(resolution int) (*Set, error) { + _r0, _err := functions.QuadbinsetCoverCells(functions.SetFromPointer(x.Pointer()), resolution) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// QuadbinSetIn is MEOS quadbinset_in. +func QuadbinSetIn(str string) (*Set, error) { + _r0, _err := functions.QuadbinsetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS quadbinset_out. +func (x *QuadbinSet) Out() (string, error) { + _r0, _err := functions.QuadbinsetOut(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// QuadbinSetMake is MEOS quadbinset_make. +func QuadbinSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.QuadbinsetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS quadbinset_end_value. +func (x *QuadbinSet) EndValue() (uint64, error) { + _r0, _err := functions.QuadbinsetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartValue is MEOS quadbinset_start_value. +func (x *QuadbinSet) StartValue() (uint64, error) { + _r0, _err := functions.QuadbinsetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ValueN is MEOS quadbinset_value_n. +func (x *QuadbinSet) ValueN(n int) (uint64, bool, error) { + _found, _value, _err := functions.QuadbinsetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Values is MEOS quadbinset_values. +func (x *QuadbinSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.QuadbinsetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// QuadbinSetFromEWKB is the portable fromEWKB of MEOS set_from_wkb. +func QuadbinSetFromEWKB(wkb unsafe.Pointer, size uint) (*QuadbinSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return QuadbinSetFromPointer(r.Pointer()), nil +} + +// QuadbinSetFromEWKT is the portable fromEWKT of MEOS quadbinset_in. +func QuadbinSetFromEWKT(str string) (*QuadbinSet, error) { + r, err := QuadbinSetIn(str) + if err != nil || r == nil { + return nil, err + } + return QuadbinSetFromPointer(r.Pointer()), nil +} + +// QuadbinSetFromHexEWKB is the portable fromHexEWKB of MEOS set_from_hexwkb. +func QuadbinSetFromHexEWKB(hexwkb string) (*QuadbinSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return QuadbinSetFromPointer(r.Pointer()), nil +} + +// QuadbinSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func QuadbinSetFromHexWKB(hexwkb string) (*QuadbinSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return QuadbinSetFromPointer(r.Pointer()), nil +} + +// QuadbinSetFromText is the portable fromText of MEOS quadbinset_in. +func QuadbinSetFromText(str string) (*QuadbinSet, error) { + r, err := QuadbinSetIn(str) + if err != nil || r == nil { + return nil, err + } + return QuadbinSetFromPointer(r.Pointer()), nil +} + +// QuadbinSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func QuadbinSetFromWKB(wkb unsafe.Pointer, size uint) (*QuadbinSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return QuadbinSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS quadbinset_out. +func (x *QuadbinSet) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/raquet.go b/types/raquet.go index b5eab6d..20d39e4 100644 --- a/types/raquet.go +++ b/types/raquet.go @@ -68,8 +68,8 @@ func RaquetFromWKB(wkb unsafe.Pointer, size uint) (unsafe.Pointer, error) { return _r0, nil } -// RaquetFromHEXWKB is MEOS raquet_from_hexwkb. -func RaquetFromHEXWKB(hexwkb string) (unsafe.Pointer, error) { +// RaquetFromHexWKB is MEOS raquet_from_hexwkb. +func RaquetFromHexWKB(hexwkb string) (unsafe.Pointer, error) { _r0, _err := functions.RaquetFromHexwkb(hexwkb) if _err != nil { return nil, _err @@ -86,8 +86,8 @@ func RaquetAsWKB(rq unsafe.Pointer, variant uint8, size_out unsafe.Pointer) (uns return _r0, nil } -// RaquetAsHEXWKB is MEOS raquet_as_hexwkb. -func RaquetAsHEXWKB(rq unsafe.Pointer, variant uint8, size_out unsafe.Pointer) (string, error) { +// RaquetAsHexWKB is MEOS raquet_as_hexwkb. +func RaquetAsHexWKB(rq unsafe.Pointer, variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.RaquetAsHexwkb(rq, variant, size_out) if _err != nil { return "", _err @@ -295,3 +295,8 @@ func RaquetGt(rq1 unsafe.Pointer, rq2 unsafe.Pointer) (bool, error) { } return _r0, nil } + +// RaquetFromText is the portable fromText of MEOS raquet_in. +func RaquetFromText(str string) (unsafe.Pointer, error) { + return RaquetIn(str) +} diff --git a/types/raster.go b/types/raster.go index d05299c..8c21e71 100644 --- a/types/raster.go +++ b/types/raster.go @@ -32,8 +32,8 @@ func RasterFromWKB(wkb unsafe.Pointer, size uint) (unsafe.Pointer, error) { return _r0, nil } -// RasterFromHEXWKB is MEOS raster_from_hexwkb. -func RasterFromHEXWKB(hexwkb string) (unsafe.Pointer, error) { +// RasterFromHexWKB is MEOS raster_from_hexwkb. +func RasterFromHexWKB(hexwkb string) (unsafe.Pointer, error) { _r0, _err := functions.RasterFromHexwkb(hexwkb) if _err != nil { return nil, _err @@ -50,8 +50,8 @@ func RasterAsWKB(rast unsafe.Pointer, variant uint8, size_out unsafe.Pointer) (u return _r0, nil } -// RasterAsHEXWKB is MEOS raster_as_hexwkb. -func RasterAsHEXWKB(rast unsafe.Pointer, variant uint8, size_out unsafe.Pointer) (string, error) { +// RasterAsHexWKB is MEOS raster_as_hexwkb. +func RasterAsHexWKB(rast unsafe.Pointer, variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.RasterAsHexwkb(rast, variant, size_out) if _err != nil { return "", _err @@ -333,8 +333,8 @@ func RasterValueCount(rast unsafe.Pointer, band int, exclude_nodata bool, search } // RasterSetValues is MEOS raster_set_values. -func RasterSetValues(rast unsafe.Pointer, band int, x int, y int, width int, height int, values unsafe.Pointer, nodata unsafe.Pointer, noset unsafe.Pointer, count int, keepnodata bool) (unsafe.Pointer, error) { - _r0, _err := functions.RasterSetValues(rast, band, x, y, width, height, values, nodata, noset, count, keepnodata) +func RasterSetValues(rast unsafe.Pointer, band int, x int, y int, width int, height int, values unsafe.Pointer, nodata unsafe.Pointer, noset unsafe.Pointer, nosetwidth int, nosetheight int, count int, keepnodata bool) (unsafe.Pointer, error) { + _r0, _err := functions.RasterSetValues(rast, band, x, y, width, height, values, nodata, noset, nosetwidth, nosetheight, count, keepnodata) if _err != nil { return nil, _err } diff --git a/types/s2cellset.go b/types/s2cellset.go new file mode 100644 index 0000000..3e0156d --- /dev/null +++ b/types/s2cellset.go @@ -0,0 +1,180 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type S2CellSet struct { + SpatialSet +} + +// S2CellSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func S2CellSetFromPointer(p unsafe.Pointer) *S2CellSet { + if p == nil { + return nil + } + v := &S2CellSet{} + v.ptr = p + return v +} + +// CompactCells is MEOS s2cellset_compact_cells. +func (x *S2CellSet) CompactCells() (*Set, error) { + _r0, _err := functions.S2cellsetCompactCells(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// UncompactCells is MEOS s2cellset_uncompact_cells. +func (x *S2CellSet) UncompactCells(resolution int) (*Set, error) { + _r0, _err := functions.S2cellsetUncompactCells(functions.SetFromPointer(x.Pointer()), resolution) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// CoverCells is MEOS s2cellset_cover_cells. +func (x *S2CellSet) CoverCells(resolution int) (*Set, error) { + _r0, _err := functions.S2cellsetCoverCells(functions.SetFromPointer(x.Pointer()), resolution) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// S2CellSetIn is MEOS s2cellset_in. +func S2CellSetIn(str string) (*Set, error) { + _r0, _err := functions.S2cellsetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS s2cellset_out. +func (x *S2CellSet) Out() (string, error) { + _r0, _err := functions.S2cellsetOut(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// S2CellSetMake is MEOS s2cellset_make. +func S2CellSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.S2cellsetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS s2cellset_end_value. +func (x *S2CellSet) EndValue() (uint64, error) { + _r0, _err := functions.S2cellsetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartValue is MEOS s2cellset_start_value. +func (x *S2CellSet) StartValue() (uint64, error) { + _r0, _err := functions.S2cellsetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ValueN is MEOS s2cellset_value_n. +func (x *S2CellSet) ValueN(n int) (uint64, bool, error) { + _found, _value, _err := functions.S2cellsetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Values is MEOS s2cellset_values. +func (x *S2CellSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.S2cellsetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// S2CellSetFromEWKB is the portable fromEWKB of MEOS set_from_wkb. +func S2CellSetFromEWKB(wkb unsafe.Pointer, size uint) (*S2CellSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return S2CellSetFromPointer(r.Pointer()), nil +} + +// S2CellSetFromEWKT is the portable fromEWKT of MEOS s2cellset_in. +func S2CellSetFromEWKT(str string) (*S2CellSet, error) { + r, err := S2CellSetIn(str) + if err != nil || r == nil { + return nil, err + } + return S2CellSetFromPointer(r.Pointer()), nil +} + +// S2CellSetFromHexEWKB is the portable fromHexEWKB of MEOS set_from_hexwkb. +func S2CellSetFromHexEWKB(hexwkb string) (*S2CellSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return S2CellSetFromPointer(r.Pointer()), nil +} + +// S2CellSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func S2CellSetFromHexWKB(hexwkb string) (*S2CellSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return S2CellSetFromPointer(r.Pointer()), nil +} + +// S2CellSetFromText is the portable fromText of MEOS s2cellset_in. +func S2CellSetFromText(str string) (*S2CellSet, error) { + r, err := S2CellSetIn(str) + if err != nil || r == nil { + return nil, err + } + return S2CellSetFromPointer(r.Pointer()), nil +} + +// S2CellSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func S2CellSetFromWKB(wkb unsafe.Pointer, size uint) (*S2CellSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return S2CellSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS s2cellset_out. +func (x *S2CellSet) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/set.go b/types/set.go index a028d26..1500f3c 100644 --- a/types/set.go +++ b/types/set.go @@ -23,8 +23,8 @@ func SetFromPointer(p unsafe.Pointer) *Set { return v } -// AsHEXWKB is MEOS set_as_hexwkb. -func (x *Set) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexWKB is MEOS set_as_hexwkb. +func (x *Set) AsHexWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.SetAsHexwkb(functions.SetFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -41,8 +41,8 @@ func (x *Set) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, err return _r0, nil } -// SetFromHEXWKB is MEOS set_from_hexwkb. -func SetFromHEXWKB(hexwkb string) (*Set, error) { +// SetFromHexWKB is MEOS set_from_hexwkb. +func SetFromHexWKB(hexwkb string) (*Set, error) { _r0, _err := functions.SetFromHexwkb(hexwkb) if _err != nil { return nil, _err diff --git a/types/span.go b/types/span.go index 7c5ac38..4d1131c 100644 --- a/types/span.go +++ b/types/span.go @@ -23,8 +23,8 @@ func SpanFromPointer(p unsafe.Pointer) *Span { return v } -// AsHEXWKB is MEOS span_as_hexwkb. -func (x *Span) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexWKB is MEOS span_as_hexwkb. +func (x *Span) AsHexWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.SpanAsHexwkb(functions.SpanFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -41,8 +41,8 @@ func (x *Span) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, er return _r0, nil } -// SpanFromHEXWKB is MEOS span_from_hexwkb. -func SpanFromHEXWKB(hexwkb string) (*Span, error) { +// SpanFromHexWKB is MEOS span_from_hexwkb. +func SpanFromHexWKB(hexwkb string) (*Span, error) { _r0, _err := functions.SpanFromHexwkb(hexwkb) if _err != nil { return nil, _err diff --git a/types/spanset.go b/types/spanset.go index ae58bd6..4e9cbb0 100644 --- a/types/spanset.go +++ b/types/spanset.go @@ -23,8 +23,8 @@ func SpanSetFromPointer(p unsafe.Pointer) *SpanSet { return v } -// AsHEXWKB is MEOS spanset_as_hexwkb. -func (x *SpanSet) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexWKB is MEOS spanset_as_hexwkb. +func (x *SpanSet) AsHexWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.SpansetAsHexwkb(functions.SpanSetFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -41,8 +41,8 @@ func (x *SpanSet) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, return _r0, nil } -// SpanSetFromHEXWKB is MEOS spanset_from_hexwkb. -func SpanSetFromHEXWKB(hexwkb string) (*SpanSet, error) { +// SpanSetFromHexWKB is MEOS spanset_from_hexwkb. +func SpanSetFromHexWKB(hexwkb string) (*SpanSet, error) { _r0, _err := functions.SpansetFromHexwkb(hexwkb) if _err != nil { return nil, _err diff --git a/types/spatialset.go b/types/spatialset.go new file mode 100644 index 0000000..3af4c9f --- /dev/null +++ b/types/spatialset.go @@ -0,0 +1,114 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type SpatialSet struct { + Set +} + +// SpatialSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func SpatialSetFromPointer(p unsafe.Pointer) *SpatialSet { + if p == nil { + return nil + } + v := &SpatialSet{} + v.ptr = p + return v +} + +// Out is MEOS spatialset_out. +func (x *SpatialSet) Out(maxdd int) (string, error) { + _r0, _err := functions.SpatialsetOut(functions.SetFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsText is MEOS spatialset_as_text. +func (x *SpatialSet) AsText(maxdd int) (string, error) { + _r0, _err := functions.SpatialsetAsText(functions.SetFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsEWKB is MEOS spatialset_as_ewkb. +func (x *SpatialSet) AsEWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.SpatialsetAsEWKB(functions.SetFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// AsEWKT is MEOS spatialset_as_ewkt. +func (x *SpatialSet) AsEWKT(maxdd int) (string, error) { + _r0, _err := functions.SpatialsetAsEWKT(functions.SetFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsHexEWKB is MEOS spatialset_as_hexewkb. +func (x *SpatialSet) AsHexEWKB(variant uint8, size_out unsafe.Pointer) (string, error) { + _r0, _err := functions.SpatialsetAsHexewkb(functions.SetFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// SetSRID is MEOS spatialset_set_srid. +func (x *SpatialSet) SetSRID(srid int32) (*Set, error) { + _r0, _err := functions.SpatialsetSetSRID(functions.SetFromPointer(x.Pointer()), srid) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// SRID is MEOS spatialset_srid. +func (x *SpatialSet) SRID() (int32, error) { + _r0, _err := functions.SpatialsetSRID(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Transform is MEOS spatialset_transform. +func (x *SpatialSet) Transform(srid int32) (*Set, error) { + _r0, _err := functions.SpatialsetTransform(functions.SetFromPointer(x.Pointer()), srid) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// TransformPipeline is MEOS spatialset_transform_pipeline. +func (x *SpatialSet) TransformPipeline(pipelinestr string, srid int32, is_forward bool) (*Set, error) { + _r0, _err := functions.SpatialsetTransformPipeline(functions.SetFromPointer(x.Pointer()), pipelinestr, srid, is_forward) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ToStbox is MEOS spatialset_to_stbox. +func (x *SpatialSet) ToStbox() (*STBox, error) { + _r0, _err := functions.SpatialsetToSTBOX(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} diff --git a/types/stbox.go b/types/stbox.go index 32e1a69..fbbc4d7 100644 --- a/types/stbox.go +++ b/types/stbox.go @@ -32,8 +32,8 @@ func (x *STBox) AsEWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, return _r0, nil } -// AsHEXEWKB is MEOS stbox_as_hexewkb. -func (x *STBox) AsHEXEWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexEWKB is MEOS stbox_as_hexewkb. +func (x *STBox) AsHexEWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.STBOXAsHexewkb(functions.STBoxFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -41,8 +41,8 @@ func (x *STBox) AsHEXEWKB(variant uint8, size_out unsafe.Pointer) (string, error return _r0, nil } -// AsHEXWKB is MEOS stbox_as_hexwkb. -func (x *STBox) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexWKB is MEOS stbox_as_hexwkb. +func (x *STBox) AsHexWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.STBOXAsHexwkb(functions.STBoxFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -59,8 +59,8 @@ func (x *STBox) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, e return _r0, nil } -// STBoxFromHEXWKB is MEOS stbox_from_hexwkb. -func STBoxFromHEXWKB(hexwkb string) (*STBox, error) { +// STBoxFromHexWKB is MEOS stbox_from_hexwkb. +func STBoxFromHexWKB(hexwkb string) (*STBox, error) { _r0, _err := functions.STBOXFromHexwkb(hexwkb) if _err != nil { return nil, _err @@ -502,3 +502,32 @@ func (x *STBox) SpaceTiles(xsize float64, ysize float64, zsize float64, sorigin } return STBoxFromPointer(_r0.Pointer()), nil } + +// STBoxFromEWKB is the portable fromEWKB of MEOS stbox_from_wkb. +func STBoxFromEWKB(wkb unsafe.Pointer, size uint) (*STBox, error) { + return STBoxFromWKB(wkb, size) +} + +// STBoxFromHexEWKB is the portable fromHexEWKB of MEOS stbox_from_hexwkb. +func STBoxFromHexEWKB(hexwkb string) (*STBox, error) { + return STBoxFromHexWKB(hexwkb) +} + +// AsText is the portable asText of MEOS stbox_out. +func (x *STBox) AsText(maxdd int) (string, error) { + return x.Out(maxdd) +} + +// STBoxFromText is the portable fromText of MEOS stbox_in. +func STBoxFromText(str string) (*STBox, error) { + return STBoxIn(str) +} + +// String is the text MEOS writes this value as, MEOS stbox_out. +func (x *STBox) String() string { + s, err := x.Out(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tbigint.go b/types/tbigint.go index 43d184f..2ca1fe1 100644 --- a/types/tbigint.go +++ b/types/tbigint.go @@ -262,3 +262,44 @@ func (x *TBigint) ToTs2cell() (*Temporal, error) { } return TemporalFromPointer(_r0.Pointer()), nil } + +// TBigintFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TBigintFromHexWKB(hexwkb string) (*TBigint, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TBigintFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS tbigint_out. +func (x *TBigint) AsText() (string, error) { + return x.Out() +} + +// TBigintFromText is the portable fromText of MEOS tbigint_in. +func TBigintFromText(str string) (*TBigint, error) { + r, err := TBigintIn(str) + if err != nil || r == nil { + return nil, err + } + return TBigintFromPointer(r.Pointer()), nil +} + +// TBigintFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TBigintFromWKB(wkb unsafe.Pointer, size uint) (*TBigint, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TBigintFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tbigint_out. +func (x *TBigint) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tbool.go b/types/tbool.go index ac72ad9..ecb59fb 100644 --- a/types/tbool.go +++ b/types/tbool.go @@ -163,3 +163,44 @@ func (x *TBool) WhenTrue() (*SpanSet, error) { } return SpanSetFromPointer(_r0.Pointer()), nil } + +// TBoolFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TBoolFromHexWKB(hexwkb string) (*TBool, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TBoolFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS tbool_out. +func (x *TBool) AsText() (string, error) { + return x.Out() +} + +// TBoolFromText is the portable fromText of MEOS tbool_in. +func TBoolFromText(str string) (*TBool, error) { + r, err := TBoolIn(str) + if err != nil || r == nil { + return nil, err + } + return TBoolFromPointer(r.Pointer()), nil +} + +// TBoolFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TBoolFromWKB(wkb unsafe.Pointer, size uint) (*TBool, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TBoolFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tbool_out. +func (x *TBool) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tbox.go b/types/tbox.go index c516aa3..ae60a67 100644 --- a/types/tbox.go +++ b/types/tbox.go @@ -23,8 +23,8 @@ func TBoxFromPointer(p unsafe.Pointer) *TBox { return v } -// AsHEXWKB is MEOS tbox_as_hexwkb. -func (x *TBox) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexWKB is MEOS tbox_as_hexwkb. +func (x *TBox) AsHexWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.TBOXAsHexwkb(functions.TBoxFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -41,8 +41,8 @@ func (x *TBox) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, er return _r0, nil } -// TBoxFromHEXWKB is MEOS tbox_from_hexwkb. -func TBoxFromHEXWKB(hexwkb string) (*TBox, error) { +// TBoxFromHexWKB is MEOS tbox_from_hexwkb. +func TBoxFromHexWKB(hexwkb string) (*TBox, error) { _r0, _err := functions.TBOXFromHexwkb(hexwkb) if _err != nil { return nil, _err @@ -352,3 +352,22 @@ func TBoxGetValueTile(value float64, vsize float64, vorigin float64) (*TBox, err } return TBoxFromPointer(_r0.Pointer()), nil } + +// AsText is the portable asText of MEOS tbox_out. +func (x *TBox) AsText(maxdd int) (string, error) { + return x.Out(maxdd) +} + +// TBoxFromText is the portable fromText of MEOS tbox_in. +func TBoxFromText(str string) (*TBox, error) { + return TBoxIn(str) +} + +// String is the text MEOS writes this value as, MEOS tbox_out. +func (x *TBox) String() string { + s, err := x.Out(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tcbuffer.go b/types/tcbuffer.go index dcd0aa2..b863d37 100644 --- a/types/tcbuffer.go +++ b/types/tcbuffer.go @@ -271,3 +271,66 @@ func (x *TCbuffer) MinusStbox(box *STBox, border_inc bool) (*Temporal, error) { } return TemporalFromPointer(_r0.Pointer()), nil } + +// TCbufferFromEWKB is the portable fromEWKB of MEOS temporal_from_wkb. +func TCbufferFromEWKB(wkb unsafe.Pointer, size uint) (*TCbuffer, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TCbufferFromPointer(r.Pointer()), nil +} + +// TCbufferFromEWKT is the portable fromEWKT of MEOS tcbuffer_in. +func TCbufferFromEWKT(str string) (*TCbuffer, error) { + r, err := TCbufferIn(str) + if err != nil || r == nil { + return nil, err + } + return TCbufferFromPointer(r.Pointer()), nil +} + +// TCbufferFromHexEWKB is the portable fromHexEWKB of MEOS temporal_from_hexwkb. +func TCbufferFromHexEWKB(hexwkb string) (*TCbuffer, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TCbufferFromPointer(r.Pointer()), nil +} + +// TCbufferFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TCbufferFromHexWKB(hexwkb string) (*TCbuffer, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TCbufferFromPointer(r.Pointer()), nil +} + +// TCbufferFromText is the portable fromText of MEOS tcbuffer_in. +func TCbufferFromText(str string) (*TCbuffer, error) { + r, err := TCbufferIn(str) + if err != nil || r == nil { + return nil, err + } + return TCbufferFromPointer(r.Pointer()), nil +} + +// TCbufferFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TCbufferFromWKB(wkb unsafe.Pointer, size uint) (*TCbuffer, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TCbufferFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tspatial_as_text. +func (x *TCbuffer) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tcellindex.go b/types/tcellindex.go new file mode 100644 index 0000000..c637a58 --- /dev/null +++ b/types/tcellindex.go @@ -0,0 +1,80 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +// TCellIndex is temporal DGGS cell indexes, the types tcellindex_type of meos/src/temporal/tcellindex.c admits (T_TH3INDEX, T_TQUADBIN, T_TS2CELL): the tcellindex_* functions every cell family answers through its DggsCellOps. + +type TCellIndex struct { + TSpatial +} + +// TCellIndexFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TCellIndexFromPointer(p unsafe.Pointer) *TCellIndex { + if p == nil { + return nil + } + v := &TCellIndex{} + v.ptr = p + return v +} + +// GetResolution is MEOS tcellindex_get_resolution. +func (x *TCellIndex) GetResolution() (*Temporal, error) { + _r0, _err := functions.TcellindexGetResolution(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// IsValidCell is MEOS tcellindex_is_valid_cell. +func (x *TCellIndex) IsValidCell() (*Temporal, error) { + _r0, _err := functions.TcellindexIsValidCell(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// CellToParent is MEOS tcellindex_cell_to_parent. +func (x *TCellIndex) CellToParent(resolution int32) (*Temporal, error) { + _r0, _err := functions.TcellindexCellToParent(functions.TemporalFromPointer(x.Pointer()), resolution) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// CellToPoint is MEOS tcellindex_cell_to_point. +func (x *TCellIndex) CellToPoint() (*Temporal, error) { + _r0, _err := functions.TcellindexCellToPoint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// CellToBoundary is MEOS tcellindex_cell_to_boundary. +func (x *TCellIndex) CellToBoundary() (*Temporal, error) { + _r0, _err := functions.TcellindexCellToBoundary(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// CellArea is MEOS tcellindex_cell_area. +func (x *TCellIndex) CellArea() (*Temporal, error) { + _r0, _err := functions.TcellindexCellArea(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/temporal.go b/types/temporal.go index aa17ff8..ee6edd4 100644 --- a/types/temporal.go +++ b/types/temporal.go @@ -25,8 +25,8 @@ func TemporalFromPointer(p unsafe.Pointer) *Temporal { return v } -// AsHEXWKB is MEOS temporal_as_hexwkb. -func (x *Temporal) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexWKB is MEOS temporal_as_hexwkb. +func (x *Temporal) AsHexWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.TemporalAsHexwkb(functions.TemporalFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -52,8 +52,8 @@ func (x *Temporal) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer return _r0, nil } -// TemporalFromHEXWKB is MEOS temporal_from_hexwkb. -func TemporalFromHEXWKB(hexwkb string) (*Temporal, error) { +// TemporalFromHexWKB is MEOS temporal_from_hexwkb. +func TemporalFromHexWKB(hexwkb string) (*Temporal, error) { _r0, _err := functions.TemporalFromHexwkb(hexwkb) if _err != nil { return nil, _err diff --git a/types/textset.go b/types/textset.go index 4418608..042e837 100644 --- a/types/textset.go +++ b/types/textset.go @@ -124,3 +124,44 @@ func (x *TextSet) ToJsonbset() (*Set, error) { } return SetFromPointer(_r0.Pointer()), nil } + +// TextSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func TextSetFromHexWKB(hexwkb string) (*TextSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TextSetFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS textset_out. +func (x *TextSet) AsText() (string, error) { + return x.Out() +} + +// TextSetFromText is the portable fromText of MEOS textset_in. +func TextSetFromText(str string) (*TextSet, error) { + r, err := TextSetIn(str) + if err != nil || r == nil { + return nil, err + } + return TextSetFromPointer(r.Pointer()), nil +} + +// TextSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func TextSetFromWKB(wkb unsafe.Pointer, size uint) (*TextSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TextSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS textset_out. +func (x *TextSet) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tfloat.go b/types/tfloat.go index f05fda1..1e84faf 100644 --- a/types/tfloat.go +++ b/types/tfloat.go @@ -325,3 +325,44 @@ func (x *TFloat) ValueSplit(vsize float64, vorigin float64, border_inc bool, bin } return _r0, nil } + +// TFloatFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TFloatFromHexWKB(hexwkb string) (*TFloat, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TFloatFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS tfloat_out. +func (x *TFloat) AsText(maxdd int) (string, error) { + return x.Out(maxdd) +} + +// TFloatFromText is the portable fromText of MEOS tfloat_in. +func TFloatFromText(str string) (*TFloat, error) { + r, err := TFloatIn(str) + if err != nil || r == nil { + return nil, err + } + return TFloatFromPointer(r.Pointer()), nil +} + +// TFloatFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TFloatFromWKB(wkb unsafe.Pointer, size uint) (*TFloat, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TFloatFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tfloat_out. +func (x *TFloat) String() string { + s, err := x.Out(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tgeo.go b/types/tgeo.go index 6d55732..e63e970 100644 --- a/types/tgeo.go +++ b/types/tgeo.go @@ -194,8 +194,17 @@ func (x *TGeo) Scale(xfactor float64, yfactor float64, zfactor float64) (*Tempor } // ScaleGeo is MEOS tgeo_scale_geo. -func (x *TGeo) ScaleGeo(scale *TRGeometrySeqSet, sorigin *TRGeometrySeqSet) (*Temporal, error) { - _r0, _err := functions.TgeoScaleGeo(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(scale.Pointer()), functions.GeomFromPointer(sorigin.Pointer())) +func (x *TGeo) ScaleGeo(scale *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TgeoScaleGeo(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(scale.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ScaleGeoOrigin is MEOS tgeo_scale_geo_origin. +func (x *TGeo) ScaleGeoOrigin(scale *TRGeometrySeqSet, sorigin *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TgeoScaleGeoOrigin(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(scale.Pointer()), functions.GeomFromPointer(sorigin.Pointer())) if _err != nil { return nil, _err } diff --git a/types/tgeogpoint.go b/types/tgeogpoint.go index 1c74a2d..c298824 100644 --- a/types/tgeogpoint.go +++ b/types/tgeogpoint.go @@ -121,3 +121,66 @@ func (x *TGeogPoint) S2cellSplit(level int32, border_inc bool, cells unsafe.Poin } return _r0, nil } + +// TGeogPointFromEWKB is the portable fromEWKB of MEOS temporal_from_wkb. +func TGeogPointFromEWKB(wkb unsafe.Pointer, size uint) (*TGeogPoint, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TGeogPointFromPointer(r.Pointer()), nil +} + +// TGeogPointFromEWKT is the portable fromEWKT of MEOS tgeogpoint_in. +func TGeogPointFromEWKT(str string) (*TGeogPoint, error) { + r, err := TGeogPointIn(str) + if err != nil || r == nil { + return nil, err + } + return TGeogPointFromPointer(r.Pointer()), nil +} + +// TGeogPointFromHexEWKB is the portable fromHexEWKB of MEOS temporal_from_hexwkb. +func TGeogPointFromHexEWKB(hexwkb string) (*TGeogPoint, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TGeogPointFromPointer(r.Pointer()), nil +} + +// TGeogPointFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TGeogPointFromHexWKB(hexwkb string) (*TGeogPoint, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TGeogPointFromPointer(r.Pointer()), nil +} + +// TGeogPointFromText is the portable fromText of MEOS tgeogpoint_in. +func TGeogPointFromText(str string) (*TGeogPoint, error) { + r, err := TGeogPointIn(str) + if err != nil || r == nil { + return nil, err + } + return TGeogPointFromPointer(r.Pointer()), nil +} + +// TGeogPointFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TGeogPointFromWKB(wkb unsafe.Pointer, size uint) (*TGeogPoint, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TGeogPointFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tspatial_as_text. +func (x *TGeogPoint) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tgeography.go b/types/tgeography.go index 95b2b5a..7ad9ae1 100644 --- a/types/tgeography.go +++ b/types/tgeography.go @@ -58,3 +58,66 @@ func (x *TGeography) ToTgeometry() (*Temporal, error) { } return TemporalFromPointer(_r0.Pointer()), nil } + +// TGeographyFromEWKB is the portable fromEWKB of MEOS temporal_from_wkb. +func TGeographyFromEWKB(wkb unsafe.Pointer, size uint) (*TGeography, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TGeographyFromPointer(r.Pointer()), nil +} + +// TGeographyFromEWKT is the portable fromEWKT of MEOS tgeography_in. +func TGeographyFromEWKT(str string) (*TGeography, error) { + r, err := TGeographyIn(str) + if err != nil || r == nil { + return nil, err + } + return TGeographyFromPointer(r.Pointer()), nil +} + +// TGeographyFromHexEWKB is the portable fromHexEWKB of MEOS temporal_from_hexwkb. +func TGeographyFromHexEWKB(hexwkb string) (*TGeography, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TGeographyFromPointer(r.Pointer()), nil +} + +// TGeographyFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TGeographyFromHexWKB(hexwkb string) (*TGeography, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TGeographyFromPointer(r.Pointer()), nil +} + +// TGeographyFromText is the portable fromText of MEOS tgeography_in. +func TGeographyFromText(str string) (*TGeography, error) { + r, err := TGeographyIn(str) + if err != nil || r == nil { + return nil, err + } + return TGeographyFromPointer(r.Pointer()), nil +} + +// TGeographyFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TGeographyFromWKB(wkb unsafe.Pointer, size uint) (*TGeography, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TGeographyFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tspatial_as_text. +func (x *TGeography) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tgeometry.go b/types/tgeometry.go index f155a72..2f73cd2 100644 --- a/types/tgeometry.go +++ b/types/tgeometry.go @@ -67,3 +67,66 @@ func (x *TGeometry) ToTcbuffer() (*Temporal, error) { } return TemporalFromPointer(_r0.Pointer()), nil } + +// TGeometryFromEWKB is the portable fromEWKB of MEOS temporal_from_wkb. +func TGeometryFromEWKB(wkb unsafe.Pointer, size uint) (*TGeometry, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TGeometryFromPointer(r.Pointer()), nil +} + +// TGeometryFromEWKT is the portable fromEWKT of MEOS tgeometry_in. +func TGeometryFromEWKT(str string) (*TGeometry, error) { + r, err := TGeometryIn(str) + if err != nil || r == nil { + return nil, err + } + return TGeometryFromPointer(r.Pointer()), nil +} + +// TGeometryFromHexEWKB is the portable fromHexEWKB of MEOS temporal_from_hexwkb. +func TGeometryFromHexEWKB(hexwkb string) (*TGeometry, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TGeometryFromPointer(r.Pointer()), nil +} + +// TGeometryFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TGeometryFromHexWKB(hexwkb string) (*TGeometry, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TGeometryFromPointer(r.Pointer()), nil +} + +// TGeometryFromText is the portable fromText of MEOS tgeometry_in. +func TGeometryFromText(str string) (*TGeometry, error) { + r, err := TGeometryIn(str) + if err != nil || r == nil { + return nil, err + } + return TGeometryFromPointer(r.Pointer()), nil +} + +// TGeometryFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TGeometryFromWKB(wkb unsafe.Pointer, size uint) (*TGeometry, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TGeometryFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tspatial_as_text. +func (x *TGeometry) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tgeompoint.go b/types/tgeompoint.go index 0b13b08..85dee70 100644 --- a/types/tgeompoint.go +++ b/types/tgeompoint.go @@ -121,3 +121,66 @@ func (x *TGeomPoint) S2cellSplit(level int32, border_inc bool, cells unsafe.Poin } return _r0, nil } + +// TGeomPointFromEWKB is the portable fromEWKB of MEOS temporal_from_wkb. +func TGeomPointFromEWKB(wkb unsafe.Pointer, size uint) (*TGeomPoint, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TGeomPointFromPointer(r.Pointer()), nil +} + +// TGeomPointFromEWKT is the portable fromEWKT of MEOS tgeompoint_in. +func TGeomPointFromEWKT(str string) (*TGeomPoint, error) { + r, err := TGeomPointIn(str) + if err != nil || r == nil { + return nil, err + } + return TGeomPointFromPointer(r.Pointer()), nil +} + +// TGeomPointFromHexEWKB is the portable fromHexEWKB of MEOS temporal_from_hexwkb. +func TGeomPointFromHexEWKB(hexwkb string) (*TGeomPoint, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TGeomPointFromPointer(r.Pointer()), nil +} + +// TGeomPointFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TGeomPointFromHexWKB(hexwkb string) (*TGeomPoint, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TGeomPointFromPointer(r.Pointer()), nil +} + +// TGeomPointFromText is the portable fromText of MEOS tgeompoint_in. +func TGeomPointFromText(str string) (*TGeomPoint, error) { + r, err := TGeomPointIn(str) + if err != nil || r == nil { + return nil, err + } + return TGeomPointFromPointer(r.Pointer()), nil +} + +// TGeomPointFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TGeomPointFromWKB(wkb unsafe.Pointer, size uint) (*TGeomPoint, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TGeomPointFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tspatial_as_text. +func (x *TGeomPoint) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/th3index.go b/types/th3index.go new file mode 100644 index 0000000..39a07e5 --- /dev/null +++ b/types/th3index.go @@ -0,0 +1,435 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TH3Index struct { + TCellIndex +} + +// TH3IndexFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TH3IndexFromPointer(p unsafe.Pointer) *TH3Index { + if p == nil { + return nil + } + v := &TH3Index{} + v.ptr = p + return v +} + +// TH3IndexIn is MEOS th3index_in. +func TH3IndexIn(str string) (*Temporal, error) { + _r0, _err := functions.Th3indexIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS th3index_out. +func (x *TH3Index) Out() (string, error) { + _r0, _err := functions.Th3indexOut(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TH3IndexFromMFJSON is MEOS th3index_from_mfjson. +func TH3IndexFromMFJSON(mfjson string) (*Temporal, error) { + _r0, _err := functions.Th3indexFromMFJSON(mfjson) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TH3IndexMake is MEOS th3index_make. +func TH3IndexMake(value uint64, t int64) (*Temporal, error) { + _r0, _err := functions.Th3indexMake(value, t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TH3IndexFromBaseTemp is MEOS th3index_from_base_temp. +func TH3IndexFromBaseTemp(value uint64, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.Th3indexFromBaseTemp(value, functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS th3index_start_value. +func (x *TH3Index) StartValue() (uint64, error) { + _r0, _err := functions.Th3indexStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// EndValue is MEOS th3index_end_value. +func (x *TH3Index) EndValue() (uint64, error) { + _r0, _err := functions.Th3indexEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Value is MEOS th3index_value. +func (x *TH3Index) Value() (uint64, error) { + _r0, _err := functions.Th3indexValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ValueN is MEOS th3index_value_n. +func (x *TH3Index) ValueN(n int) (uint64, bool, error) { + _found, _value, _err := functions.Th3indexValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Values is MEOS th3index_values. +func (x *TH3Index) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.Th3indexValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Unnest is MEOS th3index_unnest. +func (x *TH3Index) Unnest(values unsafe.Pointer, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.Th3indexUnnest(functions.TemporalFromPointer(x.Pointer()), values, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ValueAtTimestamptz is MEOS th3index_value_at_timestamptz. +func (x *TH3Index) ValueAtTimestamptz(t int64, strict bool) (uint64, bool, error) { + _found, _value, _err := functions.Th3indexValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// ToTbigint is MEOS th3index_to_tbigint. +func (x *TH3Index) ToTbigint() (*Temporal, error) { + _r0, _err := functions.Th3indexToTbigint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtValue is MEOS th3index_at_value. +func (x *TH3Index) AtValue(cell uint64) (*Temporal, error) { + _r0, _err := functions.Th3indexAtValue(functions.TemporalFromPointer(x.Pointer()), cell) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValue is MEOS th3index_minus_value. +func (x *TH3Index) MinusValue(cell uint64) (*Temporal, error) { + _r0, _err := functions.Th3indexMinusValue(functions.TemporalFromPointer(x.Pointer()), cell) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// GetBaseCellNumber is MEOS th3index_get_base_cell_number. +func (x *TH3Index) GetBaseCellNumber() (*Temporal, error) { + _r0, _err := functions.Th3indexGetBaseCellNumber(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// IsResClassIii is MEOS th3index_is_res_class_iii. +func (x *TH3Index) IsResClassIii() (*Temporal, error) { + _r0, _err := functions.Th3indexIsResClassIii(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// IsPentagon is MEOS th3index_is_pentagon. +func (x *TH3Index) IsPentagon() (*Temporal, error) { + _r0, _err := functions.Th3indexIsPentagon(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// CellToParentNext is MEOS th3index_cell_to_parent_next. +func (x *TH3Index) CellToParentNext() (*Temporal, error) { + _r0, _err := functions.Th3indexCellToParentNext(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// CellToCenterChild is MEOS th3index_cell_to_center_child. +func (x *TH3Index) CellToCenterChild(resolution int32) (*Temporal, error) { + _r0, _err := functions.Th3indexCellToCenterChild(functions.TemporalFromPointer(x.Pointer()), resolution) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// CellToCenterChildNext is MEOS th3index_cell_to_center_child_next. +func (x *TH3Index) CellToCenterChildNext() (*Temporal, error) { + _r0, _err := functions.Th3indexCellToCenterChildNext(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// CellToChildPos is MEOS th3index_cell_to_child_pos. +func (x *TH3Index) CellToChildPos(parent_res int32) (*Temporal, error) { + _r0, _err := functions.Th3indexCellToChildPos(functions.TemporalFromPointer(x.Pointer()), parent_res) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ChildPosToCell is MEOS th3index_child_pos_to_cell. +func (x *TH3Index) ChildPosToCell(parent *Temporal, child_res int32) (*Temporal, error) { + _r0, _err := functions.Th3indexChildPosToCell(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(parent.Pointer()), child_res) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTgeogpoint is MEOS th3index_to_tgeogpoint. +func (x *TH3Index) ToTgeogpoint() (*Temporal, error) { + _r0, _err := functions.Th3indexToTgeogpoint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTgeompoint is MEOS th3index_to_tgeompoint. +func (x *TH3Index) ToTgeompoint() (*Temporal, error) { + _r0, _err := functions.Th3indexToTgeompoint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AreNeighborCells is MEOS th3index_are_neighbor_cells. +func (x *TH3Index) AreNeighborCells(dest *Temporal) (*Temporal, error) { + _r0, _err := functions.Th3indexAreNeighborCells(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(dest.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// CellsToDirectedEdge is MEOS th3index_cells_to_directed_edge. +func (x *TH3Index) CellsToDirectedEdge(dest *Temporal) (*Temporal, error) { + _r0, _err := functions.Th3indexCellsToDirectedEdge(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(dest.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// IsValidDirectedEdge is MEOS th3index_is_valid_directed_edge. +func (x *TH3Index) IsValidDirectedEdge() (*Temporal, error) { + _r0, _err := functions.Th3indexIsValidDirectedEdge(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// GetDirectedEdgeOrigin is MEOS th3index_get_directed_edge_origin. +func (x *TH3Index) GetDirectedEdgeOrigin() (*Temporal, error) { + _r0, _err := functions.Th3indexGetDirectedEdgeOrigin(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// GetDirectedEdgeDestination is MEOS th3index_get_directed_edge_destination. +func (x *TH3Index) GetDirectedEdgeDestination() (*Temporal, error) { + _r0, _err := functions.Th3indexGetDirectedEdgeDestination(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// DirectedEdgeToBoundary is MEOS th3index_directed_edge_to_boundary. +func (x *TH3Index) DirectedEdgeToBoundary() (*Temporal, error) { + _r0, _err := functions.Th3indexDirectedEdgeToBoundary(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// CellToVertex is MEOS th3index_cell_to_vertex. +func (x *TH3Index) CellToVertex(vertex_num int32) (*Temporal, error) { + _r0, _err := functions.Th3indexCellToVertex(functions.TemporalFromPointer(x.Pointer()), vertex_num) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// VertexToLatlng is MEOS th3index_vertex_to_latlng. +func (x *TH3Index) VertexToLatlng() (*Temporal, error) { + _r0, _err := functions.Th3indexVertexToLatlng(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// IsValidVertex is MEOS th3index_is_valid_vertex. +func (x *TH3Index) IsValidVertex() (*Temporal, error) { + _r0, _err := functions.Th3indexIsValidVertex(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// GridDistance is MEOS th3index_grid_distance. +func (x *TH3Index) GridDistance(dest *Temporal) (*Temporal, error) { + _r0, _err := functions.Th3indexGridDistance(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(dest.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// CellToLocalIj is MEOS th3index_cell_to_local_ij. +func (x *TH3Index) CellToLocalIj(cell *Temporal) (*Temporal, error) { + _r0, _err := functions.Th3indexCellToLocalIj(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(cell.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// LocalIjToCell is MEOS th3index_local_ij_to_cell. +func (x *TH3Index) LocalIjToCell(coord *Temporal) (*Temporal, error) { + _r0, _err := functions.Th3indexLocalIjToCell(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(coord.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EdgeLength is MEOS th3index_edge_length. +func (x *TH3Index) EdgeLength() (*Temporal, error) { + _r0, _err := functions.Th3indexEdgeLength(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TH3IndexFromEWKB is the portable fromEWKB of MEOS temporal_from_wkb. +func TH3IndexFromEWKB(wkb unsafe.Pointer, size uint) (*TH3Index, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TH3IndexFromPointer(r.Pointer()), nil +} + +// TH3IndexFromEWKT is the portable fromEWKT of MEOS th3index_in. +func TH3IndexFromEWKT(str string) (*TH3Index, error) { + r, err := TH3IndexIn(str) + if err != nil || r == nil { + return nil, err + } + return TH3IndexFromPointer(r.Pointer()), nil +} + +// TH3IndexFromHexEWKB is the portable fromHexEWKB of MEOS temporal_from_hexwkb. +func TH3IndexFromHexEWKB(hexwkb string) (*TH3Index, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TH3IndexFromPointer(r.Pointer()), nil +} + +// TH3IndexFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TH3IndexFromHexWKB(hexwkb string) (*TH3Index, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TH3IndexFromPointer(r.Pointer()), nil +} + +// TH3IndexFromText is the portable fromText of MEOS th3index_in. +func TH3IndexFromText(str string) (*TH3Index, error) { + r, err := TH3IndexIn(str) + if err != nil || r == nil { + return nil, err + } + return TH3IndexFromPointer(r.Pointer()), nil +} + +// TH3IndexFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TH3IndexFromWKB(wkb unsafe.Pointer, size uint) (*TH3Index, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TH3IndexFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS th3index_out. +func (x *TH3Index) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/th3indexinst.go b/types/th3indexinst.go new file mode 100644 index 0000000..5abaf92 --- /dev/null +++ b/types/th3indexinst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TH3IndexInst struct { + handle +} + +// TH3IndexInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TH3IndexInstFromPointer(p unsafe.Pointer) *TH3IndexInst { + if p == nil { + return nil + } + v := &TH3IndexInst{} + v.ptr = p + return v +} + +// TH3IndexInstMake is MEOS th3indexinst_make. +func TH3IndexInstMake(value uint64, t int64) (*Temporal, error) { + _r0, _err := functions.Th3indexinstMake(value, t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/th3indexseq.go b/types/th3indexseq.go new file mode 100644 index 0000000..42e28ca --- /dev/null +++ b/types/th3indexseq.go @@ -0,0 +1,51 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TH3IndexSeq struct { + handle +} + +// TH3IndexSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TH3IndexSeqFromPointer(p unsafe.Pointer) *TH3IndexSeq { + if p == nil { + return nil + } + v := &TH3IndexSeq{} + v.ptr = p + return v +} + +// TH3IndexSeqFromBaseTstzset is MEOS th3indexseq_from_base_tstzset. +func TH3IndexSeqFromBaseTstzset(value uint64, s *Set) (*Temporal, error) { + _r0, _err := functions.Th3indexseqFromBaseTstzset(value, functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TH3IndexSeqFromBaseTstzspan is MEOS th3indexseq_from_base_tstzspan. +func TH3IndexSeqFromBaseTstzspan(value uint64, s *Span) (*Temporal, error) { + _r0, _err := functions.Th3indexseqFromBaseTstzspan(value, functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TH3IndexSeqMake is MEOS th3indexseq_make. +func TH3IndexSeqMake(values unsafe.Pointer, times unsafe.Pointer, count int, lower_inc bool, upper_inc bool) (*Temporal, error) { + _r0, _err := functions.Th3indexseqMake(values, times, count, lower_inc, upper_inc) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/th3indexseqset.go b/types/th3indexseqset.go new file mode 100644 index 0000000..2a3e66e --- /dev/null +++ b/types/th3indexseqset.go @@ -0,0 +1,42 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TH3IndexSeqSet struct { + handle +} + +// TH3IndexSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TH3IndexSeqSetFromPointer(p unsafe.Pointer) *TH3IndexSeqSet { + if p == nil { + return nil + } + v := &TH3IndexSeqSet{} + v.ptr = p + return v +} + +// TH3IndexSeqSetFromBaseTstzspanset is MEOS th3indexseqset_from_base_tstzspanset. +func TH3IndexSeqSetFromBaseTstzspanset(value uint64, ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.Th3indexseqsetFromBaseTstzspanset(value, functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TH3IndexSeqSetMake is MEOS th3indexseqset_make. +func TH3IndexSeqSetMake(sequences unsafe.Pointer, count int) (*Temporal, error) { + _r0, _err := functions.Th3indexseqsetMake(sequences, count) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tint.go b/types/tint.go index a8146a3..d6a4f33 100644 --- a/types/tint.go +++ b/types/tint.go @@ -235,3 +235,44 @@ func (x *TInt) ValueSplit(vsize int, vorigin int, border_inc bool, bins unsafe.P } return _r0, nil } + +// TIntFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TIntFromHexWKB(hexwkb string) (*TInt, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TIntFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS tint_out. +func (x *TInt) AsText() (string, error) { + return x.Out() +} + +// TIntFromText is the portable fromText of MEOS tint_in. +func TIntFromText(str string) (*TInt, error) { + r, err := TIntIn(str) + if err != nil || r == nil { + return nil, err + } + return TIntFromPointer(r.Pointer()), nil +} + +// TIntFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TIntFromWKB(wkb unsafe.Pointer, size uint) (*TInt, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TIntFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tint_out. +func (x *TInt) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tjsonb.go b/types/tjsonb.go index 229f167..8e7e64b 100644 --- a/types/tjsonb.go +++ b/types/tjsonb.go @@ -442,3 +442,44 @@ func (x *TJsonb) MinusValue(jsb *Jsonb) (*Temporal, error) { } return TemporalFromPointer(_r0.Pointer()), nil } + +// TJsonbFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TJsonbFromHexWKB(hexwkb string) (*TJsonb, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TJsonbFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS tjsonb_out. +func (x *TJsonb) AsText() (string, error) { + return x.Out() +} + +// TJsonbFromText is the portable fromText of MEOS tjsonb_in. +func TJsonbFromText(str string) (*TJsonb, error) { + r, err := TJsonbIn(str) + if err != nil || r == nil { + return nil, err + } + return TJsonbFromPointer(r.Pointer()), nil +} + +// TJsonbFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TJsonbFromWKB(wkb unsafe.Pointer, size uint) (*TJsonb, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TJsonbFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tjsonb_out. +func (x *TJsonb) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tnpoint.go b/types/tnpoint.go index 6bab957..ea46fb3 100644 --- a/types/tnpoint.go +++ b/types/tnpoint.go @@ -280,3 +280,66 @@ func (x *TNpoint) MinusStbox(box *STBox, border_inc bool) (*Temporal, error) { } return TemporalFromPointer(_r0.Pointer()), nil } + +// TNpointFromEWKB is the portable fromEWKB of MEOS temporal_from_wkb. +func TNpointFromEWKB(wkb unsafe.Pointer, size uint) (*TNpoint, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TNpointFromPointer(r.Pointer()), nil +} + +// TNpointFromEWKT is the portable fromEWKT of MEOS tnpoint_in. +func TNpointFromEWKT(str string) (*TNpoint, error) { + r, err := TNpointIn(str) + if err != nil || r == nil { + return nil, err + } + return TNpointFromPointer(r.Pointer()), nil +} + +// TNpointFromHexEWKB is the portable fromHexEWKB of MEOS temporal_from_hexwkb. +func TNpointFromHexEWKB(hexwkb string) (*TNpoint, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TNpointFromPointer(r.Pointer()), nil +} + +// TNpointFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TNpointFromHexWKB(hexwkb string) (*TNpoint, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TNpointFromPointer(r.Pointer()), nil +} + +// TNpointFromText is the portable fromText of MEOS tnpoint_in. +func TNpointFromText(str string) (*TNpoint, error) { + r, err := TNpointIn(str) + if err != nil || r == nil { + return nil, err + } + return TNpointFromPointer(r.Pointer()), nil +} + +// TNpointFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TNpointFromWKB(wkb unsafe.Pointer, size uint) (*TNpoint, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TNpointFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tspatial_as_text. +func (x *TNpoint) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tpcbox.go b/types/tpcbox.go index b9fd910..d394a26 100644 --- a/types/tpcbox.go +++ b/types/tpcbox.go @@ -32,8 +32,8 @@ func (x *TPCBox) AsEWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, return _r0, nil } -// AsHEXEWKB is MEOS tpcbox_as_hexewkb. -func (x *TPCBox) AsHEXEWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexEWKB is MEOS tpcbox_as_hexewkb. +func (x *TPCBox) AsHexEWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.TpcboxAsHexewkb(functions.TPCBoxFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -41,8 +41,8 @@ func (x *TPCBox) AsHEXEWKB(variant uint8, size_out unsafe.Pointer) (string, erro return _r0, nil } -// AsHEXWKB is MEOS tpcbox_as_hexwkb. -func (x *TPCBox) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexWKB is MEOS tpcbox_as_hexwkb. +func (x *TPCBox) AsHexWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.TpcboxAsHexwkb(functions.TPCBoxFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err @@ -59,8 +59,8 @@ func (x *TPCBox) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, return _r0, nil } -// TPCBoxFromHEXWKB is MEOS tpcbox_from_hexwkb. -func TPCBoxFromHEXWKB(hexwkb string) (*TPCBox, error) { +// TPCBoxFromHexWKB is MEOS tpcbox_from_hexwkb. +func TPCBoxFromHexWKB(hexwkb string) (*TPCBox, error) { _r0, _err := functions.TpcboxFromHexwkb(hexwkb) if _err != nil { return nil, _err @@ -385,3 +385,32 @@ func (x *TPCBox) Ge(box2 *TPCBox) (bool, error) { } return _r0, nil } + +// TPCBoxFromEWKB is the portable fromEWKB of MEOS tpcbox_from_wkb. +func TPCBoxFromEWKB(wkb unsafe.Pointer, size uint) (*TPCBox, error) { + return TPCBoxFromWKB(wkb, size) +} + +// TPCBoxFromHexEWKB is the portable fromHexEWKB of MEOS tpcbox_from_hexwkb. +func TPCBoxFromHexEWKB(hexwkb string) (*TPCBox, error) { + return TPCBoxFromHexWKB(hexwkb) +} + +// AsText is the portable asText of MEOS tpcbox_out. +func (x *TPCBox) AsText(maxdd int) (string, error) { + return x.Out(maxdd) +} + +// TPCBoxFromText is the portable fromText of MEOS tpcbox_in. +func TPCBoxFromText(str string) (*TPCBox, error) { + return TPCBoxIn(str) +} + +// String is the text MEOS writes this value as, MEOS tpcbox_out. +func (x *TPCBox) String() string { + s, err := x.Out(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tpcpatch.go b/types/tpcpatch.go new file mode 100644 index 0000000..172d1e6 --- /dev/null +++ b/types/tpcpatch.go @@ -0,0 +1,255 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPcpatch struct { + TSpatial +} + +// TPcpatchFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPcpatchFromPointer(p unsafe.Pointer) *TPcpatch { + if p == nil { + return nil + } + v := &TPcpatch{} + v.ptr = p + return v +} + +// TPcpatchIn is MEOS tpcpatch_in. +func TPcpatchIn(str string) (*Temporal, error) { + _r0, _err := functions.TpcpatchIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS tpcpatch_out. +func (x *TPcpatch) Out() (string, error) { + _r0, _err := functions.TpcpatchOut(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TPcpatchFromMFJSON is MEOS tpcpatch_from_mfjson. +func TPcpatchFromMFJSON(mfjson string) (*Temporal, error) { + _r0, _err := functions.TpcpatchFromMFJSON(mfjson) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTgeometry is MEOS tpcpatch_to_tgeometry. +func (x *TPcpatch) ToTgeometry() (*Temporal, error) { + _r0, _err := functions.TpcpatchToTgeometry(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TPcpatchFromBaseTemp is MEOS tpcpatch_from_base_temp. +func TPcpatchFromBaseTemp(pa *Pcpatch, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.TpcpatchFromBaseTemp(functions.PcpatchFromPointer(pa.Pointer()), functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS tpcpatch_start_value. +func (x *TPcpatch) StartValue() (*Pcpatch, error) { + _r0, _err := functions.TpcpatchStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PcpatchFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS tpcpatch_end_value. +func (x *TPcpatch) EndValue() (*Pcpatch, error) { + _r0, _err := functions.TpcpatchEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PcpatchFromPointer(_r0.Pointer()), nil +} + +// Value is MEOS tpcpatch_value. +func (x *TPcpatch) Value() (*Pcpatch, error) { + _r0, _err := functions.TpcpatchValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PcpatchFromPointer(_r0.Pointer()), nil +} + +// ValueN is MEOS tpcpatch_value_n. +func (x *TPcpatch) ValueN(n int) (*Pcpatch, bool, error) { + _found, _value, _err := functions.TpcpatchValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return PcpatchFromPointer(_value.Pointer()), true, nil +} + +// Values is MEOS tpcpatch_values. +func (x *TPcpatch) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TpcpatchValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Unnest is MEOS tpcpatch_unnest. +func (x *TPcpatch) Unnest(values unsafe.Pointer, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TpcpatchUnnest(functions.TemporalFromPointer(x.Pointer()), values, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ValueAtTimestamptz is MEOS tpcpatch_value_at_timestamptz. +func (x *TPcpatch) ValueAtTimestamptz(t int64, strict bool) (*Pcpatch, bool, error) { + _found, _value, _err := functions.TpcpatchValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return PcpatchFromPointer(_value.Pointer()), true, nil +} + +// AtValue is MEOS tpcpatch_at_value. +func (x *TPcpatch) AtValue(pa *Pcpatch) (*Temporal, error) { + _r0, _err := functions.TpcpatchAtValue(functions.TemporalFromPointer(x.Pointer()), functions.PcpatchFromPointer(pa.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValue is MEOS tpcpatch_minus_value. +func (x *TPcpatch) MinusValue(pa *Pcpatch) (*Temporal, error) { + _r0, _err := functions.TpcpatchMinusValue(functions.TemporalFromPointer(x.Pointer()), functions.PcpatchFromPointer(pa.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Pcid is MEOS tpcpatch_pcid. +func (x *TPcpatch) Pcid() (uint32, error) { + _r0, _err := functions.TpcpatchPcid(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartNpoints is MEOS tpcpatch_start_npoints. +func (x *TPcpatch) StartNpoints() (uint32, error) { + _r0, _err := functions.TpcpatchStartNpoints(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// EndNpoints is MEOS tpcpatch_end_npoints. +func (x *TPcpatch) EndNpoints() (uint32, error) { + _r0, _err := functions.TpcpatchEndNpoints(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Npoints is MEOS tpcpatch_npoints. +func (x *TPcpatch) Npoints() (int64, error) { + _r0, _err := functions.TpcpatchNpoints(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// TPcpatchFromEWKB is the portable fromEWKB of MEOS temporal_from_wkb. +func TPcpatchFromEWKB(wkb unsafe.Pointer, size uint) (*TPcpatch, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TPcpatchFromPointer(r.Pointer()), nil +} + +// TPcpatchFromEWKT is the portable fromEWKT of MEOS tpcpatch_in. +func TPcpatchFromEWKT(str string) (*TPcpatch, error) { + r, err := TPcpatchIn(str) + if err != nil || r == nil { + return nil, err + } + return TPcpatchFromPointer(r.Pointer()), nil +} + +// TPcpatchFromHexEWKB is the portable fromHexEWKB of MEOS temporal_from_hexwkb. +func TPcpatchFromHexEWKB(hexwkb string) (*TPcpatch, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TPcpatchFromPointer(r.Pointer()), nil +} + +// TPcpatchFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TPcpatchFromHexWKB(hexwkb string) (*TPcpatch, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TPcpatchFromPointer(r.Pointer()), nil +} + +// TPcpatchFromText is the portable fromText of MEOS tpcpatch_in. +func TPcpatchFromText(str string) (*TPcpatch, error) { + r, err := TPcpatchIn(str) + if err != nil || r == nil { + return nil, err + } + return TPcpatchFromPointer(r.Pointer()), nil +} + +// TPcpatchFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TPcpatchFromWKB(wkb unsafe.Pointer, size uint) (*TPcpatch, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TPcpatchFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tpcpatch_out. +func (x *TPcpatch) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tpcpatchinst.go b/types/tpcpatchinst.go new file mode 100644 index 0000000..4377945 --- /dev/null +++ b/types/tpcpatchinst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPcpatchInst struct { + handle +} + +// TPcpatchInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPcpatchInstFromPointer(p unsafe.Pointer) *TPcpatchInst { + if p == nil { + return nil + } + v := &TPcpatchInst{} + v.ptr = p + return v +} + +// TPcpatchInstMake is MEOS tpcpatchinst_make. +func TPcpatchInstMake(pa *Pcpatch, t int64) (*Temporal, error) { + _r0, _err := functions.TpcpatchinstMake(functions.PcpatchFromPointer(pa.Pointer()), t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tpcpatchseq.go b/types/tpcpatchseq.go new file mode 100644 index 0000000..8ca1362 --- /dev/null +++ b/types/tpcpatchseq.go @@ -0,0 +1,42 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPcpatchSeq struct { + handle +} + +// TPcpatchSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPcpatchSeqFromPointer(p unsafe.Pointer) *TPcpatchSeq { + if p == nil { + return nil + } + v := &TPcpatchSeq{} + v.ptr = p + return v +} + +// TPcpatchSeqFromBaseTstzset is MEOS tpcpatchseq_from_base_tstzset. +func TPcpatchSeqFromBaseTstzset(pa *Pcpatch, s *Set) (*Temporal, error) { + _r0, _err := functions.TpcpatchseqFromBaseTstzset(functions.PcpatchFromPointer(pa.Pointer()), functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TPcpatchSeqFromBaseTstzspan is MEOS tpcpatchseq_from_base_tstzspan. +func TPcpatchSeqFromBaseTstzspan(pa *Pcpatch, sp *Span) (*Temporal, error) { + _r0, _err := functions.TpcpatchseqFromBaseTstzspan(functions.PcpatchFromPointer(pa.Pointer()), functions.SpanFromPointer(sp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tpcpatchseqset.go b/types/tpcpatchseqset.go new file mode 100644 index 0000000..0d36e10 --- /dev/null +++ b/types/tpcpatchseqset.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPcpatchSeqSet struct { + handle +} + +// TPcpatchSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPcpatchSeqSetFromPointer(p unsafe.Pointer) *TPcpatchSeqSet { + if p == nil { + return nil + } + v := &TPcpatchSeqSet{} + v.ptr = p + return v +} + +// TPcpatchSeqSetFromBaseTstzspanset is MEOS tpcpatchseqset_from_base_tstzspanset. +func TPcpatchSeqSetFromBaseTstzspanset(pa *Pcpatch, ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.TpcpatchseqsetFromBaseTstzspanset(functions.PcpatchFromPointer(pa.Pointer()), functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tpcpoint.go b/types/tpcpoint.go new file mode 100644 index 0000000..0a277ad --- /dev/null +++ b/types/tpcpoint.go @@ -0,0 +1,228 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPcpoint struct { + TSpatial +} + +// TPcpointFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPcpointFromPointer(p unsafe.Pointer) *TPcpoint { + if p == nil { + return nil + } + v := &TPcpoint{} + v.ptr = p + return v +} + +// TPcpointIn is MEOS tpcpoint_in. +func TPcpointIn(str string) (*Temporal, error) { + _r0, _err := functions.TpcpointIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS tpcpoint_out. +func (x *TPcpoint) Out() (string, error) { + _r0, _err := functions.TpcpointOut(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TPcpointFromMFJSON is MEOS tpcpoint_from_mfjson. +func TPcpointFromMFJSON(mfjson string) (*Temporal, error) { + _r0, _err := functions.TpcpointFromMFJSON(mfjson) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTgeompoint is MEOS tpcpoint_to_tgeompoint. +func (x *TPcpoint) ToTgeompoint() (*Temporal, error) { + _r0, _err := functions.TpcpointToTgeompoint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TPcpointFromBaseTemp is MEOS tpcpoint_from_base_temp. +func TPcpointFromBaseTemp(pt *Pcpoint, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.TpcpointFromBaseTemp(functions.PcpointFromPointer(pt.Pointer()), functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS tpcpoint_start_value. +func (x *TPcpoint) StartValue() (*Pcpoint, error) { + _r0, _err := functions.TpcpointStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PcpointFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS tpcpoint_end_value. +func (x *TPcpoint) EndValue() (*Pcpoint, error) { + _r0, _err := functions.TpcpointEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PcpointFromPointer(_r0.Pointer()), nil +} + +// Value is MEOS tpcpoint_value. +func (x *TPcpoint) Value() (*Pcpoint, error) { + _r0, _err := functions.TpcpointValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PcpointFromPointer(_r0.Pointer()), nil +} + +// ValueN is MEOS tpcpoint_value_n. +func (x *TPcpoint) ValueN(n int) (*Pcpoint, bool, error) { + _found, _value, _err := functions.TpcpointValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return PcpointFromPointer(_value.Pointer()), true, nil +} + +// Values is MEOS tpcpoint_values. +func (x *TPcpoint) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TpcpointValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Unnest is MEOS tpcpoint_unnest. +func (x *TPcpoint) Unnest(values unsafe.Pointer, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TpcpointUnnest(functions.TemporalFromPointer(x.Pointer()), values, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ValueAtTimestamptz is MEOS tpcpoint_value_at_timestamptz. +func (x *TPcpoint) ValueAtTimestamptz(t int64, strict bool) (*Pcpoint, bool, error) { + _found, _value, _err := functions.TpcpointValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return PcpointFromPointer(_value.Pointer()), true, nil +} + +// AtValue is MEOS tpcpoint_at_value. +func (x *TPcpoint) AtValue(pt *Pcpoint) (*Temporal, error) { + _r0, _err := functions.TpcpointAtValue(functions.TemporalFromPointer(x.Pointer()), functions.PcpointFromPointer(pt.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValue is MEOS tpcpoint_minus_value. +func (x *TPcpoint) MinusValue(pt *Pcpoint) (*Temporal, error) { + _r0, _err := functions.TpcpointMinusValue(functions.TemporalFromPointer(x.Pointer()), functions.PcpointFromPointer(pt.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Pcid is MEOS tpcpoint_pcid. +func (x *TPcpoint) Pcid() (uint32, error) { + _r0, _err := functions.TpcpointPcid(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// TPcpointFromEWKB is the portable fromEWKB of MEOS temporal_from_wkb. +func TPcpointFromEWKB(wkb unsafe.Pointer, size uint) (*TPcpoint, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TPcpointFromPointer(r.Pointer()), nil +} + +// TPcpointFromEWKT is the portable fromEWKT of MEOS tpcpoint_in. +func TPcpointFromEWKT(str string) (*TPcpoint, error) { + r, err := TPcpointIn(str) + if err != nil || r == nil { + return nil, err + } + return TPcpointFromPointer(r.Pointer()), nil +} + +// TPcpointFromHexEWKB is the portable fromHexEWKB of MEOS temporal_from_hexwkb. +func TPcpointFromHexEWKB(hexwkb string) (*TPcpoint, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TPcpointFromPointer(r.Pointer()), nil +} + +// TPcpointFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TPcpointFromHexWKB(hexwkb string) (*TPcpoint, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TPcpointFromPointer(r.Pointer()), nil +} + +// TPcpointFromText is the portable fromText of MEOS tpcpoint_in. +func TPcpointFromText(str string) (*TPcpoint, error) { + r, err := TPcpointIn(str) + if err != nil || r == nil { + return nil, err + } + return TPcpointFromPointer(r.Pointer()), nil +} + +// TPcpointFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TPcpointFromWKB(wkb unsafe.Pointer, size uint) (*TPcpoint, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TPcpointFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tpcpoint_out. +func (x *TPcpoint) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tpcpointinst.go b/types/tpcpointinst.go new file mode 100644 index 0000000..3b071e2 --- /dev/null +++ b/types/tpcpointinst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPcpointInst struct { + handle +} + +// TPcpointInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPcpointInstFromPointer(p unsafe.Pointer) *TPcpointInst { + if p == nil { + return nil + } + v := &TPcpointInst{} + v.ptr = p + return v +} + +// TPcpointInstMake is MEOS tpcpointinst_make. +func TPcpointInstMake(pt *Pcpoint, t int64) (*Temporal, error) { + _r0, _err := functions.TpcpointinstMake(functions.PcpointFromPointer(pt.Pointer()), t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tpcpointseq.go b/types/tpcpointseq.go new file mode 100644 index 0000000..37899c5 --- /dev/null +++ b/types/tpcpointseq.go @@ -0,0 +1,42 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPcpointSeq struct { + handle +} + +// TPcpointSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPcpointSeqFromPointer(p unsafe.Pointer) *TPcpointSeq { + if p == nil { + return nil + } + v := &TPcpointSeq{} + v.ptr = p + return v +} + +// TPcpointSeqFromBaseTstzset is MEOS tpcpointseq_from_base_tstzset. +func TPcpointSeqFromBaseTstzset(pt *Pcpoint, s *Set) (*Temporal, error) { + _r0, _err := functions.TpcpointseqFromBaseTstzset(functions.PcpointFromPointer(pt.Pointer()), functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TPcpointSeqFromBaseTstzspan is MEOS tpcpointseq_from_base_tstzspan. +func TPcpointSeqFromBaseTstzspan(pt *Pcpoint, sp *Span) (*Temporal, error) { + _r0, _err := functions.TpcpointseqFromBaseTstzspan(functions.PcpointFromPointer(pt.Pointer()), functions.SpanFromPointer(sp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tpcpointseqset.go b/types/tpcpointseqset.go new file mode 100644 index 0000000..5b67516 --- /dev/null +++ b/types/tpcpointseqset.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPcpointSeqSet struct { + handle +} + +// TPcpointSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPcpointSeqSetFromPointer(p unsafe.Pointer) *TPcpointSeqSet { + if p == nil { + return nil + } + v := &TPcpointSeqSet{} + v.ptr = p + return v +} + +// TPcpointSeqSetFromBaseTstzspanset is MEOS tpcpointseqset_from_base_tstzspanset. +func TPcpointSeqSetFromBaseTstzspanset(pt *Pcpoint, ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.TpcpointseqsetFromBaseTstzspanset(functions.PcpointFromPointer(pt.Pointer()), functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tpose.go b/types/tpose.go index 57a9be5..dafd85e 100644 --- a/types/tpose.go +++ b/types/tpose.go @@ -397,3 +397,66 @@ func (x *TPose) MinusStbox(box *STBox, border_inc bool) (*Temporal, error) { } return TemporalFromPointer(_r0.Pointer()), nil } + +// TPoseFromEWKB is the portable fromEWKB of MEOS temporal_from_wkb. +func TPoseFromEWKB(wkb unsafe.Pointer, size uint) (*TPose, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TPoseFromPointer(r.Pointer()), nil +} + +// TPoseFromEWKT is the portable fromEWKT of MEOS tpose_in. +func TPoseFromEWKT(str string) (*TPose, error) { + r, err := TPoseIn(str) + if err != nil || r == nil { + return nil, err + } + return TPoseFromPointer(r.Pointer()), nil +} + +// TPoseFromHexEWKB is the portable fromHexEWKB of MEOS temporal_from_hexwkb. +func TPoseFromHexEWKB(hexwkb string) (*TPose, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TPoseFromPointer(r.Pointer()), nil +} + +// TPoseFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TPoseFromHexWKB(hexwkb string) (*TPose, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TPoseFromPointer(r.Pointer()), nil +} + +// TPoseFromText is the portable fromText of MEOS tpose_in. +func TPoseFromText(str string) (*TPose, error) { + r, err := TPoseIn(str) + if err != nil || r == nil { + return nil, err + } + return TPoseFromPointer(r.Pointer()), nil +} + +// TPoseFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TPoseFromWKB(wkb unsafe.Pointer, size uint) (*TPose, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TPoseFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tspatial_as_text. +func (x *TPose) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tposechain.go b/types/tposechain.go new file mode 100644 index 0000000..ac761e0 --- /dev/null +++ b/types/tposechain.go @@ -0,0 +1,258 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPoseChain struct { + TSpatial +} + +// TPoseChainFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPoseChainFromPointer(p unsafe.Pointer) *TPoseChain { + if p == nil { + return nil + } + v := &TPoseChain{} + v.ptr = p + return v +} + +// TPoseChainFromGeopose is MEOS tposechain_from_geopose. +func TPoseChainFromGeopose(json string) (*Temporal, error) { + _r0, _err := functions.TposechainFromGeopose(json) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AsGeopose is MEOS tposechain_as_geopose. +func (x *TPoseChain) AsGeopose(precision int) (string, error) { + _r0, _err := functions.TposechainAsGeopose(functions.TemporalFromPointer(x.Pointer()), precision) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TPoseChainIn is MEOS tposechain_in. +func TPoseChainIn(str string) (*Temporal, error) { + _r0, _err := functions.TposechainIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TPoseChainFromMFJSON is MEOS tposechain_from_mfjson. +func TPoseChainFromMFJSON(mfjson string) (*Temporal, error) { + _r0, _err := functions.TposechainFromMFJSON(mfjson) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TPoseChainFromBaseTemp is MEOS tposechain_from_base_temp. +func TPoseChainFromBaseTemp(pc unsafe.Pointer, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.TposechainFromBaseTemp(pc, functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTpose is MEOS tposechain_to_tpose. +func (x *TPoseChain) ToTpose() (*Temporal, error) { + _r0, _err := functions.TposechainToTpose(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS tposechain_end_value. +func (x *TPoseChain) EndValue() (unsafe.Pointer, error) { + _r0, _err := functions.TposechainEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// NumPoses is MEOS tposechain_num_poses. +func (x *TPoseChain) NumPoses() (int, error) { + _r0, _err := functions.TposechainNumPoses(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartValue is MEOS tposechain_start_value. +func (x *TPoseChain) StartValue() (unsafe.Pointer, error) { + _r0, _err := functions.TposechainStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Value is MEOS tposechain_value. +func (x *TPoseChain) Value() (unsafe.Pointer, error) { + _r0, _err := functions.TposechainValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Values is MEOS tposechain_values. +func (x *TPoseChain) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TposechainValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Unnest is MEOS tposechain_unnest. +func (x *TPoseChain) Unnest(values unsafe.Pointer, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TposechainUnnest(functions.TemporalFromPointer(x.Pointer()), values, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Rotate is MEOS tposechain_rotate. +func (x *TPoseChain) Rotate(angle float64, x0 float64, y0 float64) (*Temporal, error) { + _r0, _err := functions.TposechainRotate(functions.TemporalFromPointer(x.Pointer()), angle, x0, y0) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// RotateX is MEOS tposechain_rotate_x. +func (x *TPoseChain) RotateX(angle float64) (*Temporal, error) { + _r0, _err := functions.TposechainRotateX(functions.TemporalFromPointer(x.Pointer()), angle) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// RotateY is MEOS tposechain_rotate_y. +func (x *TPoseChain) RotateY(angle float64) (*Temporal, error) { + _r0, _err := functions.TposechainRotateY(functions.TemporalFromPointer(x.Pointer()), angle) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// RotateZ is MEOS tposechain_rotate_z. +func (x *TPoseChain) RotateZ(angle float64) (*Temporal, error) { + _r0, _err := functions.TposechainRotateZ(functions.TemporalFromPointer(x.Pointer()), angle) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Translate is MEOS tposechain_translate. +func (x *TPoseChain) Translate(deltax float64, deltay float64, deltaz float64) (*Temporal, error) { + _r0, _err := functions.TposechainTranslate(functions.TemporalFromPointer(x.Pointer()), deltax, deltay, deltaz) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtValue is MEOS tposechain_at_value. +func (x *TPoseChain) AtValue(pc unsafe.Pointer) (*Temporal, error) { + _r0, _err := functions.TposechainAtValue(functions.TemporalFromPointer(x.Pointer()), pc) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValue is MEOS tposechain_minus_value. +func (x *TPoseChain) MinusValue(pc unsafe.Pointer) (*Temporal, error) { + _r0, _err := functions.TposechainMinusValue(functions.TemporalFromPointer(x.Pointer()), pc) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TPoseChainFromEWKB is the portable fromEWKB of MEOS temporal_from_wkb. +func TPoseChainFromEWKB(wkb unsafe.Pointer, size uint) (*TPoseChain, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TPoseChainFromPointer(r.Pointer()), nil +} + +// TPoseChainFromEWKT is the portable fromEWKT of MEOS tposechain_in. +func TPoseChainFromEWKT(str string) (*TPoseChain, error) { + r, err := TPoseChainIn(str) + if err != nil || r == nil { + return nil, err + } + return TPoseChainFromPointer(r.Pointer()), nil +} + +// TPoseChainFromHexEWKB is the portable fromHexEWKB of MEOS temporal_from_hexwkb. +func TPoseChainFromHexEWKB(hexwkb string) (*TPoseChain, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TPoseChainFromPointer(r.Pointer()), nil +} + +// TPoseChainFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TPoseChainFromHexWKB(hexwkb string) (*TPoseChain, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TPoseChainFromPointer(r.Pointer()), nil +} + +// TPoseChainFromText is the portable fromText of MEOS tposechain_in. +func TPoseChainFromText(str string) (*TPoseChain, error) { + r, err := TPoseChainIn(str) + if err != nil || r == nil { + return nil, err + } + return TPoseChainFromPointer(r.Pointer()), nil +} + +// TPoseChainFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TPoseChainFromWKB(wkb unsafe.Pointer, size uint) (*TPoseChain, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TPoseChainFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tspatial_as_text. +func (x *TPoseChain) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tposechaininst.go b/types/tposechaininst.go new file mode 100644 index 0000000..d38a0b3 --- /dev/null +++ b/types/tposechaininst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPoseChainInst struct { + handle +} + +// TPoseChainInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPoseChainInstFromPointer(p unsafe.Pointer) *TPoseChainInst { + if p == nil { + return nil + } + v := &TPoseChainInst{} + v.ptr = p + return v +} + +// TPoseChainInstMake is MEOS tposechaininst_make. +func TPoseChainInstMake(pc unsafe.Pointer, t int64) (*Temporal, error) { + _r0, _err := functions.TposechaininstMake(pc, t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tposechainseq.go b/types/tposechainseq.go new file mode 100644 index 0000000..c739515 --- /dev/null +++ b/types/tposechainseq.go @@ -0,0 +1,42 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPoseChainSeq struct { + handle +} + +// TPoseChainSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPoseChainSeqFromPointer(p unsafe.Pointer) *TPoseChainSeq { + if p == nil { + return nil + } + v := &TPoseChainSeq{} + v.ptr = p + return v +} + +// TPoseChainSeqFromBaseTstzset is MEOS tposechainseq_from_base_tstzset. +func TPoseChainSeqFromBaseTstzset(pc unsafe.Pointer, s *Set) (*Temporal, error) { + _r0, _err := functions.TposechainseqFromBaseTstzset(pc, functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TPoseChainSeqFromBaseTstzspan is MEOS tposechainseq_from_base_tstzspan. +func TPoseChainSeqFromBaseTstzspan(pc unsafe.Pointer, s *Span, interp functions.Interpolation) (*Temporal, error) { + _r0, _err := functions.TposechainseqFromBaseTstzspan(pc, functions.SpanFromPointer(s.Pointer()), interp) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tposechainseqset.go b/types/tposechainseqset.go new file mode 100644 index 0000000..1416c44 --- /dev/null +++ b/types/tposechainseqset.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPoseChainSeqSet struct { + handle +} + +// TPoseChainSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPoseChainSeqSetFromPointer(p unsafe.Pointer) *TPoseChainSeqSet { + if p == nil { + return nil + } + v := &TPoseChainSeqSet{} + v.ptr = p + return v +} + +// TPoseChainSeqSetFromBaseTstzspanset is MEOS tposechainseqset_from_base_tstzspanset. +func TPoseChainSeqSetFromBaseTstzspanset(pc unsafe.Pointer, ss *SpanSet, interp functions.Interpolation) (*Temporal, error) { + _r0, _err := functions.TposechainseqsetFromBaseTstzspanset(pc, functions.SpanSetFromPointer(ss.Pointer()), interp) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tquadbin.go b/types/tquadbin.go new file mode 100644 index 0000000..d4dc288 --- /dev/null +++ b/types/tquadbin.go @@ -0,0 +1,246 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TQuadbin struct { + TCellIndex +} + +// TQuadbinFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TQuadbinFromPointer(p unsafe.Pointer) *TQuadbin { + if p == nil { + return nil + } + v := &TQuadbin{} + v.ptr = p + return v +} + +// TQuadbinIn is MEOS tquadbin_in. +func TQuadbinIn(str string) (*Temporal, error) { + _r0, _err := functions.TquadbinIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS tquadbin_out. +func (x *TQuadbin) Out() (string, error) { + _r0, _err := functions.TquadbinOut(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TQuadbinFromMFJSON is MEOS tquadbin_from_mfjson. +func TQuadbinFromMFJSON(mfjson string) (*Temporal, error) { + _r0, _err := functions.TquadbinFromMFJSON(mfjson) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TQuadbinMake is MEOS tquadbin_make. +func TQuadbinMake(value uint64, t int64) (*Temporal, error) { + _r0, _err := functions.TquadbinMake(value, t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TQuadbinFromBaseTemp is MEOS tquadbin_from_base_temp. +func TQuadbinFromBaseTemp(value uint64, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.TquadbinFromBaseTemp(value, functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS tquadbin_start_value. +func (x *TQuadbin) StartValue() (uint64, error) { + _r0, _err := functions.TquadbinStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// EndValue is MEOS tquadbin_end_value. +func (x *TQuadbin) EndValue() (uint64, error) { + _r0, _err := functions.TquadbinEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Value is MEOS tquadbin_value. +func (x *TQuadbin) Value() (uint64, error) { + _r0, _err := functions.TquadbinValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ValueN is MEOS tquadbin_value_n. +func (x *TQuadbin) ValueN(n int) (uint64, bool, error) { + _found, _value, _err := functions.TquadbinValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Values is MEOS tquadbin_values. +func (x *TQuadbin) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TquadbinValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Unnest is MEOS tquadbin_unnest. +func (x *TQuadbin) Unnest(values unsafe.Pointer, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TquadbinUnnest(functions.TemporalFromPointer(x.Pointer()), values, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ValueAtTimestamptz is MEOS tquadbin_value_at_timestamptz. +func (x *TQuadbin) ValueAtTimestamptz(t int64, strict bool) (uint64, bool, error) { + _found, _value, _err := functions.TquadbinValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// ToTbigint is MEOS tquadbin_to_tbigint. +func (x *TQuadbin) ToTbigint() (*Temporal, error) { + _r0, _err := functions.TquadbinToTbigint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtValue is MEOS tquadbin_at_value. +func (x *TQuadbin) AtValue(cell uint64) (*Temporal, error) { + _r0, _err := functions.TquadbinAtValue(functions.TemporalFromPointer(x.Pointer()), cell) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValue is MEOS tquadbin_minus_value. +func (x *TQuadbin) MinusValue(cell uint64) (*Temporal, error) { + _r0, _err := functions.TquadbinMinusValue(functions.TemporalFromPointer(x.Pointer()), cell) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// CellToQuadkey is MEOS tquadbin_cell_to_quadkey. +func (x *TQuadbin) CellToQuadkey() (*Temporal, error) { + _r0, _err := functions.TquadbinCellToQuadkey(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// GridDistance is MEOS tquadbin_grid_distance. +func (x *TQuadbin) GridDistance(dest *Temporal) (*Temporal, error) { + _r0, _err := functions.TquadbinGridDistance(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(dest.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TQuadbinFromEWKB is the portable fromEWKB of MEOS temporal_from_wkb. +func TQuadbinFromEWKB(wkb unsafe.Pointer, size uint) (*TQuadbin, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TQuadbinFromPointer(r.Pointer()), nil +} + +// TQuadbinFromEWKT is the portable fromEWKT of MEOS tquadbin_in. +func TQuadbinFromEWKT(str string) (*TQuadbin, error) { + r, err := TQuadbinIn(str) + if err != nil || r == nil { + return nil, err + } + return TQuadbinFromPointer(r.Pointer()), nil +} + +// TQuadbinFromHexEWKB is the portable fromHexEWKB of MEOS temporal_from_hexwkb. +func TQuadbinFromHexEWKB(hexwkb string) (*TQuadbin, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TQuadbinFromPointer(r.Pointer()), nil +} + +// TQuadbinFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TQuadbinFromHexWKB(hexwkb string) (*TQuadbin, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TQuadbinFromPointer(r.Pointer()), nil +} + +// TQuadbinFromText is the portable fromText of MEOS tquadbin_in. +func TQuadbinFromText(str string) (*TQuadbin, error) { + r, err := TQuadbinIn(str) + if err != nil || r == nil { + return nil, err + } + return TQuadbinFromPointer(r.Pointer()), nil +} + +// TQuadbinFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TQuadbinFromWKB(wkb unsafe.Pointer, size uint) (*TQuadbin, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TQuadbinFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tquadbin_out. +func (x *TQuadbin) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tquadbininst.go b/types/tquadbininst.go new file mode 100644 index 0000000..c59c21d --- /dev/null +++ b/types/tquadbininst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TQuadbinInst struct { + handle +} + +// TQuadbinInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TQuadbinInstFromPointer(p unsafe.Pointer) *TQuadbinInst { + if p == nil { + return nil + } + v := &TQuadbinInst{} + v.ptr = p + return v +} + +// TQuadbinInstMake is MEOS tquadbininst_make. +func TQuadbinInstMake(value uint64, t int64) (*Temporal, error) { + _r0, _err := functions.TquadbininstMake(value, t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tquadbinseq.go b/types/tquadbinseq.go new file mode 100644 index 0000000..a5190e3 --- /dev/null +++ b/types/tquadbinseq.go @@ -0,0 +1,51 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TQuadbinSeq struct { + handle +} + +// TQuadbinSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TQuadbinSeqFromPointer(p unsafe.Pointer) *TQuadbinSeq { + if p == nil { + return nil + } + v := &TQuadbinSeq{} + v.ptr = p + return v +} + +// TQuadbinSeqFromBaseTstzset is MEOS tquadbinseq_from_base_tstzset. +func TQuadbinSeqFromBaseTstzset(value uint64, s *Set) (*Temporal, error) { + _r0, _err := functions.TquadbinseqFromBaseTstzset(value, functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TQuadbinSeqFromBaseTstzspan is MEOS tquadbinseq_from_base_tstzspan. +func TQuadbinSeqFromBaseTstzspan(value uint64, s *Span) (*Temporal, error) { + _r0, _err := functions.TquadbinseqFromBaseTstzspan(value, functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TQuadbinSeqMake is MEOS tquadbinseq_make. +func TQuadbinSeqMake(values unsafe.Pointer, times unsafe.Pointer, count int, lower_inc bool, upper_inc bool) (*Temporal, error) { + _r0, _err := functions.TquadbinseqMake(values, times, count, lower_inc, upper_inc) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tquadbinseqset.go b/types/tquadbinseqset.go new file mode 100644 index 0000000..6bf4130 --- /dev/null +++ b/types/tquadbinseqset.go @@ -0,0 +1,42 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TQuadbinSeqSet struct { + handle +} + +// TQuadbinSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TQuadbinSeqSetFromPointer(p unsafe.Pointer) *TQuadbinSeqSet { + if p == nil { + return nil + } + v := &TQuadbinSeqSet{} + v.ptr = p + return v +} + +// TQuadbinSeqSetFromBaseTstzspanset is MEOS tquadbinseqset_from_base_tstzspanset. +func TQuadbinSeqSetFromBaseTstzspanset(value uint64, ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.TquadbinseqsetFromBaseTstzspanset(value, functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TQuadbinSeqSetMake is MEOS tquadbinseqset_make. +func TQuadbinSeqSetMake(sequences unsafe.Pointer, count int) (*Temporal, error) { + _r0, _err := functions.TquadbinseqsetMake(sequences, count) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/trgeometry.go b/types/trgeometry.go index ae0c9c7..71d5a0c 100644 --- a/types/trgeometry.go +++ b/types/trgeometry.go @@ -278,6 +278,18 @@ func (x *TRGeometry) ValueN(n int) (*TRGeometrySeqSet, bool, error) { return TRGeometrySeqSetFromPointer(_value.Pointer()), true, nil } +// ValueAtTimestamptz is MEOS trgeometry_value_at_timestamptz. +func (x *TRGeometry) ValueAtTimestamptz(t int64, strict bool) (*TRGeometrySeqSet, bool, error) { + _found, _value, _err := functions.TrgeometryValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return TRGeometrySeqSetFromPointer(_value.Pointer()), true, nil +} + // TraversedArea is MEOS trgeometry_traversed_area. func (x *TRGeometry) TraversedArea(unary_union bool) (*TRGeometrySeqSet, error) { _r0, _err := functions.TrgeometryTraversedArea(functions.TemporalFromPointer(x.Pointer()), unary_union) @@ -709,3 +721,66 @@ func (x *TRGeometry) MinusTstzspanset(ss *SpanSet) (*Temporal, error) { } return TemporalFromPointer(_r0.Pointer()), nil } + +// TRGeometryFromEWKB is the portable fromEWKB of MEOS temporal_from_wkb. +func TRGeometryFromEWKB(wkb unsafe.Pointer, size uint) (*TRGeometry, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TRGeometryFromPointer(r.Pointer()), nil +} + +// TRGeometryFromEWKT is the portable fromEWKT of MEOS trgeometry_in. +func TRGeometryFromEWKT(str string) (*TRGeometry, error) { + r, err := TRGeometryIn(str) + if err != nil || r == nil { + return nil, err + } + return TRGeometryFromPointer(r.Pointer()), nil +} + +// TRGeometryFromHexEWKB is the portable fromHexEWKB of MEOS temporal_from_hexwkb. +func TRGeometryFromHexEWKB(hexwkb string) (*TRGeometry, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TRGeometryFromPointer(r.Pointer()), nil +} + +// TRGeometryFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TRGeometryFromHexWKB(hexwkb string) (*TRGeometry, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TRGeometryFromPointer(r.Pointer()), nil +} + +// TRGeometryFromText is the portable fromText of MEOS trgeometry_in. +func TRGeometryFromText(str string) (*TRGeometry, error) { + r, err := TRGeometryIn(str) + if err != nil || r == nil { + return nil, err + } + return TRGeometryFromPointer(r.Pointer()), nil +} + +// TRGeometryFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TRGeometryFromWKB(wkb unsafe.Pointer, size uint) (*TRGeometry, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TRGeometryFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS trgeometry_as_text. +func (x *TRGeometry) String() string { + s, err := x.AsText(15) + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/ts2cell.go b/types/ts2cell.go new file mode 100644 index 0000000..10281a8 --- /dev/null +++ b/types/ts2cell.go @@ -0,0 +1,246 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TS2Cell struct { + TCellIndex +} + +// TS2CellFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TS2CellFromPointer(p unsafe.Pointer) *TS2Cell { + if p == nil { + return nil + } + v := &TS2Cell{} + v.ptr = p + return v +} + +// TS2CellIn is MEOS ts2cell_in. +func TS2CellIn(str string) (*Temporal, error) { + _r0, _err := functions.Ts2cellIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS ts2cell_out. +func (x *TS2Cell) Out() (string, error) { + _r0, _err := functions.Ts2cellOut(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TS2CellFromMFJSON is MEOS ts2cell_from_mfjson. +func TS2CellFromMFJSON(mfjson string) (*Temporal, error) { + _r0, _err := functions.Ts2cellFromMFJSON(mfjson) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TS2CellMake is MEOS ts2cell_make. +func TS2CellMake(value uint64, t int64) (*Temporal, error) { + _r0, _err := functions.Ts2cellMake(value, t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TS2CellFromBaseTemp is MEOS ts2cell_from_base_temp. +func TS2CellFromBaseTemp(value uint64, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.Ts2cellFromBaseTemp(value, functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS ts2cell_start_value. +func (x *TS2Cell) StartValue() (uint64, error) { + _r0, _err := functions.Ts2cellStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// EndValue is MEOS ts2cell_end_value. +func (x *TS2Cell) EndValue() (uint64, error) { + _r0, _err := functions.Ts2cellEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Value is MEOS ts2cell_value. +func (x *TS2Cell) Value() (uint64, error) { + _r0, _err := functions.Ts2cellValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ValueN is MEOS ts2cell_value_n. +func (x *TS2Cell) ValueN(n int) (uint64, bool, error) { + _found, _value, _err := functions.Ts2cellValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Values is MEOS ts2cell_values. +func (x *TS2Cell) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.Ts2cellValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Unnest is MEOS ts2cell_unnest. +func (x *TS2Cell) Unnest(values unsafe.Pointer, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.Ts2cellUnnest(functions.TemporalFromPointer(x.Pointer()), values, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ValueAtTimestamptz is MEOS ts2cell_value_at_timestamptz. +func (x *TS2Cell) ValueAtTimestamptz(t int64, strict bool) (uint64, bool, error) { + _found, _value, _err := functions.Ts2cellValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// ToTbigint is MEOS ts2cell_to_tbigint. +func (x *TS2Cell) ToTbigint() (*Temporal, error) { + _r0, _err := functions.Ts2cellToTbigint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtValue is MEOS ts2cell_at_value. +func (x *TS2Cell) AtValue(cell uint64) (*Temporal, error) { + _r0, _err := functions.Ts2cellAtValue(functions.TemporalFromPointer(x.Pointer()), cell) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValue is MEOS ts2cell_minus_value. +func (x *TS2Cell) MinusValue(cell uint64) (*Temporal, error) { + _r0, _err := functions.Ts2cellMinusValue(functions.TemporalFromPointer(x.Pointer()), cell) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// CellToToken is MEOS ts2cell_cell_to_token. +func (x *TS2Cell) CellToToken() (*Temporal, error) { + _r0, _err := functions.Ts2cellCellToToken(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// GridDistance is MEOS ts2cell_grid_distance. +func (x *TS2Cell) GridDistance(dest *Temporal) (*Temporal, error) { + _r0, _err := functions.Ts2cellGridDistance(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(dest.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TS2CellFromEWKB is the portable fromEWKB of MEOS temporal_from_wkb. +func TS2CellFromEWKB(wkb unsafe.Pointer, size uint) (*TS2Cell, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TS2CellFromPointer(r.Pointer()), nil +} + +// TS2CellFromEWKT is the portable fromEWKT of MEOS ts2cell_in. +func TS2CellFromEWKT(str string) (*TS2Cell, error) { + r, err := TS2CellIn(str) + if err != nil || r == nil { + return nil, err + } + return TS2CellFromPointer(r.Pointer()), nil +} + +// TS2CellFromHexEWKB is the portable fromHexEWKB of MEOS temporal_from_hexwkb. +func TS2CellFromHexEWKB(hexwkb string) (*TS2Cell, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TS2CellFromPointer(r.Pointer()), nil +} + +// TS2CellFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TS2CellFromHexWKB(hexwkb string) (*TS2Cell, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TS2CellFromPointer(r.Pointer()), nil +} + +// TS2CellFromText is the portable fromText of MEOS ts2cell_in. +func TS2CellFromText(str string) (*TS2Cell, error) { + r, err := TS2CellIn(str) + if err != nil || r == nil { + return nil, err + } + return TS2CellFromPointer(r.Pointer()), nil +} + +// TS2CellFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TS2CellFromWKB(wkb unsafe.Pointer, size uint) (*TS2Cell, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TS2CellFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS ts2cell_out. +func (x *TS2Cell) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/ts2cellinst.go b/types/ts2cellinst.go new file mode 100644 index 0000000..463786d --- /dev/null +++ b/types/ts2cellinst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TS2CellInst struct { + handle +} + +// TS2CellInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TS2CellInstFromPointer(p unsafe.Pointer) *TS2CellInst { + if p == nil { + return nil + } + v := &TS2CellInst{} + v.ptr = p + return v +} + +// TS2CellInstMake is MEOS ts2cellinst_make. +func TS2CellInstMake(value uint64, t int64) (*Temporal, error) { + _r0, _err := functions.Ts2cellinstMake(value, t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/ts2cellseq.go b/types/ts2cellseq.go new file mode 100644 index 0000000..883f0e3 --- /dev/null +++ b/types/ts2cellseq.go @@ -0,0 +1,51 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TS2CellSeq struct { + handle +} + +// TS2CellSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TS2CellSeqFromPointer(p unsafe.Pointer) *TS2CellSeq { + if p == nil { + return nil + } + v := &TS2CellSeq{} + v.ptr = p + return v +} + +// TS2CellSeqFromBaseTstzset is MEOS ts2cellseq_from_base_tstzset. +func TS2CellSeqFromBaseTstzset(value uint64, s *Set) (*Temporal, error) { + _r0, _err := functions.Ts2cellseqFromBaseTstzset(value, functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TS2CellSeqFromBaseTstzspan is MEOS ts2cellseq_from_base_tstzspan. +func TS2CellSeqFromBaseTstzspan(value uint64, s *Span) (*Temporal, error) { + _r0, _err := functions.Ts2cellseqFromBaseTstzspan(value, functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TS2CellSeqMake is MEOS ts2cellseq_make. +func TS2CellSeqMake(values unsafe.Pointer, times unsafe.Pointer, count int, lower_inc bool, upper_inc bool) (*Temporal, error) { + _r0, _err := functions.Ts2cellseqMake(values, times, count, lower_inc, upper_inc) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/ts2cellseqset.go b/types/ts2cellseqset.go new file mode 100644 index 0000000..52328de --- /dev/null +++ b/types/ts2cellseqset.go @@ -0,0 +1,42 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TS2CellSeqSet struct { + handle +} + +// TS2CellSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TS2CellSeqSetFromPointer(p unsafe.Pointer) *TS2CellSeqSet { + if p == nil { + return nil + } + v := &TS2CellSeqSet{} + v.ptr = p + return v +} + +// TS2CellSeqSetFromBaseTstzspanset is MEOS ts2cellseqset_from_base_tstzspanset. +func TS2CellSeqSetFromBaseTstzspanset(value uint64, ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.Ts2cellseqsetFromBaseTstzspanset(value, functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TS2CellSeqSetMake is MEOS ts2cellseqset_make. +func TS2CellSeqSetMake(sequences unsafe.Pointer, count int) (*Temporal, error) { + _r0, _err := functions.Ts2cellseqsetMake(sequences, count) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tspatial.go b/types/tspatial.go index 656de3e..ef73cbf 100644 --- a/types/tspatial.go +++ b/types/tspatial.go @@ -52,8 +52,8 @@ func (x *TSpatial) AsEWKT(maxdd int) (string, error) { return _r0, nil } -// AsHEXEWKB is MEOS tspatial_as_hexewkb. -func (x *TSpatial) AsHEXEWKB(variant uint8, size_out unsafe.Pointer) (string, error) { +// AsHexEWKB is MEOS tspatial_as_hexewkb. +func (x *TSpatial) AsHexEWKB(variant uint8, size_out unsafe.Pointer) (string, error) { _r0, _err := functions.TspatialAsHexewkb(functions.TemporalFromPointer(x.Pointer()), variant, size_out) if _err != nil { return "", _err diff --git a/types/tstzset.go b/types/tstzset.go index 8264052..60830d7 100644 --- a/types/tstzset.go +++ b/types/tstzset.go @@ -106,3 +106,44 @@ func (x *TsTzSet) ToStbox() (*STBox, error) { } return STBoxFromPointer(_r0.Pointer()), nil } + +// TsTzSetFromHexWKB is the portable fromHexWKB of MEOS set_from_hexwkb. +func TsTzSetFromHexWKB(hexwkb string) (*TsTzSet, error) { + r, err := SetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TsTzSetFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS tstzset_out. +func (x *TsTzSet) AsText() (string, error) { + return x.Out() +} + +// TsTzSetFromText is the portable fromText of MEOS tstzset_in. +func TsTzSetFromText(str string) (*TsTzSet, error) { + r, err := TsTzSetIn(str) + if err != nil || r == nil { + return nil, err + } + return TsTzSetFromPointer(r.Pointer()), nil +} + +// TsTzSetFromWKB is the portable fromWKB of MEOS set_from_wkb. +func TsTzSetFromWKB(wkb unsafe.Pointer, size uint) (*TsTzSet, error) { + r, err := SetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TsTzSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tstzset_out. +func (x *TsTzSet) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tstzspan.go b/types/tstzspan.go index 6924128..d870bba 100644 --- a/types/tstzspan.go +++ b/types/tstzspan.go @@ -85,3 +85,44 @@ func (x *TsTzSpan) ToStbox() (*STBox, error) { } return STBoxFromPointer(_r0.Pointer()), nil } + +// TsTzSpanFromHexWKB is the portable fromHexWKB of MEOS span_from_hexwkb. +func TsTzSpanFromHexWKB(hexwkb string) (*TsTzSpan, error) { + r, err := SpanFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TsTzSpanFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS tstzspan_out. +func (x *TsTzSpan) AsText() (string, error) { + return x.Out() +} + +// TsTzSpanFromText is the portable fromText of MEOS tstzspan_in. +func TsTzSpanFromText(str string) (*TsTzSpan, error) { + r, err := TsTzSpanIn(str) + if err != nil || r == nil { + return nil, err + } + return TsTzSpanFromPointer(r.Pointer()), nil +} + +// TsTzSpanFromWKB is the portable fromWKB of MEOS span_from_wkb. +func TsTzSpanFromWKB(wkb unsafe.Pointer, size uint) (*TsTzSpan, error) { + r, err := SpanFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TsTzSpanFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tstzspan_out. +func (x *TsTzSpan) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/tstzspanset.go b/types/tstzspanset.go index 696b7bf..5bffeae 100644 --- a/types/tstzspanset.go +++ b/types/tstzspanset.go @@ -124,3 +124,44 @@ func (x *TsTzSpanSet) ToStbox() (*STBox, error) { } return STBoxFromPointer(_r0.Pointer()), nil } + +// TsTzSpanSetFromHexWKB is the portable fromHexWKB of MEOS spanset_from_hexwkb. +func TsTzSpanSetFromHexWKB(hexwkb string) (*TsTzSpanSet, error) { + r, err := SpanSetFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TsTzSpanSetFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS tstzspanset_out. +func (x *TsTzSpanSet) AsText() (string, error) { + return x.Out() +} + +// TsTzSpanSetFromText is the portable fromText of MEOS tstzspanset_in. +func TsTzSpanSetFromText(str string) (*TsTzSpanSet, error) { + r, err := TsTzSpanSetIn(str) + if err != nil || r == nil { + return nil, err + } + return TsTzSpanSetFromPointer(r.Pointer()), nil +} + +// TsTzSpanSetFromWKB is the portable fromWKB of MEOS spanset_from_wkb. +func TsTzSpanSetFromWKB(wkb unsafe.Pointer, size uint) (*TsTzSpanSet, error) { + r, err := SpanSetFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TsTzSpanSetFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS tstzspanset_out. +func (x *TsTzSpanSet) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +} diff --git a/types/ttext.go b/types/ttext.go index 2cc70cb..2a81515 100644 --- a/types/ttext.go +++ b/types/ttext.go @@ -199,3 +199,44 @@ func (x *TText) ToTjsonb() (*Temporal, error) { } return TemporalFromPointer(_r0.Pointer()), nil } + +// TTextFromHexWKB is the portable fromHexWKB of MEOS temporal_from_hexwkb. +func TTextFromHexWKB(hexwkb string) (*TText, error) { + r, err := TemporalFromHexWKB(hexwkb) + if err != nil || r == nil { + return nil, err + } + return TTextFromPointer(r.Pointer()), nil +} + +// AsText is the portable asText of MEOS ttext_out. +func (x *TText) AsText() (string, error) { + return x.Out() +} + +// TTextFromText is the portable fromText of MEOS ttext_in. +func TTextFromText(str string) (*TText, error) { + r, err := TTextIn(str) + if err != nil || r == nil { + return nil, err + } + return TTextFromPointer(r.Pointer()), nil +} + +// TTextFromWKB is the portable fromWKB of MEOS temporal_from_wkb. +func TTextFromWKB(wkb unsafe.Pointer, size uint) (*TText, error) { + r, err := TemporalFromWKB(wkb, size) + if err != nil || r == nil { + return nil, err + } + return TTextFromPointer(r.Pointer()), nil +} + +// String is the text MEOS writes this value as, MEOS ttext_out. +func (x *TText) String() string { + s, err := x.Out() + if err != nil { + return "%!s(MEOS error: " + err.Error() + ")" + } + return s +}