github.com/storacha/go-ucanto@v0.7.2/core/result/ok/datamodel/unit.go (about)

     1  package datamodel
     2  
     3  import (
     4  	// to use go:embed
     5  	_ "embed"
     6  	"fmt"
     7  
     8  	"github.com/ipld/go-ipld-prime"
     9  	"github.com/ipld/go-ipld-prime/schema"
    10  )
    11  
    12  //go:embed unit.ipldsch
    13  var unitSchema []byte
    14  
    15  var unitType schema.Type
    16  
    17  func init() {
    18  	ts, err := ipld.LoadSchemaBytes(unitSchema)
    19  	if err != nil {
    20  		panic(fmt.Errorf("loading unit schema: %w", err))
    21  	}
    22  	unitType = ts.TypeByName("Unit")
    23  }
    24  
    25  func UnitType() schema.Type {
    26  	return unitType
    27  }
    28  
    29  func Schema() []byte {
    30  	return unitSchema
    31  }