@@ -42,6 +42,7 @@ type Point struct {
4242}
4343
4444var _ sql.Type = PointType {}
45+ var _ sql.ValueType = PointType {}
4546var _ sql.SpatialColumnType = PointType {}
4647var _ sql.CollationCoercible = PointType {}
4748var _ GeometryValue = Point {}
@@ -123,6 +124,26 @@ func (t PointType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.V
123124 return sqltypes .MakeTrusted (sqltypes .Geometry , buf ), nil
124125}
125126
127+ // CompareValue implements the ValueType interface.
128+ func (t PointType ) CompareValue (c * sql.Context , value sql.Value , value2 sql.Value ) (int , error ) {
129+ panic ("TODO: implement CompareValue for PointType" )
130+ }
131+
132+ // SQLValue implements the ValueType interface.
133+ func (t PointType ) SQLValue (ctx * sql.Context , v sql.Value , dest []byte ) (sqltypes.Value , error ) {
134+ if v .IsNull () {
135+ return sqltypes .NULL , nil
136+ }
137+ if v .Val == nil {
138+ var err error
139+ v .Val , err = v .WrappedVal .Unwrap (ctx )
140+ if err != nil {
141+ return sqltypes.Value {}, err
142+ }
143+ }
144+ return sqltypes .MakeTrusted (sqltypes .Geometry , v .Val ), nil
145+ }
146+
126147// String implements Type interface.
127148func (t PointType ) String () string {
128149 return "point"
0 commit comments