ciutil

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: AGPL-3.0 Imports: 7 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAndCreateDirectory

func CheckAndCreateDirectory(path string, mode os.FileMode) error

CheckAndCreateDirectory checks if the directory exists in path . Creates if it does not exist

func Copy

func Copy(src io.ReadCloser, w io.Writer) error

Copy copies the data from readCloser to the writer

func OnCreateNewFile

func OnCreateNewFile(localFile string, fnOnCreate OnWriterFunc) error

OnCreateNewFile creates a new file and performs an operation on the same

func OnReadClose

func OnReadClose(reader io.ReadCloser, fnOnReadClose OnReadCloseFunc) error

OnReadClose closes a given reader in that function

func OnReadEntireFile

func OnReadEntireFile(localFile string, fnOnBytes OnBytesFunc) error

OnReadEntireFile reads the entire file and processes the same

func OnTempDirectory

func OnTempDirectory(dir string, prefix string, fnOnDir OnDirFunc) (string, error)

OnTempDirectory creates a temp directory and provides the same for using it

func ToSet

func ToSet(myList []string) []string

ToSet converts a list of string to a set of string

func WriteString

func WriteString(writer io.Writer, s string) error

WriteString writes a given string

func WriteStringln

func WriteStringln(writer io.Writer, s string) error

WriteStringln writes a given string with new line

func WriteStrings

func WriteStrings(writer io.Writer, s []string) error

WriteStrings writes an array of strings separated by newline

func WriteTarFile

func WriteTarFile(inputDirectory string, w io.Writer) error

WriteTarFile writes the given inputDirectory to the underlying tar writer

Types

type OnBytesFunc

type OnBytesFunc func(b []byte) error

OnBytesFunc represents a function to act on the bytes

type OnDirFunc

type OnDirFunc func(inDir string) error

OnDirFunc represents a function to act on a given directory

type OnGenericFunc

type OnGenericFunc func() error

OnGenericFunc represents a function that returns an error or otherwise

type OnProfileFunc

type OnProfileFunc func(profile *Profile) error

OnProfileFunc is a function executed on the receipt of a given profile

type OnReadCloseFunc

type OnReadCloseFunc func(reader io.ReadCloser) error

OnReadCloseFunc represents a func to act on a given io.ReadCloser instance and closes the same

type OnWriterFunc

type OnWriterFunc func(w io.Writer) error

OnWriterFunc represents a function to act on a writer

type Profile

type Profile struct {
	Name string

	Begin time.Time

	End time.Time

	Duration time.Duration
}

Profile represents the start and end time of a profile

func NewProfile

func NewProfile(name string) *Profile

NewProfile creates a new profile

func RunProfile

func RunProfile(name string, fnOnGenericFunc OnGenericFunc) (*Profile, error)

RunProfile returns a profile along with the status of the function

func (*Profile) Start

func (profile *Profile) Start()

func (*Profile) Stop

func (profile *Profile) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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