meta

package
v0.0.0-...-9021772 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseTemplate

func ParseTemplate(templateContent string, data interface{}) (string, error)

ParseTemplate 模板解析

Types

type File

type File struct {
	Src           string       `json:"src" yaml:"src"`
	Dest          string       `json:"dest" yaml:"dest"`
	Delete        bool         `json:"delete,omitempty" yaml:"delete,omitempty"`
	Ignores       []string     `json:"ignores,omitempty" yaml:"ignores,omitempty"`
	After         []SyncAction `json:"after,omitempty" yaml:"after,omitempty"`
	Before        []SyncAction `json:"before,omitempty" yaml:"before,omitempty"`
	Error         []SyncAction `json:"error,omitempty" yaml:"error,omitempty"`
	SkipWhenError bool         `json:"skip_when_error,omitempty" yaml:"skip_when_error,omitempty"`
}

File 一个待同步的文件

type FileNeedSync

type FileNeedSync struct {
	SaveFilePath string
	SyncOwner    bool
	SyncFile     bool
	Chmod        bool
	Delete       bool
	Type         protocol.Type
	RemoteFile   *protocol.File
}

func (FileNeedSync) NeedSync

func (fns FileNeedSync) NeedSync() bool

type FileNeedSyncs

type FileNeedSyncs struct {
	Files []FileNeedSync
}

func (*FileNeedSyncs) Add

func (fns *FileNeedSyncs) Add(n FileNeedSync)

func (*FileNeedSyncs) All

func (fns *FileNeedSyncs) All() []FileNeedSync

type FileSyncGroup

type FileSyncGroup struct {
	Name  string `json:"name" yaml:"name"`
	Files []File `json:"files" yaml:"files"`

	From   string       `json:"from,omitempty" yaml:"from,omitempty"`
	Token  string       `json:"token,omitempty" yaml:"token,omitempty"`
	Rules  []Rule       `json:"rules,omitempty" yaml:"rules,omitempty"`
	Before []SyncAction `json:"before,omitempty" yaml:"before,omitempty"`
	After  []SyncAction `json:"after,omitempty" yaml:"after,omitempty"`
	Error  []SyncAction `json:"error,omitempty" yaml:"error,omitempty"`
}

FileSyncGroup 文件同步组

func (*FileSyncGroup) Decode

func (fsg *FileSyncGroup) Decode(data []byte) error

func (*FileSyncGroup) Encode

func (fsg *FileSyncGroup) Encode() []byte

type GlobalFileSyncSetting

type GlobalFileSyncSetting struct {
	From   string       `json:"from,omitempty" yaml:"from,omitempty"`
	Token  string       `json:"token,omitempty" yaml:"token,omitempty"`
	Before []SyncAction `json:"before,omitempty" yaml:"before,omitempty"`
	After  []SyncAction `json:"after,omitempty" yaml:"after,omitempty"`
	Errors []SyncAction `json:"errors,omitempty" yaml:"errors,omitempty"`
	Relays []SyncRelay  `json:"relays,omitempty" yaml:"relays,omitempty"`
}

GlobalFileSyncSetting global file sync settings

func NewGlobalFileSyncSetting

func NewGlobalFileSyncSetting() *GlobalFileSyncSetting

func (*GlobalFileSyncSetting) Decode

func (gfs *GlobalFileSyncSetting) Decode(data []byte) error

func (*GlobalFileSyncSetting) Encode

func (gfs *GlobalFileSyncSetting) Encode() []byte

type Rule

type Rule struct {
	Action  string `json:"action,omitempty" yaml:"action,omitempty"`
	Match   string `json:"match,omitempty" yaml:"match,omitempty"`
	Replace string `json:"replace,omitempty" yaml:"replace,omitempty"`
	Command string `json:"command,omitempty" yaml:"command,omitempty"`
	Src     string `json:"src,omitempty" yaml:"src,omitempty"`
}

Rule 规则

type SyncAction

type SyncAction struct {
	Action string `json:"action,omitempty" yaml:"action,omitempty"`
	When   string `json:"when,omitempty" yaml:"when,omitempty"`

	// --- command ---
	Command       string `json:"command,omitempty" yaml:"command,omitempty"`
	ParseTemplate bool   `json:"parse_template,omitempty" yaml:"parse_template,omitempty"`
	Timeout       string `json:"timeout,omitempty" yaml:"timeout,omitempty"`

	// --- dingding ---
	Body  string `json:"body,omitempty" yaml:"body,omitempty"`
	Token string `json:"token,omitempty" yaml:"token,omitempty"`
}

SyncAction 文件同步前置后置任务

type SyncRelay

type SyncRelay struct {
	From  string   `json:"from,omitempty" yaml:"from,omitempty"`
	Token string   `json:"token,omitempty" yaml:"token,omitempty"`
	Names []string `json:"names" yaml:"names"`
}

type SyncUnit

type SyncUnit struct {
	Files      []*protocol.File
	FileToSync File
}

SyncUnit 一个同步组中的一个文件同步

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL