{"modulePath":"github.com/webdevops/go-sync","version":"v0.0.0-20200305181540-9bb75832f780","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package sync\n\n## Variables\n\n```go\nvar (\n\tLogger *logger.SyncLogger\n)\n```\n\n## Functions\n\n```go\nfunc CreateTempfile() *os.File\n```\n\n```go\nfunc CreateTempfileWithContent(content ...string) *os.File\n```\n\n```go\nfunc FileExists(name string) bool\n```\n\n```go\nfunc PathExists(name string) bool\n```\n\n```go\nfunc RsyncPath(name string) string\n```\n\n```go\nfunc ShellErrorHandler(recover interface{})\n```\n\n## Types\n\n```go\ntype Database struct {\n\t// Type of database (either mysql or postgres)\n\tType string `yaml:\"type\"`\n\t// Database name on remote database server\n\tDb string `yaml:\"database\"`\n\t// Hostname of remote database server\n\tHostname string `yaml:\"hostname\"`\n\t// Port of remote database server\n\tPort string `yaml:\"port\"`\n\t// Username of remote database server\n\tUser string `yaml:\"user\"`\n\t// Password of remote database server\n\tPassword string `yaml:\"password\"`\n\n\t// Table filter\n\tFilter Filter `yaml:\"filter\"`\n\t// Connection for database sync (optional, default is Server connection)\n\tConnection *YamlCommandBuilderConnection `yaml:\"connection\"`\n\t// Database options\n\tOptions DatabaseOptions `yaml:\"options\"`\n\n\tLocal struct {\n\t\t// Database name on local database server\n\t\tDb string `yaml:\"database\"`\n\t\t// Hostname of local database server\n\t\tHostname string `yaml:\"hostname\"`\n\t\t// Port of local database server\n\t\tPort string `yaml:\"port\"`\n\t\t// Username of local database server\n\t\tUser string `yaml:\"user\"`\n\t\t// Password of local database server\n\t\tPassword string `yaml:\"password\"`\n\n\t\t// Connection for database sync (optional, default is empty)\n\t\tConnection *YamlCommandBuilderConnection `yaml:\"connection\"`\n\n\t\t// Database options\n\t\tOptions DatabaseOptions `yaml:\"options\"`\n\t} `yaml:\"local\"`\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (database *Database) ApplyDefaults(server *Server)\n```\n\n```go\nfunc (database *Database) Deploy()\n```\n\n```go\nfunc (database *Database) GetMysql() DatabaseMysql\n```\n\n```go\nfunc (database *Database) GetPostgres() DatabasePostgres\n```\n\n```go\nfunc (database *Database) GetType() (dbtype string)\n```\n\n```go\nfunc (database *Database) String(direction string) string\n```\n\n```go\nfunc (database *Database) Sync()\n```\n\n```go\ntype DatabaseMysql struct {\n\tDatabase\n}\n```\n\n```go\ntype DatabaseOptions struct {\n\t// Clear database with DROP/CREATE before sync\n\tClearDatabase bool `yaml:\"clear-database\"`\n\t// Arguments for mysqldump command\n\tMysqldump *YamlStringArray `yaml:\"mysqldump\"`\n\t// Arguments for mysql command\n\tMysql *YamlStringArray `yaml:\"mysql\"`\n\t// Arguments for pgdump command\n\tPgdump *YamlStringArray `yaml:\"pgdump\"`\n\t// Arguments for psql command\n\tPsql *YamlStringArray `yaml:\"psql\"`\n}\n```\n\n```go\ntype DatabasePostgres struct {\n\tDatabase\n}\n```\n\n```go\ntype EnvironmentVar struct {\n\t// Name of variable\n\tName string `yaml:\"name\"`\n\t// Value of variable\n\tValue string `yaml:\"value\"`\n}\n```\n\n```go\ntype Execution struct {\n\t// Type of execution (remote or local)\n\tType string `yaml:\"type\"`\n\t// Command as string or as elements\n\tCommand YamlStringArray `yaml:\"command\"`\n\t// Workdir for execution\n\tWorkdir string `yaml:\"workdir\"`\n\n\t// Environment variables\n\tEnvironment []EnvironmentVar `yaml:\"environment\"`\n\n\t// Execution options\n\tOptions struct {\n\t} `yaml:\"options\"`\n}\n```\n\n```go\nfunc (execution *Execution) Execute(server *Server)\n```\n\n```go\nfunc (execution *Execution) GetType() (execType string)\n```\nGet execution type (local or remote)\n\n```go\nfunc (execution *Execution) String(server *Server) string\n```\n\n```go\ntype Filesystem struct {\n\t// Remove path\n\tPath string `yaml:\"path\"`\n\t// Local path (optional)\n\tLocal string `yaml:\"local\"`\n\t// Filter\n\tFilter Filter `yaml:\"filter\"`\n\t// Connection for filesystem sync (optional, default is Server connection)\n\tConnection *YamlCommandBuilderConnection `yaml:\"connection\"`\n\tOptions    FilesystemOptions             `yaml:\"options\"`\n}\n```\n\n```go\nfunc (filesystem *Filesystem) ApplyDefaults(server *Server)\n```\n\n```go\nfunc (filesystem *Filesystem) Deploy()\n```\nGeneral sync\n\n```go\nfunc (filesystem *Filesystem) String(direction string) string\n```\n\n```go\nfunc (filesystem *Filesystem) Sync()\n```\nGeneral sync\n\n```go\nfunc (filesystem *Filesystem) SyncStubs()\n```\nGeneral sync\n\n```go\ntype FilesystemOptions struct {\n\t// Generate stubs (small example files) instead of fetching files from remote\n\tGenerateStubs bool `yaml:\"generate-stubs\"`\n\t// Arguments for psql command\n\tRsync *YamlStringArray `yaml:\"rsync\"`\n}\n```\n\n```go\ntype Filter struct {\n\t// Exclude as strings (regexp)\n\tExclude []string `yaml:\"exclude\"`\n\n\t// Includes as strings (regexp)\n\tInclude []string `yaml:\"include\"`\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (filter *Filter) ApplyFilter(lines []string) []string\n```\nApply filter (exclude/include) and get filtered list\n\n```go\nfunc (filter *Filter) CalcExcludes(lines []string) []string\n```\nApply exclude filter only and get filtered excludes\n\n```go\nfunc (filter *Filter) CalcIncludes(lines []string) []string\n```\nApply includes filter only and get filtered includes\n\n```go\ntype RunConfiguration struct {\n\t// Enable database sync\n\tDatabase bool\n\t// Enable filesystem sync\n\tFilesystem bool\n\t// Enable exec runner\n\tExec bool\n}\n```\n\n```go\ntype Server struct {\n\t// General working path (for filesystem syncs)\n\tPath string `yaml:\"path\"`\n\t// General connection (default for all remote connections)\n\tConnection *YamlCommandBuilderConnection `yaml:\"connection\"`\n\t// Filesystem sync list\n\tFilesystem []Filesystem `yaml:\"filesystem\"`\n\t// Database sync list\n\tDatabase []Database `yaml:\"database\"`\n\t// Startup execution list (executed before sync)\n\tExecStartup []Execution `yaml:\"exec-startup\"`\n\t// Finish execution list (executed after sync)\n\tExecFinish []Execution `yaml:\"exec-finish\"`\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (server *Server) AsYaml() string\n```\n\n```go\nfunc (server *Server) Deploy()\n```\n\n```go\nfunc (server *Server) DeployDatabases()\n```\n\n```go\nfunc (server *Server) DeployFilesystem()\n```\n\n```go\nfunc (server *Server) GetExecByWhen(when string) []Execution\n```\n\n```go\nfunc (server *Server) GetLocalPath() string\n```\n\n```go\nfunc (server *Server) Init()\n```\n\n```go\nfunc (server *Server) RunExec(when string)\n```\n\n```go\nfunc (server *Server) SetRunConfiguration(conf RunConfiguration)\n```\n\n```go\nfunc (server *Server) Sync()\n```\n\n```go\nfunc (server *Server) SyncDatabases()\n```\n\n```go\nfunc (server *Server) SyncFilesystem()\n```\n\n```go\ntype SyncConfig struct {\n\t// Sync (remote -\u003e local) configurations\n\tSync map[string]Server `yaml:\"sync\"`\n\t// Deploy (local -\u003e remote) configurations\n\tDeploy map[string]Server `yaml:\"deploy\"`\n}\n```\n\n```go\nfunc NewConfigParser(file string) (config *SyncConfig)\n```\n\n```go\nfunc (config *SyncConfig) GetDeployServer(serverName string) (Server, error)\n```\n\n```go\nfunc (config *SyncConfig) GetServerList(confType string) (list []string)\n```\n\n```go\nfunc (config *SyncConfig) GetSyncServer(serverName string) (Server, error)\n```\n\n```go\nfunc (config *SyncConfig) ListServer() (list map[string][]string)\n```\nList all possible server configurations\n\n```go\nfunc (config *SyncConfig) ShowConfiguration()\n```\nShow all possible server configurations in an human readable style\n\n```go\ntype YamlCommandBuilderArgument struct {\n\tcommandbuilder.Argument\n}\n```\n\n```go\nfunc (ysa *YamlCommandBuilderArgument) String() string\n```\n\n```go\nfunc (yarg *YamlCommandBuilderArgument) UnmarshalYAML(unmarshal func(interface{}) error) error\n```\n\n```go\ntype YamlCommandBuilderConnection struct {\n\tType   string\n\tSsh    *YamlCommandBuilderArgument\n\tDocker *YamlCommandBuilderArgument\n\n\tEnvironment *map[string]string\n\tWorkdir     string\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (yconn *YamlCommandBuilderConnection) Clone() (conn *YamlCommandBuilderConnection)\n```\nClone yaml connection (without shell connection instance)\n\n```go\nfunc (yconn *YamlCommandBuilderConnection) GetInstance() *commandbuilder.Connection\n```\nGet (or create) connection instance will be cached one it's created\n\n```go\nfunc (yconn *YamlCommandBuilderConnection) IsEmpty() (status bool)\n```\nChecks if connection is empty\n\n```go\ntype YamlStringArray struct {\n\tMulti  []string\n\tSingle string\n}\n```\n\n```go\nfunc (ysa *YamlStringArray) Array() (command []string)\n```\n\n```go\nfunc (ysa *YamlStringArray) String() string\n```\n\n```go\nfunc (ysa *YamlStringArray) ToString(sep string) string\n```\n\n```go\nfunc (ysa *YamlStringArray) UnmarshalYAML(unmarshal func(interface{}) error) error\n```\n\n","path":"github.com/webdevops/go-sync/sync","name":"sync","synopsis":"","isRedistributable":true}
