utils

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2018 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const Command_ExecType_Asy = 3 // 异步执行
View Source
const Command_ExecType_SyncErrorAccess = 2 // 同步执行,遇到错误继续
View Source
const Command_ExecType_SyncErrorStop = 1 // 同步执行,遇到错误停止

Variables

View Source
var StdChars = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")

Functions

func InArray

func InArray(val interface{}, array interface{}) (exists bool, index int)

in array

Types

type Codec added in v0.8.2

type Codec struct {
}

func NewCodec added in v0.8.2

func NewCodec() *Codec

func (*Codec) DecodePack added in v0.8.2

func (c *Codec) DecodePack(read io.Reader) (string, error)

func (*Codec) EncodePack added in v0.8.2

func (c *Codec) EncodePack(message []byte) ([]byte, error)

type CommandX

type CommandX struct {
}

func NewCommandX

func NewCommandX() *CommandX

func (*CommandX) Exec

func (c *CommandX) Exec(commandXParams CommandXParams) (err error)

执行命令

type CommandXParams

type CommandXParams struct {
	Path               string
	Command            string
	CommandExecType    int
	CommandExecTimeout int
}

type ConnPool

type ConnPool interface {
	Get() (conn interface{}, err error)
	Put(conn interface{})
	ReleaseAll()
	Len() (length int)
}

ConnPool to use

type File

type File struct {
}

func NewFile

func NewFile() *File

func (*File) GetFileContents

func (f *File) GetFileContents(filePath string) (content string, err error)

get file contents

func (*File) PathIsEmpty

func (f *File) PathIsEmpty(path string) bool

目录是否为空

func (*File) PathIsExists

func (f *File) PathIsExists(path string) (bool, error)

file or path is exists

type GitX

type GitX struct{}

func NewGitX

func NewGitX() *GitX

func (*GitX) Checkout

func (g *GitX) Checkout(name string, params GitXParams) (err error)

切换分支

func (*GitX) CleanBranch

func (g *GitX) CleanBranch(params GitXParams) (err error)

清除分支

func (*GitX) Clone

func (g *GitX) Clone(params GitXParams) (r *git.Repository, err error)

克隆代码

func (*GitX) CloneOptions

func (g *GitX) CloneOptions(params GitXParams) (opt git.CloneOptions, err error)

获取克隆参数

func (*GitX) CreateBranch

func (g *GitX) CreateBranch(params GitXParams) (branchShortName, branchName string, err error)

创建分支

func (*GitX) CreateBranchName

func (g *GitX) CreateBranchName(params GitXParams) (name string, err error)

创建分支名称

func (*GitX) Fetch

func (g *GitX) Fetch(params GitXParams) (r *git.Repository, err error)

拉取代码

func (*GitX) FetchOptions

func (g *GitX) FetchOptions(params GitXParams) (opt git.FetchOptions, err error)

获取拉取参数

func (*GitX) GetAuth

func (g *GitX) GetAuth(params GitXParams) (auth transport.AuthMethod, err error)

获取 auth 信息

func (*GitX) GetHash

func (g *GitX) GetHash(params GitXParams) (hash string, hashObj plumbing.Hash, r *git.Repository, ref *plumbing.Reference, err error)

获取 hash

func (*GitX) IsHTTP

func (g *GitX) IsHTTP(params GitXParams) bool

是否是 http

func (*GitX) IsNeedAuth

func (g *GitX) IsNeedAuth(params GitXParams) bool

是否需要 auth

func (*GitX) LastCommitId

func (g *GitX) LastCommitId(params GitXParams) (hash string, err error)

获取最近一次提交的 commit_id

func (*GitX) Publish

func (g *GitX) Publish(params GitXParams) (commitId string, err error)

发布代码

func (*GitX) Validate

func (g *GitX) Validate(params GitXParams) error

验证参数合法性

type GitXParams

type GitXParams struct {
	Url        string `json:"url"`
	SshKey     string `json:"ssh_key"`
	SshKeySalt string `json:"ssh_key_salt"`
	Path       string `json:"path"`
	Branch     string `json:"branch"`
	Username   string `json:"username"`
	Password   string `json:"password"`
	DirUser    string `json:"dir_user"`
}

type Str

type Str struct {
}

func NewStr

func NewStr() *Str

func (*Str) NewLenChars

func (str *Str) NewLenChars(length int, chars []byte) string

Jump to

Keyboard shortcuts

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