{"modulePath":"github.com/Corestoreio/pkg","version":"v0.0.0-20230101183712-202847b4b89b","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package codegen\n\nPackage codegen generates Go, Protobuf, Flatbuffers, TypeScript, etc. code.\n\n## Functions\n\n```go\nfunc EncloseBT(s string) string\n```\nEncloseBT encloses the string s in backticks\n\n```go\nfunc SkipWS(str ...interface{}) []byte\n```\nSkipWS converts all arguments to type string, panics if it does not support a type, and merges all arguments to one single string without white space concatenation. This function can be used as argument to Pln or P or C.\n\n## Types\n\n```go\ntype FormatError struct {\n\tCode string\n\t// contains filtered or unexported fields\n}\n```\nFormatError gets returned when generating the source code in case gofmt or any equal other program for a language can't run the formatting.\n\n```go\nfunc (*FormatError) ErrorKind() errors.Kind\n```\n\n```go\ntype Go struct {\n\tBuildTags []string // each entry is one line\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewGo(packageName string) *Go\n```\nNewGo creates a new Go source code generator for a specific new package.\n\n```go\nfunc (g *Go) AddImport(importPath, packageName string)\n```\nAddImport adds a new import path. importPath required and packageName optional.\n\n```go\nfunc (g *Go) AddImports(importPaths ...string)\n```\nAddImports adds multiple import paths at once. They all must have unique base names.\n\n```go\nfunc (g *Go) AddInitf(stmt string, a ...interface{})\n```\nAddInitf stores the given statement to be printed inside the file's init function. The statement is given as a format specifier and arguments.\n\n```go\nfunc (g *Go) C(comments ...interface{})\n```\nWrites a multiline comment and formats it to a max width of 80 chars. It adds automatically the comment prefix \\`//\\`. It converts all types to string, if it can't it panics. If the first argument is a boolean and true, the subsequent data gets printed, otherwise not.\n\n```go\nfunc (g *Go) GenerateFile(w io.Writer) error\n```\n\n```go\nfunc (g *Go) In()\n```\nIn Indents the output one tab stop.\n\n```go\nfunc (g *Go) Out()\n```\nOut unindents the output one tab stop.\n\n```go\nfunc (g *Go) P(str ...interface{})\n```\nP same as Pln but without the line break at the end.\n\n```go\nfunc (g *Go) Pln(str ...interface{})\n```\nPln prints the arguments to the generated output. It tries to convert all kind of types to a string. It adds a line break at the end IF there are strs to print. If the first argument is a boolean and true, the subsequent data gets printed, otherwise not.\n\n```go\nfunc (g *Go) WriteConstants(lines ...string)\n```\nWriteConstants add a const () declaration to the current position in the buffer. A line includes the const name equal value.\n\n```go\ntype Proto struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewProto(packageName string) *Proto\n```\nNewProto creates a new Proto source code generator for a specific new package.\n\n```go\nfunc (g *Proto) AddImport(importPath, packageName string)\n```\nAddImport adds a new import path. importPath required and packageName optional.\n\n```go\nfunc (g *Proto) AddImports(importPaths ...string)\n```\nAddImports adds multiple import paths at once. They all must have unique base names.\n\n```go\nfunc (g *Proto) AddOptions(nameRawValue ...string)\n```\n\n```go\nfunc (g *Proto) C(comments ...interface{})\n```\nWrites a multiline comment and formats it to a max width of 80 chars. It adds automatically the comment prefix \\`//\\`. It converts all types to string, if it can't it panics. If the first argument is a boolean and true, the subsequent data gets printed, otherwise not.\n\n```go\nfunc (g *Proto) GenerateFile(w io.Writer) error\n```\n\n```go\nfunc (g *Proto) In()\n```\nIn Indents the output one tab stop.\n\n```go\nfunc (g *Proto) Out()\n```\nOut unindents the output one tab stop.\n\n```go\nfunc (g *Proto) P(str ...interface{})\n```\nP same as Pln but without the line break at the end.\n\n```go\nfunc (g *Proto) Pln(str ...interface{})\n```\nPln prints the arguments to the generated output. It tries to convert all kind of types to a string. It adds a line break at the end IF there are strs to print. If the first argument is a boolean and true, the subsequent data gets printed, otherwise not.\n\n","path":"github.com/Corestoreio/pkg/util/codegen","name":"codegen","synopsis":"Package codegen generates Go, Protobuf, Flatbuffers, TypeScript, etc.","isRedistributable":true}
