Documentation ¶
Index ¶
- Constants
- func GenerateInitializationList(out io.Writer, contracts ContractList) error
- func GetRealApplicationDir(dir string) (string, error)
- func GetRealContractsNames() ([]string, error)
- type ContractList
- type ContractListEntry
- type ParsedFile
- func (pf *ParsedFile) ChangePackageToMain()
- func (pf *ParsedFile) ContractName() string
- func (pf *ParsedFile) ProxyPackageName() (string, error)
- func (pf *ParsedFile) Write(out io.Writer) error
- func (pf *ParsedFile) WriteProxy(classReference string, out io.Writer) error
- func (pf *ParsedFile) WriteWrapper(out io.Writer, packageName string) error
- type SagaInfo
Constants ¶
const ( CodeType = "code" PrototypeType = "prototype" )
const (
TemplateDirectory = "templates"
)
Variables ¶
This section is empty.
Functions ¶
func GenerateInitializationList ¶
func GenerateInitializationList(out io.Writer, contracts ContractList) error
func GetRealApplicationDir ¶
GetRealApplicationDir return application dir path
func GetRealContractsNames ¶
GetRealContractsNames returns names of all real smart contracts
Types ¶
type ContractList ¶
type ContractList []ContractListEntry
type ContractListEntry ¶
type ContractListEntry struct { Name string Path string Parsed *ParsedFile ImportPath string Version int }
type ParsedFile ¶
type ParsedFile struct {
// contains filtered or unexported fields
}
ParsedFile struct with prepared info we extract from source code
func ParseFile ¶
func ParseFile(fileName string, machineType insolar.MachineType) (*ParsedFile, error)
ParseFile parses a file as Go source code of a smart contract and returns it as `ParsedFile`
func (*ParsedFile) ChangePackageToMain ¶
func (pf *ParsedFile) ChangePackageToMain()
ChangePackageToMain changes package of the parsed code to "main"
func (*ParsedFile) ContractName ¶
func (pf *ParsedFile) ContractName() string
ContractName returns name of the contract
func (*ParsedFile) ProxyPackageName ¶
func (pf *ParsedFile) ProxyPackageName() (string, error)
ProxyPackageName guesses user friendly contract "name" from file name and/or package in the file
func (*ParsedFile) Write ¶
func (pf *ParsedFile) Write(out io.Writer) error
Write prints `out` contract's code, it could be changed with a few methods
func (*ParsedFile) WriteProxy ¶
func (pf *ParsedFile) WriteProxy(classReference string, out io.Writer) error
WriteProxy generates and writes into `out` source code of contract's proxy
func (*ParsedFile) WriteWrapper ¶
func (pf *ParsedFile) WriteWrapper(out io.Writer, packageName string) error
WriteWrapper generates and writes into `out` source code of wrapper for the contract
type SagaInfo ¶
type SagaInfo struct { IsSaga bool RollbackMethodName string // we have to duplicate argument list here because it's not always used in templates Arguments string NumArguments int }
SagaInfo stores sagas-related information for given contract method. If a method is marked with //ins:saga(Rollback) SagaInfo stores `IsSaga: true, RollbackMethodName: "Rollback"`. Also Arguments always stores a comma separated list of arguments and NumArguments always stores the number of arguments.