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 DatabaseType
- 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
Constants ¶
const ( DefaultShard = 0 MetaDirectory = ".dvc" PermissionsFile = ".dvc/permissions.json" ConfigFilePath = ".dvc/config.json" SchemasFilePath = ".dvc/schemas.json" ChangeFilePath = ".dvc/changes.log" TablesCacheFilePath = ".dvc/tables-cache.json" RoutesFilePath = ".dvc/routes.json" ModelsDir = "models" IntegrationsDir = "integrations" DALsDir = "dals" )
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"` 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 DatabaseType ¶
type DatabaseType string
DatabaseType is the type of database to be used.
const ( // DatabaseTypeMysql is the MySQL flavor of database DatabaseTypeMysql DatabaseType = "mysql" // DatabaseTypeSqlite is the Sqlite flavor of database DatabaseTypeSqlite DatabaseType = "sqlite" )
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