Documentation ¶
Overview ¶
Package util provides utility methods for performing operations which are used throughout impendulo such as io, type conversion and logging.
Index ¶
- Constants
- func AddToZip(zw *zip.Writer, n string, d []byte) error
- func BaseDir() (string, error)
- func CalcTime(s string) (time.Time, error)
- func ComputeHash(p, s string) string
- func CookieKeys() ([]byte, []byte, error)
- func Copy(d, s string) error
- func CopyFile(d, s string) error
- func CurMilis() int64
- func Date(m int64) string
- func EqualsOne(i interface{}, as ...interface{}) bool
- func Exists(p string) bool
- func Extension(n string) (string, string)
- func ExtractBytes(zf *zip.File) ([]byte, error)
- func ExtractFile(zf *zip.File, d string) error
- func GenString(n int) string
- func GetMilis(t time.Time) int64
- func GetPackage(r io.Reader) string
- func GetTime(m int64) time.Time
- func Hash(p string) (string, string)
- func InstallPath() (string, error)
- func IsDir(p string) bool
- func IsExec(p string) bool
- func IsFile(p string) bool
- func JSON(i interface{}) ([]byte, error)
- func LoadMap(n string) (map[bson.ObjectId]bool, error)
- func Log(v ...interface{})
- func LogDir() (string, error)
- func Max(a, b int) int
- func Min(a, b int) int
- func ReadBytes(r io.Reader) []byte
- func ReadData(r io.Reader) ([]byte, error)
- func ReadJSON(r io.Reader) (map[string]interface{}, error)
- func RemoveAll(c string, symbols ...string) string
- func RemoveEmpty(c string) string
- func Round(x float64, prec int) float64
- func SaveFile(n string, d []byte) error
- func SaveMap(m map[bson.ObjectId]bool, n string) error
- func SaveTemp(d []byte) (string, error)
- func SetErrorLogging(s string)
- func SetInfoLogging(s string)
- func ShortName(n string) string
- func SplitTitles(titles string) []string
- func Title(s string) string
- func Unzip(d string, p []byte) error
- func UnzipKV(w KVWriter, d []byte) error
- func UnzipToMap(d []byte) (map[string][]byte, error)
- func Validate(h, s, p string) bool
- func WriteJSON(w io.Writer, i interface{}) error
- func ZipKV(r KVReader) ([]byte, error)
- func ZipMap(m map[string][]byte) ([]byte, error)
- type E
- type KVReader
- type KVWriter
- type Logger
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func ComputeHash ¶
ComputeHash computes the hash for a password and its salt.
func Date ¶
Date returns a string representation of the date represented by the miliseconds provided.
func EqualsOne ¶
func EqualsOne(i interface{}, as ...interface{}) bool
EqualsOne returns true if i is equal to any of the members of as.
func ExtractBytes ¶
ExtractBytes extracts data from a zip.File.
func ExtractFile ¶
ExtractFile extracts the contents of a zip.File and saves it in dir.
func GetPackage ¶
GetPackage retrieves the package name from a Java source file.
func InstallPath ¶
InstallPath retrieves the location where Impendulo is currently installed. It first checks for the IMPENDULO_PATH environment variable otherwise the install path is constructed from GOPATH and the Impendulo's package.
func ReadBytes ¶
ReadBytes reads bytes from a reader until io.EOF is encountered. If the reader can't be read an empty []byte is returned.
func RemoveEmpty ¶
RemoveEmpty removes whitespace characters from a string.
func SetErrorLogging ¶
func SetErrorLogging(s string)
SetErrorConsoleLogging sets whether errors should be logged to the console.
func SetInfoLogging ¶
func SetInfoLogging(s string)
SetInfoConsoleLogging sets whether info should be logged to the console.
func SplitTitles ¶
func UnzipToMap ¶
UnzipToMap reads the contents of a zip file into a map. Each file's path is a map key and its data is the associated value.