added basic skeleton and two API endpoints to test backend stack.

This commit is contained in:
2022-04-12 20:30:16 +02:00
parent 22e8290371
commit 11c0bd62e2
40 changed files with 1480 additions and 8 deletions
+36
View File
@@ -0,0 +1,36 @@
package sqltypes
import (
"database/sql/driver"
"encoding/json"
"errors"
)
type NullRawMessage struct {
RawMessage json.RawMessage
Valid bool
}
func (n *NullRawMessage) Scan(value interface{}) error {
if value == nil {
n.RawMessage, n.Valid = json.RawMessage{}, false
return nil
}
buf, ok := value.([]byte)
if !ok {
return errors.New("cannot parse to bytes")
}
n.RawMessage, n.Valid = buf, true
return nil
}
func (n NullRawMessage) Value() (driver.Value, error) {
if !n.Valid {
return nil, nil
}
return n.RawMessage, nil
}