entity

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ConfPath - default configuration loaction
	ConfPath string = "conf"
)

Variables

This section is empty.

Functions

func CreateDirectoryIfNotExists

func CreateDirectoryIfNotExists(path string) (string, error)

CreateDirectoryIfNotExists helps to create a dir if not exists and returns the dir path

func EnableAgentMode

func EnableAgentMode(p *string)

EnableAgentMode - basic setup for agent to run

func ExecuteCmd

func ExecuteCmd(in string) (out []byte, err error)

ExecuteCmd - helps to execute cmd at os level

func Ping

func Ping(in string) (out string)

Ping helps to validate the ping-pong echo input as "PING" output will be "PONG" else ""

func RandomString

func RandomString(n int) string

RandomString helps to generate random charactor with n length

func RandomStringWithTime

func RandomStringWithTime(n int, prefix string) string

RandomStringWithTime helps to generate random charactor with n length with time suffix

func SetupPrefix added in v0.1.4

func SetupPrefix(p *string)

SetupPrefix - basic setup for agent to run

func VerifyPasscode added in v0.1.3

func VerifyPasscode(p string) (ok bool)

VerifyPasscode helps to validate the agent passcode

Types

type Conf

type Conf interface {
	AssetPath() string
	PatchPath() string
	RollbackPath() string
}

Conf help to deal with configuration default

var C Conf

C contains all system level configurations

type Dir

type Dir interface {
	Entity
	Clean() error
	CreateFile(string, []byte) error
	CreateAndWriteFile(string, bytes.Buffer) (int64, error)
	Remove(string) error
	RemoveFile(string) error
	Scan() ([]File, error)
	Copy(to string) error
}

Dir declares the directory

func NewDir

func NewDir(path string) (Dir, error)

NewDir creates the directory struct Returns directory and error

type Entity

type Entity interface {
	Create(string) error
	Path() string
	fs.FileInfo
}

Entity helps to share os.Stat into with extra info

type File

type File interface {
	Entity
	SPath() string
	RPath() string
	IsSameFileAt(Entity, bool) (bool, error)
	Copy(Entity) error
}

File declares the directory

func NewFile

func NewFile(path, basepath string) (File, error)

NewFile creates the file struct Returns file and error

type MultiEntity

type MultiEntity []Entity

MultiEntity - new type for sorting purpose

func (MultiEntity) Len

func (f MultiEntity) Len() int

Len is part of sort.Interface.

func (MultiEntity) Less

func (f MultiEntity) Less(i, j int) bool

Less is part of sort.Interface. We use count as the value to sort by

func (MultiEntity) Swap

func (f MultiEntity) Swap(i, j int)

Swap is part of sort.Interface.

type Tar

type Tar interface {
	Tar([]string) error
	Untar(string) error
}

Tar helps to deal with tar type files

func NewTar

func NewTar(name string, ext string, path string) Tar

NewTar creates a tar object with name and extension

Jump to

Keyboard shortcuts

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