Documentation ¶
Index ¶
- Constants
- func DirExists(dirPath string) bool
- func DirIsEmpty(dirPath string) bool
- func EnsureDir(dir string) (e error)
- func ExtractRootNameFromKey(key string) string
- func FetchDirFileNames(dirPath string) (fileNames []string, e error)
- func FetchFile(filePath string) (changesetFileString string, e error)
- func FetchNonDirFileNames(dirPath string) (files []string, e error)
- func FileExists(filePath string) bool
- func FmtGoCode(filePath string) (e error)
- func FormatCode(code string) ([]byte, error)
- func FormatFieldList(src []byte, fieldList *ast.FieldList, pkgName string) (fields []string)
- func GetFuncDeclarationReceiverType(fd *ast.FuncDecl) (expr ast.Expr, e error)
- func GetReceiverTypeName(src []byte, fl interface{}) (name string, funcDef *ast.FuncDecl)
- func HashFileMd5(filePath string) (string, error)
- func HashStringMd5(s string) string
- func ReadCliInput(reader *bufio.Reader, title string) string
- func RunCommand(name string, args ...string) (stdout string, stderr string, exitCode int)
- func WriteGoCodeToFile(goCode string, filePath string) (e error)
- func WriteSQLToLog(sql string) error
- type CLITable
- type ChangeFile
- type Changeset
- type Command
- type Config
- type ConfigDatabase
- type Controller
- type ControllerRoute
- type ControllerRouteParam
- type ControllerRouteQuery
- type DatabaseType
- type DocRoute
- type DocRouteParam
- type DocRouteQuery
- type Files
- func (f *Files) BuildChangeFile(sqlPath string, ordinal int) (changeFile *ChangeFile, e error)
- func (f *Files) BuildChangeFiles(sqlPaths []string) (changeFiles []ChangeFile, e error)
- func (f *Files) FetchLocalChangesetList(rootPath string) (sqlPaths []string, e error)
- func (f *Files) ScanDir(rootPath string, extension string) (paths []string, e error)
- type GoFileImports
- type GoStruct
- type GoStructField
- type GoStructFieldTag
- type GoStructFields
- type GoStructMethod
- type GoStructMethods
- type Method
- type Options
- type ParsedStruct
- type RoutesJSONContainer
Constants ¶
const ( DefaultShard = 0 MetaDirectory = ".dvc" PermissionsFile = ".dvc/permissions.json" CorePermissionsFile = "core/permissions.json" SettingsFile = ".dvc/settings.json" CoreSettingsFile = "core/settings.json" ConfigFilePath = ".dvc/config.json" SchemasFilePath = ".dvc/schemas.json" CoreSchemasFilePath = "core/schemas.json" CoreSchemasName = "core" CoreSchemasLogName = "core_log" ChangeFilePath = ".dvc/changes.log" TablesCacheFilePath = ".dvc/tables-cache.json" RoutesFilePath = ".dvc/routes.json" ModelsDir = "models" ModelsGenDir = "gen/definitions/models" IntegrationsDir = "integrations" DALsDir = "dals" // Generated Go file containing constants for all route permissions GoPermissionsPath = "gen/permissions" )
const ( // OptLogInfo triggers verbose logging OptLogInfo = 1 << iota // OptLogDebug triggers extremely verbose logging OptLogDebug // OptSilent suppresses all logging OptSilent // OptReverse reverses the function OptReverse // OptSummary shows a summary of the actions instead of a raw stdout dump OptSummary // OptClean cleans OptClean // OptForce forces OptForce )
Variables ¶
This section is empty.
Functions ¶
func DirIsEmpty ¶
func ExtractRootNameFromKey ¶
func FetchDirFileNames ¶
FetchDirFileNames fetches returns a slice of strings of the name of the directories in a directory (non-recursive)
func FetchNonDirFileNames ¶
FetchNonDirFileNames returns a list of files in a directory that are only regular files
func FileExists ¶
func FormatFieldList ¶
FormatFieldList returns a list of formatted list of fields
func GetFuncDeclarationReceiverType ¶
GetFuncDeclarationReceiverType returns the receiver type of a function declaration
func GetReceiverTypeName ¶
GetReceiverTypeName returns the name of the receiver type and the declaration
func HashFileMd5 ¶
HashFileMd5 returns an MD5 checksum of the file at `filePath`
func HashStringMd5 ¶
HashStringMd5 genereates an MD5 hash of a string
func RunCommand ¶
RunCommand runs a system command
func WriteGoCodeToFile ¶
WriteGoCodeToFile writes a string of golang code to a file and then formats it with `go fmt`
func WriteSQLToLog ¶
Types ¶
type CLITable ¶
type CLITable struct {
// contains filtered or unexported fields
}
func NewCLITable ¶
type ChangeFile ¶
type ChangeFile struct { ID int64 DateCreated int64 Hash string Name string DVCSetID int64 IsRun bool IsDeleted bool Content string FullPath string Ordinal int }
ChangeFile represents both a physical file on the local file system along with the entry in the changefile database
type Changeset ¶
type Changeset struct { ChangeFiles map[string]ChangeFile Signature string }
Changeset represents all of the changes in an environment and their changes
type Config ¶
type Config struct { ChangeSetPath string `json:"changesetPath"` BasePackage string `json:"basePackage"` Databases []*ConfigDatabase `json:"Databases"` TypescriptModelsPath string `json:"TypescriptModelsPath"` TypescriptDTOsPath string `json:"TypescriptDTOsPath"` TypescriptAggregatesPath string `json:"TypescriptAggregatesPath"` TypescriptPermissionsPath string `json:"TypescriptPermissionsPath"` TypescriptRoutesPath string `json:"TypescriptRoutesPath"` Packages struct { Cache string `json:"cache"` Models string `json:"models"` Schema string `json:"schema"` Repos string `json:"repos"` Services string `json:"services"` API string `json:"api"` } `json:"packages"` Dirs struct { Dals string `json:"dals"` DalInterfaces string `json:"dalInterfaces"` Repos string `json:"repos"` Cache string `json:"cache"` Models string `json:"models"` Integrations string `json:"integrations"` IntegrationInterfaces string `json:"integrationInterfaces"` Aggregates string `json:"aggregates"` Schema string `json:"schema"` Typescript string `json:"typescript"` Services string `json:"services"` ServiceInterfaces string `json:"serviceInterfaces"` Controllers string `json:"controllers"` API string `json:"api"` Permissions string `json:"permissions"` } `json:"dirs"` }
Config contains a set of configuration values used throughout the application
type ConfigDatabase ¶
type ConfigDatabase struct { Key string `json:"key"` Type string `json:"type"` User string `json:"user"` Pass string `json:"pass"` Host string `json:"host"` Name string `json:"name"` Enums []string `json:"enums"` OneToMany map[string]string `json:"onetomany"` OneToOne map[string]string `json:"onetoone"` ManyToOne map[string]string `json:"manytoone"` }
func GetDatabasesByRootName ¶
func GetDatabasesByRootName(rootName string, config *Config) []*ConfigDatabase
GetDatabaseByName gets all databases that have the name of `name` as the base and includes shards with `_[shardNo]` as the suffix.
type Controller ¶ added in v1.8.23
type Controller struct { Name string `json:"Name"` Description string `json:"Description"` Path string `json:"-"` Routes []*ControllerRoute `json:"Routes"` HasDTOsImport bool `json:"-"` HasResponseImport bool `json:"-"` PermCount int `json:"-"` Package string `json:"Package"` }
Controller represents a REST controller
type ControllerRoute ¶ added in v1.8.23
type ControllerRoute struct { Name string `json:"Name"` Description string `json:"Description"` Raw string `json:"Path"` Path string `json:"-"` Method string `json:"Method"` Params []ControllerRouteParam `json:"Params"` Queries []ControllerRouteQuery `json:"Queries"` IsAuth bool `json:"IsAuth"` BodyType string `json:"BodyType"` BodyFormat string `json:"BodyFormat"` HasBody bool `json:"HasBody"` ResponseType string `json:"ResponseType"` ResponseFormat string `json:"ResponseFormat"` ResponseCode int `json:"ResponseCode"` Permission string `json:"Permission"` ControllerName string `json:"ControllerName"` FileName string `json:"FileName"` LineNo int `json:"LineNo"` }
ControllerRoute represents a route inside a REST controller
type ControllerRouteParam ¶ added in v1.8.23
ControllerRouteParam represents a param inside a controller route
type ControllerRouteQuery ¶ added in v1.8.23
type ControllerRouteQuery struct { Name string Pattern string Type string VariableName string ValueRaw string }
ControllerRouteQuery represents a query inside a controller route
type DatabaseType ¶
type DatabaseType string
DatabaseType is the type of database to be used.
const ( // DatabaseTypeMysql is the MySQL flavor of database DatabaseTypeMysql DatabaseType = "mysql" )
type DocRoute ¶ added in v1.8.23
type DocRoute struct { Name string Description string Method string Path string HasBody bool BodyType string BodyFormat string ResponseType string ResponseFormat string ResponseCode int }
DocRoute is a route in the documentation
type DocRouteParam ¶ added in v1.8.23
DocRouteParam represents a parameter inside a route for documentation
type DocRouteQuery ¶ added in v1.8.23
DocRouteQuery represents a query inside a route for documentation
type Files ¶
type Files struct { }
Files contains functionality pertaining to files
func (*Files) BuildChangeFile ¶
func (f *Files) BuildChangeFile(sqlPath string, ordinal int) (changeFile *ChangeFile, e error)
BuildChangeFile builds a changeFile object based on a path and an ordinal
func (*Files) BuildChangeFiles ¶
func (f *Files) BuildChangeFiles(sqlPaths []string) (changeFiles []ChangeFile, e error)
BuildChangeFiles returns a collection of ChangeFile objects based on a collection of sql paths
func (*Files) FetchLocalChangesetList ¶
FetchLocalChangesetList gets the contents of the changesets.json file and returns a collection of paths ([]string)
type GoFileImports ¶
type GoFileImports []string
GoFileImports is a collection of imports for a model file
func (*GoFileImports) Append ¶
func (i *GoFileImports) Append(m string)
Append adds to the collection of imports
func (*GoFileImports) Get ¶
func (i *GoFileImports) Get(idx int) string
Get returns an import at an index
func (*GoFileImports) Len ¶
func (i *GoFileImports) Len() int
Len returns the length of the collection of imports
func (*GoFileImports) ToString ¶
func (i *GoFileImports) ToString() string
ToString returns a string representation of imports on a go file
type GoStruct ¶
type GoStruct struct { Package string Name string Fields *GoStructFields Methods *GoStructMethods Comments string Imports *GoFileImports }
GoStruct represents a model struct
type GoStructField ¶
type GoStructField struct { Name string DataType string Tags []*GoStructFieldTag Comments string }
GoStructField is a field on a Model struct
func (*GoStructField) ToString ¶
func (m *GoStructField) ToString() string
ToString returns a tring representation of a go struct field
type GoStructFieldTag ¶
GoStructFieldTag is a tag on a field on a model struct
func (*GoStructFieldTag) ToString ¶
func (t *GoStructFieldTag) ToString() string
ToString returns a string representation of a go struct field tag
type GoStructFields ¶
type GoStructFields []*GoStructField
GoStructFields is a collection of a go struct fields
func (*GoStructFields) Append ¶
func (i *GoStructFields) Append(m *GoStructField)
Append adds to the collection of imports
func (*GoStructFields) Get ¶
func (i *GoStructFields) Get(idx int) *GoStructField
Get returns an import at an index
func (*GoStructFields) Len ¶
func (i *GoStructFields) Len() int
Len returns the length of the collection of imports
type GoStructMethod ¶
GoStructMethod is a method on a struct
type GoStructMethods ¶
type GoStructMethods []*GoStructMethod
GoStructMethods is a collection of go methods on a struct
func (*GoStructMethods) Append ¶
func (g *GoStructMethods) Append(m *GoStructMethod)
Append adds a new struct to the struct collection
func (*GoStructMethods) Get ¶
func (g *GoStructMethods) Get(index int) (m *GoStructMethod)
Get gets a struct at index
type Method ¶
Method describes code and Documents for a method
type ParsedStruct ¶ added in v1.8.48
func ParseStruct2 ¶ added in v1.8.48
func ParseStruct2(filePath string) (*ParsedStruct, error)
type RoutesJSONContainer ¶ added in v1.8.23
type RoutesJSONContainer struct { Routes map[string]*ControllerRoute `json:"routes"` DTOs map[string]map[string]string `json:"dtos"` Models map[string]map[string]string `json:"models"` Aggregates map[string]map[string]string `json:"aggregates"` Constants map[string][]string `json:"constants"` }
RoutesJSONContainer is a container for JSON Routes