Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
Go
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
package tangled
// schema: sh.tangled.embed.commit
import ( "bytes" "encoding/json" "fmt" "io"
"github.com/bluesky-social/indigo/lex/util" cbg "github.com/whyrusleeping/cbor-gen")
const ( EmbedCommitNSID = "sh.tangled.embed.commit")
func init() { util.RegisterType("sh.tangled.embed.commit#main", &EmbedCommit{})} // EmbedCommit is a "main" in the sh.tangled.embed.commit schema.// RECORDTYPE: EmbedCommittype EmbedCommit struct { LexiconTypeID string `json:"$type,const=sh.tangled.embed.commit" cborgen:"$type,const=sh.tangled.embed.commit"` Commit *EmbedCommit_Commit `json:"commit" cborgen:"commit"` Repo string `json:"repo" cborgen:"repo"`}
type EmbedCommit_Commit struct { GitOid *GitOid}
func (t *EmbedCommit_Commit) MarshalJSON() ([]byte, error) { if t.GitOid != nil { t.GitOid.LexiconTypeID = "sh.tangled.git.oid" return json.Marshal(t.GitOid) } return nil, fmt.Errorf("cannot marshal empty enum")}func (t *EmbedCommit_Commit) UnmarshalJSON(b []byte) error { typ, err := util.TypeExtract(b) if err != nil { return err }
switch typ { case "sh.tangled.git.oid": t.GitOid = new(GitOid) return json.Unmarshal(b, t.GitOid)
default: return nil }}
func (t *EmbedCommit_Commit) MarshalCBOR(w io.Writer) error {
if t == nil { _, err := w.Write(cbg.CborNull) return err } if t.GitOid != nil { return t.GitOid.MarshalCBOR(w) } return fmt.Errorf("cannot cbor marshal empty enum")}func (t *EmbedCommit_Commit) UnmarshalCBOR(r io.Reader) error { typ, b, err := util.CborTypeExtractReader(r) if err != nil { return err }
switch typ { case "sh.tangled.git.oid": t.GitOid = new(GitOid) return t.GitOid.UnmarshalCBOR(bytes.NewReader(b))
default: return nil }}
// EmbedCommit_View is a "view" in the sh.tangled.embed.commit schema.//// RECORDTYPE: EmbedCommit_Viewtype EmbedCommit_View struct { LexiconTypeID string `json:"$type,const=sh.tangled.embed.commit#view" cborgen:"$type,const=sh.tangled.embed.commit#view"` Change *string `json:"change,omitempty" cborgen:"change,omitempty"` Commit string `json:"commit" cborgen:"commit"` Repo string `json:"repo" cborgen:"repo"`}