Documentation
¶
Index ¶
- Variables
- func CheckDir(dirPath string) error
- func CheckFile(filePath string) error
- func DeleteAllFilesInDir(dir string) error
- func ExecuteTemplate(tplStr string, jsonSchemaPath, outPath string, data map[string]interface{}, ...) error
- func GenerateSchemasDescriptionString(schemas []datamod.TableSchema) string
- type Config
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultFuncMap = template.FuncMap{ "_sub": func(a, b int) int { return a - b }, "_actionId": func(schema datamod.TableSchema) string { var argsSign string if len(schema.Values) > 0 { solTypes := make([]string, 0, len(schema.Values)) for _, field := range schema.Values { solTypes = append(solTypes, field.Type.SolType) } argsSign = "(" + strings.Join(solTypes, ",") + ")" } else { argsSign = "" } methodName := params.SolidityActionMethodName(schema.Name) sign := fmt.Sprintf("%s(%s)", methodName, argsSign) hash := crypto.Keccak256([]byte(sign)) return fmt.Sprintf("0x%x", hash[:4]) }, }
Functions ¶
func DeleteAllFilesInDir ¶
DeleteAllFilesInDir deletes all files in the given directory.
func ExecuteTemplate ¶
func ExecuteTemplate(tplStr string, jsonSchemaPath, outPath string, data map[string]interface{}, funcMap template.FuncMap) error
ExecuteTemplate executes a template with the given data and writes the output to a file. It will load the JSON schema from the given path and add it to the data map.
func GenerateSchemasDescriptionString ¶
func GenerateSchemasDescriptionString(schemas []datamod.TableSchema) string
GenerateSchemasDescriptionString generates a string with the description of the schemas.
Types ¶
Click to show internal directories.
Click to hide internal directories.