You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I showcase here how we could create a type generator for your exported types in your adapter package. Some go machinery and other magic tricks and that should be it 😇
// your public types
type A struct {
S string
}
// go generated private types
type (
fA_S string
fA_DocID surrealhigh.Id
aDoc struct {
S fA_S `json:"s"`
DocId fA_DocID `json:"id"`
}
)
func (doc aDoc) Id() surrealhigh.Field {return doc.DocID}
func (doc aDoc) Table() surrealhigh.Table {return "a"}
func (_ fA_S) Field() surrealhigh.Field {return "s"}
func (_ fA_DocID) Field() surrealhigh.Field {return "id"}
func (id fA_DocID) MarshalJSON() ([]byte, error) {
sid := surrealhigh.Id(id)
// marshal id to thing
}
func (id fA_DocID) UnmarshalJSON([]byte) (error) {
// unmarshal thing to id [16]byte
}
The text was updated successfully, but these errors were encountered:
I showcase here how we could create a type generator for your exported types in your adapter package. Some go machinery and other magic tricks and that should be it 😇
The text was updated successfully, but these errors were encountered: