Documentation
¶
Index ¶
- Variables
- func ParseFS(myFuncs template.FuncMap, fsys fs.FS, pattern string) (*template.Template, error)
- func ToMarkdown(input string) string
- type EntityInfo
- type EntityType
- type OutputType
- type Project
- func (p *Project) AddClickHouseSQLType(name string, field *descriptorpb.FieldDescriptorProto)
- func (p *Project) AddPostgreSQLType(name string, field *descriptorpb.FieldDescriptorProto)
- func (p *Project) AddSubgraphEntityType(name string, field *descriptorpb.FieldDescriptorProto)
- func (p *Project) BuildOutputEntity() error
- func (p *Project) ChainEndpoint() (string, error)
- func (p *Project) DatabaseChangeImportVersion() string
- func (p *Project) GetModuleName() string
- func (p *Project) GetOutputProtoPath() string
- func (p *Project) GetOutputProtobufPath() string
- func (p *Project) GetRustOutputProtobufPath() string
- func (p *Project) HasExampleEntity() bool
- func (p *Project) ModuleInitialBlock() uint64
- func (p *Project) OutputName() string
- func (p *Project) ProtoOutputName() string
- func (p *Project) ProtoOutputNameToSnake() string
- func (p *Project) Render(withDevEnv bool) (projectFiles map[string][]byte, err error)
- func (p *Project) SQLExtensionName() string
- func (p *Project) SQLImportVersion() string
- func (p *Project) SpkgNameWithoutExt() string
- func (p *Project) SubstreamsKebabName() string
- type ProtoGenerator
- type SQLEntityType
- type SQLType
- type SubgraphEntityType
- type SubgraphType
Constants ¶
This section is empty.
Variables ¶
var Cmd = &cobra.Command{Use: "codegen", Short: "Code generator for substreams"}
var SQLCmd = &cobra.Command{ Use: "sql [<manifest_url>]", Short: "Generate sql extension from substreams manifest", Args: cobra.RangeArgs(0, 1), RunE: generateSQLEnv, }
var SubgraphCmd = &cobra.Command{ Use: "subgraph [<manifest_url>]", Short: "Generate subgraph dev environment from substreams manifest", Args: cobra.RangeArgs(0, 1), RunE: generateSubgraphEnv, }
Functions ¶
func ToMarkdown ¶ added in v1.10.1
Types ¶
type EntityInfo ¶ added in v1.10.1
type EntityType ¶ added in v1.10.1
type EntityType interface {
ToEntityTypeOut() string
}
type OutputType ¶ added in v1.10.1
type OutputType string
const ( Subgraph OutputType = "subgraph" Sql OutputType = "sql" )
func (OutputType) String ¶ added in v1.10.1
func (t OutputType) String() string
type Project ¶ added in v1.10.0
type Project struct {
Name string
Network string
Module *pbsubstreams.Module
OutputDescriptor *descriptorpb.DescriptorProto
EntityTypes []EntityType
EntityInfo EntityInfo
SpkgProjectName string
ManifestPath string
OutputType OutputType
Flavor string
// contains filtered or unexported fields
}
func NewProject ¶ added in v1.10.0
func NewProject( name string, spkgProjectName string, network, manifestPath string, module *pbsubstreams.Module, outputDescriptor *descriptorpb.DescriptorProto, protoTypeMapping map[string]*descriptorpb.DescriptorProto, outputType OutputType, flavor string, ) *Project
func (*Project) AddClickHouseSQLType ¶ added in v1.10.1
func (p *Project) AddClickHouseSQLType(name string, field *descriptorpb.FieldDescriptorProto)
func (*Project) AddPostgreSQLType ¶ added in v1.10.1
func (p *Project) AddPostgreSQLType(name string, field *descriptorpb.FieldDescriptorProto)
func (*Project) AddSubgraphEntityType ¶ added in v1.10.1
func (p *Project) AddSubgraphEntityType(name string, field *descriptorpb.FieldDescriptorProto)
func (*Project) BuildOutputEntity ¶ added in v1.10.1
func (*Project) ChainEndpoint ¶ added in v1.10.0
func (*Project) DatabaseChangeImportVersion ¶ added in v1.10.1
func (*Project) GetModuleName ¶ added in v1.10.0
func (*Project) GetOutputProtoPath ¶ added in v1.10.0
func (*Project) GetOutputProtobufPath ¶ added in v1.10.0
func (*Project) GetRustOutputProtobufPath ¶ added in v1.10.1
func (*Project) HasExampleEntity ¶ added in v1.10.0
func (*Project) ModuleInitialBlock ¶ added in v1.10.1
func (*Project) OutputName ¶ added in v1.10.0
func (*Project) ProtoOutputName ¶ added in v1.10.0
func (*Project) ProtoOutputNameToSnake ¶ added in v1.10.0
func (*Project) SQLExtensionName ¶ added in v1.10.1
func (*Project) SQLImportVersion ¶ added in v1.10.1
func (*Project) SpkgNameWithoutExt ¶ added in v1.10.1
func (*Project) SubstreamsKebabName ¶ added in v1.10.0
type ProtoGenerator ¶
type ProtoGenerator struct {
// contains filtered or unexported fields
}
func NewProtoGenerator ¶
func NewProtoGenerator(outputPath string, excludedPaths []string, generateMod bool) *ProtoGenerator
func (*ProtoGenerator) GenerateProto ¶ added in v0.1.0
func (g *ProtoGenerator) GenerateProto(pkg *pbsubstreams.Package) error
func (*ProtoGenerator) SetHasNonDeterministicDescriptors ¶ added in v1.18.0
func (g *ProtoGenerator) SetHasNonDeterministicDescriptors(has bool)
SetHasNonDeterministicDescriptors sets whether the manifest has non-deterministic descriptor sets. When true, protobuf generation will always run regardless of hash comparison, since the content may have changed without the hash changing.
func (*ProtoGenerator) SetOutputPathExplicit ¶ added in v1.25.0
func (g *ProtoGenerator) SetOutputPathExplicit()
SetOutputPathExplicit marks the output directory as the caller's choice, so an existing `buf.gen.yaml` does not override it.
func (*ProtoGenerator) SetProjectPath ¶ added in v1.25.0
func (g *ProtoGenerator) SetProjectPath(path string)
SetProjectPath sets the project directory: where `buf.gen.yaml` and `Cargo.toml` are read from, where `buf` runs, and what the configuration's `out:` is relative to. It defaults to the working directory.
`buf` resolves `buf.gen.yaml` and the paths inside it against its own working directory, so every path has to share one base or the configuration written for one run does not mean the same thing on the next.
type SQLEntityType ¶ added in v1.10.1
func (*SQLEntityType) ToEntityTypeOut ¶ added in v1.10.1
func (e *SQLEntityType) ToEntityTypeOut() string
func (*SQLEntityType) ToSQLType ¶ added in v1.10.1
func (e *SQLEntityType) ToSQLType() string
type SQLType ¶ added in v1.10.1
type SQLType string
var ( PostgresSqlText SQLType = "TEXT" PostgresSqlBoolean SQLType = "BOOL" PostgresSqlInt SQLType = "Int" PostgresSqlDecimal SQLType = "DECIMAL" PostgresSqlBytes SQLType = "BYTEA" ClickhouseString SQLType = "String" ClickhouseBoolean SQLType = "Bool" ClickhouseUInt32 SQLType = "UInt32" ClickhouseInt32 SQLType = "Int32" ClickhouseUInt64 SQLType = "UInt64" ClickhouseInt64 SQLType = "Int64" ClickhouseDecimal SQLType = "Decimal64(%d)" )
type SubgraphEntityType ¶ added in v1.10.1
type SubgraphEntityType struct {
Name string
Type SubgraphType
}
func (*SubgraphEntityType) ToEntityTypeOut ¶ added in v1.10.1
func (e *SubgraphEntityType) ToEntityTypeOut() string
func (*SubgraphEntityType) ToGraphQLType ¶ added in v1.10.1
func (e *SubgraphEntityType) ToGraphQLType() string
type SubgraphType ¶ added in v1.10.1
type SubgraphType string
var ( SubgraphBytes SubgraphType = "Bytes" SubgraphString SubgraphType = "String" SubgraphBoolean SubgraphType = "Boolean" SubgraphInt SubgraphType = "Int" SubgraphInt8 SubgraphType = "Int8" SubgraphBigInt SubgraphType = "BigInt" SubgraphBigDecimal SubgraphType = "BigDecimal" SubgraphTimestamp SubgraphType = "Timestamp" // this is an alias for i64 )
func (SubgraphType) String ¶ added in v1.10.1
func (t SubgraphType) String() string