package
0.21.0
Repository: https://github.com/ipld/go-ipld-prime.git
Documentation: pkg.go.dev

# README

gengo

This package contains a codegenerator for emitting Golang source code for datastructures based on IPLD Schemas.

It is reasonably complete. See the feature table below for details.

There is a CLI tool which can be used to run this generator. See https://github.com/ipld/go-ipldtool !

Some features may still requiring writing code to fully configure them. (PRs, here or in the go-ipldtool repo, welcome.)

See README_behaviors for notes about the behaviors of the code output by the generator.

Check out the HACKME document for more info about the internals, how they're organized, and how to hack on this package.

aims

gengo aims to:

  • generate native Golang code
  • that faithfully represents the data structuring specified by an IPLD Schema,
  • operating efficiently, both in speed (both creating and inspecting) and memory compactness;
  • producing a better type system for Golang (we've got unions and enums!)
  • that is both powerful and generic (when you need it)
  • and minimalist (when you don't),
  • with immutable data structures,
  • good validation primitives and type-supported safety systems,
  • and is friendly to embellishments of other hand-written Golang code.

Some of these aims should be satisfied.

Some are still a stretch ;) (we definitely don't have "minimalist" outputs, yet. Making this reachable by tuning is a goal, however!)

completeness

Legend:

  • - supported!
  • - not currently supported.
  • - not currently supported -- and might not be obvious; be careful.
  • - - is not applicable
  • ? - feature definition needed! (applies to many of the "native extras" rows -- often there's partial features, but also room for more.)
  • - table is not finished, please refer to the code and help fix the table :)
featureaccessorsbuilders
structs......
... type level
... native extras??
... map representation
... ... including optional
... ... including renames
... ... including implicits
... tuple representation
... ... including optional
... ... including renames--
... ... including implicits
... stringjoin representation
... ... including optional--
... ... including renames--
... ... including implicits--
... stringpairs representation
... ... including optional
... ... including renames
... ... including implicits
... listpairs representation
... ... including optional
... ... including renames
... ... including implicits
featureaccessorsbuilders
lists......
... type level
... native extras??
... list representation
featureaccessorsbuilders
maps......
... type level
... native extras??
... map representation
... stringpairs representation
... listpairs representation
featureaccessorsbuilders
unions......
... type level
... keyed representation
... envelope representation
... kinded representation
... inline representation
... stringprefix representation
... byteprefix representation
featureaccessorsbuilders
strings
bytes
ints
floats
bools
links
featureaccessorsbuilders
enums......
... type level
... string representation
... int representation

# Packages

No description provided by the author

# Functions

EmitEntireType is a helper function calls all methods of TypeGenerator and streams all results into a single writer.
EmitFileHeader emits a baseline package header that will allow a file with a generated type to compile.
EmitInternalEnums creates a file with enum types used internally.
EmitNode is a helper function that calls all methods of NodeGenerator and streams all results into a single writer.
No description provided by the author
Generate takes a typesystem and the adjunct config for codegen, and emits generated code in the given path with the given package name.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author
TypeGenerator gathers all the info for generating all code related to one type in the schema.