github.com/ipld/go-ipld-prime@v0.21.0/schema/gen/go/genIntReprInt.go (about) 1 package gengo 2 3 import ( 4 "io" 5 6 "github.com/ipld/go-ipld-prime/schema" 7 "github.com/ipld/go-ipld-prime/schema/gen/go/mixins" 8 ) 9 10 var _ TypeGenerator = &intReprIntGenerator{} 11 12 func NewIntReprIntGenerator(pkgName string, typ *schema.TypeInt, adjCfg *AdjunctCfg) TypeGenerator { 13 return intReprIntGenerator{ 14 intGenerator{ 15 adjCfg, 16 mixins.IntTraits{ 17 PkgName: pkgName, 18 TypeName: string(typ.Name()), 19 TypeSymbol: adjCfg.TypeSymbol(typ), 20 }, 21 pkgName, 22 typ, 23 }, 24 } 25 } 26 27 type intReprIntGenerator struct { 28 intGenerator 29 } 30 31 func (g intReprIntGenerator) GetRepresentationNodeGen() NodeGenerator { 32 return intReprIntReprGenerator{ 33 g.AdjCfg, 34 g.Type, 35 } 36 } 37 38 type intReprIntReprGenerator struct { 39 AdjCfg *AdjunctCfg 40 Type *schema.TypeInt 41 } 42 43 func (g intReprIntReprGenerator) EmitNodeType(w io.Writer) { 44 // Since this is a "natural" representation... there's just a type alias here. 45 // No new functions are necessary. 46 doTemplate(` 47 type _{{ .Type | TypeSymbol }}__Repr = _{{ .Type | TypeSymbol }} 48 `, w, g.AdjCfg, g) 49 } 50 func (g intReprIntReprGenerator) EmitNodeTypeAssertions(w io.Writer) { 51 doTemplate(` 52 var _ datamodel.Node = &_{{ .Type | TypeSymbol }}__Repr{} 53 `, w, g.AdjCfg, g) 54 } 55 func (intReprIntReprGenerator) EmitNodeMethodKind(io.Writer) {} 56 func (intReprIntReprGenerator) EmitNodeMethodLookupByString(io.Writer) {} 57 func (intReprIntReprGenerator) EmitNodeMethodLookupByNode(io.Writer) {} 58 func (intReprIntReprGenerator) EmitNodeMethodLookupByIndex(io.Writer) {} 59 func (intReprIntReprGenerator) EmitNodeMethodLookupBySegment(io.Writer) {} 60 func (intReprIntReprGenerator) EmitNodeMethodMapIterator(io.Writer) {} 61 func (intReprIntReprGenerator) EmitNodeMethodListIterator(io.Writer) {} 62 func (intReprIntReprGenerator) EmitNodeMethodLength(io.Writer) {} 63 func (intReprIntReprGenerator) EmitNodeMethodIsAbsent(io.Writer) {} 64 func (intReprIntReprGenerator) EmitNodeMethodIsNull(io.Writer) {} 65 func (intReprIntReprGenerator) EmitNodeMethodAsBool(io.Writer) {} 66 func (intReprIntReprGenerator) EmitNodeMethodAsInt(io.Writer) {} 67 func (intReprIntReprGenerator) EmitNodeMethodAsFloat(io.Writer) {} 68 func (intReprIntReprGenerator) EmitNodeMethodAsString(io.Writer) {} 69 func (intReprIntReprGenerator) EmitNodeMethodAsBytes(io.Writer) {} 70 func (intReprIntReprGenerator) EmitNodeMethodAsLink(io.Writer) {} 71 func (intReprIntReprGenerator) EmitNodeMethodPrototype(io.Writer) {} 72 func (g intReprIntReprGenerator) EmitNodePrototypeType(w io.Writer) { 73 // Since this is a "natural" representation... there's just a type alias here. 74 // No new functions are necessary. 75 doTemplate(` 76 type _{{ .Type | TypeSymbol }}__ReprPrototype = _{{ .Type | TypeSymbol }}__Prototype 77 `, w, g.AdjCfg, g) 78 } 79 func (g intReprIntReprGenerator) GetNodeBuilderGenerator() NodeBuilderGenerator { 80 return intReprIntReprBuilderGenerator(g) 81 } 82 83 type intReprIntReprBuilderGenerator struct { 84 AdjCfg *AdjunctCfg 85 Type *schema.TypeInt 86 } 87 88 func (intReprIntReprBuilderGenerator) EmitNodeBuilderType(io.Writer) {} 89 func (intReprIntReprBuilderGenerator) EmitNodeBuilderMethods(io.Writer) {} 90 func (g intReprIntReprBuilderGenerator) EmitNodeAssemblerType(w io.Writer) { 91 // Since this is a "natural" representation... there's just a type alias here. 92 // No new functions are necessary. 93 doTemplate(` 94 type _{{ .Type | TypeSymbol }}__ReprAssembler = _{{ .Type | TypeSymbol }}__Assembler 95 `, w, g.AdjCfg, g) 96 } 97 func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodBeginMap(io.Writer) {} 98 func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodBeginList(io.Writer) {} 99 func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignNull(io.Writer) {} 100 func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignBool(io.Writer) {} 101 func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignInt(io.Writer) {} 102 func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignFloat(io.Writer) {} 103 func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignString(io.Writer) {} 104 func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignBytes(io.Writer) {} 105 func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignLink(io.Writer) {} 106 func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignNode(io.Writer) {} 107 func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodPrototype(io.Writer) {} 108 func (intReprIntReprBuilderGenerator) EmitNodeAssemblerOtherBits(io.Writer) {}