Functions

This is the standard library of functions available to mgmt users when writing mcl.

  • concat (Concat) View Source


    Concat concatenates two strings together.

    Signature:

    func(a str, b str) str

  • contains (ContainsFunc) View Source


    ContainsFunc returns true if a value is found in a list. Otherwise false.

    Signature:

    func(needle ?1, haystack []?1) bool

  • convert.format_bool (FormatBool) View Source


    FormatBool converts a boolean to a string representation that can be consumed by ParseBool. This value will be `"true"` or `"false"`.

    Signature:

    func(a bool) str

  • convert.int_to_str (IntToStr) View Source


    IntToStr converts an integer to a string.

    Signature:

    func(a int) str

  • convert.parse_bool (ParseBool) View Source


    ParseBool parses a bool string and returns a boolean. It errors if you pass it an invalid value. Valid values match what is accepted by the golang strconv.ParseBool function. It's recommended to use the strings `true` or `false` if you are undecided about what string representation to choose.

    Signature:

    func(a str) bool

  • convert.to_float (ToFloat) View Source


    ToFloat converts an integer to a float.

    Signature:

    func(a int) float

  • convert.to_int (ToInt) View Source


    ToInt converts a float to an integer.

    Signature:

    func(a float) int

  • datetime.format (Format) View Source


    Format returns returns a textual representation of the input time. The format has to be defined like specified by the golang "time" package. The time is the number of seconds since the epoch, and matches what comes from our Now function. Golang documentation: https://golang.org/pkg/time/#Time.Format

    Signature:

    func(a int, b str) str

  • datetime.hour (Hour) View Source


    Hour returns the hour of the day corresponding to the input time. The time is the number of seconds since the epoch, and matches what comes from our Now function.

    Signature:

    func(a int) int

  • datetime.now (DateTimeFact) View Source


    DateTimeFact is a fact which returns the current date and time.

    Signature:

    func() int

  • datetime.print (Print) View Source


    Print takes an epoch int and returns a string in unix format.

    Signature:

    func(a int) str

  • datetime.weekday (Weekday) View Source


    Weekday returns the lowercased day of the week corresponding to the input time. The time is the number of seconds since the epoch, and matches what comes from our Now function.

    Signature:

    func(a int) str

  • deploy.abspath (AbsPathFunc) View Source


    AbsPathFunc is a function that returns the absolute, full path in the deploy from an input path that is relative to the calling file. If you pass it an empty string, you'll just get the absolute deploy directory path that you're in.

    Signature:

    func(path str) str

  • deploy.binary_path (BinaryPath) View Source


    BinaryPath returns the path to the binary of this program. This is useful for bootstrapping new machines when we want to get the path to copy it over from.

    Signature:

    func() str

  • deploy.bootstrap_packages (BootstrapPackages) View Source


    BootstrapPackages returns the list of packages corresponding to the distro for bootstrapping new machines which will need these installed before they can run mgmt.

    Signature:

    func(0 str) []str

  • deploy.get_archive (GetArchiveFunc) View Source


    GetArchiveFunc is a function that returns a tar archive with the current deploy. The result can only change with a new deploy, so this is static. which deploy to return. The output would change when the input does!

    Signature:

    func() str

  • deploy.readfile (ReadFileFunc) View Source


    ReadFileFunc is a function that reads the full contents from a file in our deploy. The file contents can only change with a new deploy, so this is static. Please note that this is different from the readfile function in the os package.

    Signature:

    func(filename str) str

  • deploy.readfileabs (ReadFileAbsFunc) View Source


    ReadFileAbsFunc is a function that reads the full contents from a file in our deploy. The file contents can only change with a new deploy, so this is static. In particular, this takes an absolute path relative to the root deploy. In general, you should use `deploy.readfile` instead. Please note that this is different from the readfile function in the os package.

    Signature:

    func(filename str) str

  • embedded/provisioner.cli_arch (func1) View Source


    Signature:

    func() str

  • embedded/provisioner.cli_bios (func1) View Source


    Signature:

    func() bool

  • embedded/provisioner.cli_distro (func1) View Source


    Signature:

    func() str

  • embedded/provisioner.cli_dns (func1) View Source


    Signature:

    func() []str

  • embedded/provisioner.cli_firewalld (func1) View Source


    Signature:

    func() bool

  • embedded/provisioner.cli_flavour (func1) View Source


    Signature:

    func() str

  • embedded/provisioner.cli_handoff_code (func1) View Source


    Signature:

    func() str

  • embedded/provisioner.cli_interface (func1) View Source


    Signature:

    func() str

  • embedded/provisioner.cli_ip (func1) View Source


    Signature:

    func() str

  • embedded/provisioner.cli_mac (func1) View Source


    Signature:

    func() str

  • embedded/provisioner.cli_mirror (func1) View Source


    Signature:

    func() str

  • embedded/provisioner.cli_network (func1) View Source


    Signature:

    func() str

  • embedded/provisioner.cli_packages (func1) View Source


    Signature:

    func() []str

  • embedded/provisioner.cli_part (func1) View Source


    Signature:

    func() str

  • embedded/provisioner.cli_password (func1) View Source


    Signature:

    func() str

  • embedded/provisioner.cli_prefix (func1) View Source


    Signature:

    func() str

  • embedded/provisioner.cli_router (func1) View Source


    Signature:

    func() str

  • embedded/provisioner.cli_rsync (func1) View Source


    Signature:

    func() str

  • embedded/provisioner.cli_version (func1) View Source


    Signature:

    func() str

  • embedded/provisioner.onlyunify (func1) View Source


    Signature:

    func() bool

  • example.answer (TheAnswerToLifeTheUniverseAndEverything) View Source


    TheAnswerToLifeTheUniverseAndEverything returns the Answer to Life, the Universe and Everything.

    Signature:

    func() int

  • example.errorbool (ErrorBool) View Source


    ErrorBool causes this function to error if you pass it true. Otherwise it returns a string reminding you how to use it.

    Signature:

    func(a bool) str

  • example.flipflop (FlipFlopFact) View Source


    FlipFlopFact is a fact which flips a bool repeatedly. This is an example fact and is not meant for serious computing. This would be better served by a flip function which you could specify an interval for.

    Signature:

    func() bool

  • example.int2str (Int2Str) View Source


    Int2Str takes an int, and returns it as a string.

    Signature:

    func(a int) str

  • example.plus (Plus) View Source


    Plus returns y + z.

    Signature:

    func(y str, z str) str

  • example.str2int (Str2Int) View Source


    Str2Int takes an str, and returns it as an int. If it can't convert it, it returns 0.

    Signature:

    func(a str) int

  • example.vumeter (VUMeterFunc) View Source


    VUMeterFunc is a gimmic function to display a vu meter from the microphone.

    Signature:

    func(symbol str, multiplier int, peak float) str

  • example/nested.hello (Hello) View Source


    Hello returns some string. This is just to test nesting.

    Signature:

    func() str

  • fmt.printf (PrintfFunc) View Source


    PrintfFunc is a static polymorphic function that compiles a format string and returns the output as a string. It bases its output on the values passed in to it. It examines the type of the arguments at compile time and then determines the static function signature by parsing the format string and using that to determine the final function signature. One consequence of this is that the format string must be a static string which is known at compile time. This is reasonable, because if it was a reactive, changing string, then we could expect the type signature to change, which is not allowed in our statically typed language.

    Signature:

    < polymorphic >

  • golang.template (TemplateFunc) View Source


    TemplateFunc is a static polymorphic function that compiles a template and returns the output as a string. It bases its output on the values passed in to it. It examines the type of the second argument (the input data vars) at compile time and then determines the static functions signature by including that in the overall signature. but only if they are not pure. We currently only use simple, pure functions.

    Signature:

    < polymorphic >

  • golang/html.escape_string (HTMLEscapeString) View Source


    HTMLEscapeString is an autogenerated function. func EscapeString(s string) string EscapeString escapes special characters like "<" to become "<". It escapes only five such characters: <, >, &, ' and ". UnescapeString(EscapeString(s)) == s always holds, but the converse isn't always true.

    Signature:

    func(s str) str

  • golang/html.unescape_string (HTMLUnescapeString) View Source


    HTMLUnescapeString is an autogenerated function. func UnescapeString(s string) string UnescapeString unescapes entities like "<" to become "<". It unescapes a larger range of entities than EscapeString escapes. For example, "á" unescapes to "á", as does "á" and "á". UnescapeString(EscapeString(s)) == s always holds, but the converse isn't always true.

    Signature:

    func(s str) str

  • golang/math.abs (MathAbs) View Source


    MathAbs is an autogenerated function. func Abs(x float64) float64 Abs returns the absolute value of x.
    Special cases are:
    Abs(±Inf) = +Inf Abs(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.acos (MathAcos) View Source


    MathAcos is an autogenerated function. func Acos(x float64) float64 Acos returns the arccosine, in radians, of x.
    Special case is:
    Acos(x) = NaN if x < -1 or x > 1

    Signature:

    func(x float) float

  • golang/math.acosh (MathAcosh) View Source


    MathAcosh is an autogenerated function. func Acosh(x float64) float64 Acosh returns the inverse hyperbolic cosine of x.
    Special cases are:
    Acosh(+Inf) = +Inf Acosh(x) = NaN if x < 1 Acosh(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.asin (MathAsin) View Source


    MathAsin is an autogenerated function. func Asin(x float64) float64 Asin returns the arcsine, in radians, of x.
    Special cases are:
    Asin(±0) = ±0 Asin(x) = NaN if x < -1 or x > 1

    Signature:

    func(x float) float

  • golang/math.asinh (MathAsinh) View Source


    MathAsinh is an autogenerated function. func Asinh(x float64) float64 Asinh returns the inverse hyperbolic sine of x.
    Special cases are:
    Asinh(±0) = ±0 Asinh(±Inf) = ±Inf Asinh(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.atan (MathAtan) View Source


    MathAtan is an autogenerated function. func Atan(x float64) float64 Atan returns the arctangent, in radians, of x.
    Special cases are:
    Atan(±0) = ±0 Atan(±Inf) = ±Pi/2

    Signature:

    func(x float) float

  • golang/math.atan_2 (MathAtan2) View Source


    MathAtan2 is an autogenerated function. func Atan2(y, x float64) float64 Atan2 returns the arc tangent of y/x, using the signs of the two to determine the quadrant of the return value.
    Special cases are (in order):
    Atan2(y, NaN) = NaN Atan2(NaN, x) = NaN Atan2(+0, x>=0) = +0 Atan2(-0, x>=0) = -0 Atan2(+0, x<=-0) = +Pi Atan2(-0, x<=-0) = -Pi Atan2(y>0, 0) = +Pi/2 Atan2(y<0, 0) = -Pi/2 Atan2(+Inf, +Inf) = +Pi/4 Atan2(-Inf, +Inf) = -Pi/4 Atan2(+Inf, -Inf) = 3Pi/4 Atan2(-Inf, -Inf) = -3Pi/4 Atan2(y, +Inf) = 0 Atan2(y>0, -Inf) = +Pi Atan2(y<0, -Inf) = -Pi Atan2(+Inf, x) = +Pi/2 Atan2(-Inf, x) = -Pi/2

    Signature:

    func(y float, x float) float

  • golang/math.atanh (MathAtanh) View Source


    MathAtanh is an autogenerated function. func Atanh(x float64) float64 Atanh returns the inverse hyperbolic tangent of x.
    Special cases are:
    Atanh(1) = +Inf Atanh(±0) = ±0 Atanh(-1) = -Inf Atanh(x) = NaN if x < -1 or x > 1 Atanh(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.cbrt (MathCbrt) View Source


    MathCbrt is an autogenerated function. func Cbrt(x float64) float64 Cbrt returns the cube root of x.
    Special cases are:
    Cbrt(±0) = ±0 Cbrt(±Inf) = ±Inf Cbrt(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.ceil (MathCeil) View Source


    MathCeil is an autogenerated function. func Ceil(x float64) float64 Ceil returns the least integer value greater than or equal to x.
    Special cases are:
    Ceil(±0) = ±0 Ceil(±Inf) = ±Inf Ceil(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.copysign (MathCopysign) View Source


    MathCopysign is an autogenerated function. func Copysign(f, sign float64) float64 Copysign returns a value with the magnitude of f and the sign of sign.

    Signature:

    func(f float, sign float) float

  • golang/math.cos (MathCos) View Source


    MathCos is an autogenerated function. func Cos(x float64) float64 Cos returns the cosine of the radian argument x.
    Special cases are:
    Cos(±Inf) = NaN Cos(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.cosh (MathCosh) View Source


    MathCosh is an autogenerated function. func Cosh(x float64) float64 Cosh returns the hyperbolic cosine of x.
    Special cases are:
    Cosh(±0) = 1 Cosh(±Inf) = +Inf Cosh(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.dim (MathDim) View Source


    MathDim is an autogenerated function. func Dim(x, y float64) float64 Dim returns the maximum of x-y or 0.
    Special cases are:
    Dim(+Inf, +Inf) = NaN Dim(-Inf, -Inf) = NaN Dim(x, NaN) = Dim(NaN, x) = NaN

    Signature:

    func(x float, y float) float

  • golang/math.erf (MathErf) View Source


    MathErf is an autogenerated function. func Erf(x float64) float64 Erf returns the error function of x.
    Special cases are:
    Erf(+Inf) = 1 Erf(-Inf) = -1 Erf(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.erfc (MathErfc) View Source


    MathErfc is an autogenerated function. func Erfc(x float64) float64 Erfc returns the complementary error function of x.
    Special cases are:
    Erfc(+Inf) = 0 Erfc(-Inf) = 2 Erfc(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.erfcinv (MathErfcinv) View Source


    MathErfcinv is an autogenerated function. func Erfcinv(x float64) float64 Erfcinv returns the inverse of Erfc(x).
    Special cases are:
    Erfcinv(0) = +Inf Erfcinv(2) = -Inf Erfcinv(x) = NaN if x < 0 or x > 2 Erfcinv(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.erfinv (MathErfinv) View Source


    MathErfinv is an autogenerated function. func Erfinv(x float64) float64 Erfinv returns the inverse error function of x.
    Special cases are:
    Erfinv(1) = +Inf Erfinv(-1) = -Inf Erfinv(x) = NaN if x < -1 or x > 1 Erfinv(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.exp (MathExp) View Source


    MathExp is an autogenerated function. func Exp(x float64) float64 Exp returns e**x, the base-e exponential of x.
    Special cases are:
    Exp(+Inf) = +Inf Exp(NaN) = NaN
    Very large values overflow to 0 or +Inf. Very small values underflow to 1.

    Signature:

    func(x float) float

  • golang/math.exp_2 (MathExp2) View Source


    MathExp2 is an autogenerated function. func Exp2(x float64) float64 Exp2 returns 2**x, the base-2 exponential of x.
    Special cases are the same as Exp.

    Signature:

    func(x float) float

  • golang/math.expm_1 (MathExpm1) View Source


    MathExpm1 is an autogenerated function. func Expm1(x float64) float64 Expm1 returns e**x - 1, the base-e exponential of x minus 1. It is more accurate than Exp(x) - 1 when x is near zero.
    Special cases are:
    Expm1(+Inf) = +Inf Expm1(-Inf) = -1 Expm1(NaN) = NaN
    Very large values overflow to -1 or +Inf.

    Signature:

    func(x float) float

  • golang/math.floor (MathFloor) View Source


    MathFloor is an autogenerated function. func Floor(x float64) float64 Floor returns the greatest integer value less than or equal to x.
    Special cases are:
    Floor(±0) = ±0 Floor(±Inf) = ±Inf Floor(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.fma (MathFMA) View Source


    MathFMA is an autogenerated function. func FMA(x, y, z float64) float64 FMA returns x * y + z, computed with only one rounding. (That is, FMA returns the fused multiply-add of x, y, and z.)

    Signature:

    func(x float, y float, z float) float

  • golang/math.gamma (MathGamma) View Source


    MathGamma is an autogenerated function. func Gamma(x float64) float64 Gamma returns the Gamma function of x.
    Special cases are:
    Gamma(+Inf) = +Inf Gamma(+0) = +Inf Gamma(-0) = -Inf Gamma(x) = NaN for integer x < 0 Gamma(-Inf) = NaN Gamma(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.hypot (MathHypot) View Source


    MathHypot is an autogenerated function. func Hypot(p, q float64) float64 Hypot returns Sqrt(p*p + q*q), taking care to avoid unnecessary overflow and underflow.
    Special cases are:
    Hypot(±Inf, q) = +Inf Hypot(p, ±Inf) = +Inf Hypot(NaN, q) = NaN Hypot(p, NaN) = NaN

    Signature:

    func(p float, q float) float

  • golang/math.ilogb (MathIlogb) View Source


    MathIlogb is an autogenerated function. func Ilogb(x float64) int Ilogb returns the binary exponent of x as an integer.
    Special cases are:
    Ilogb(±Inf) = MaxInt32 Ilogb(0) = MinInt32 Ilogb(NaN) = MaxInt32

    Signature:

    func(x float) int

  • golang/math.inf (MathInf) View Source


    MathInf is an autogenerated function. func Inf(sign int) float64 Inf returns positive infinity if sign >= 0, negative infinity if sign < 0.

    Signature:

    func(sign int) float

  • golang/math.is_inf (MathIsInf) View Source


    MathIsInf is an autogenerated function. func IsInf(f float64, sign int) bool IsInf reports whether f is an infinity, according to sign. If sign > 0, IsInf reports whether f is positive infinity. If sign < 0, IsInf reports whether f is negative infinity. If sign == 0, IsInf reports whether f is either infinity.

    Signature:

    func(f float, sign int) bool

  • golang/math.j_0 (MathJ0) View Source


    MathJ0 is an autogenerated function. func J0(x float64) float64 J0 returns the order-zero Bessel function of the first kind.
    Special cases are:
    J0(±Inf) = 0 J0(0) = 1 J0(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.j_1 (MathJ1) View Source


    MathJ1 is an autogenerated function. func J1(x float64) float64 J1 returns the order-one Bessel function of the first kind.
    Special cases are:
    J1(±Inf) = 0 J1(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.jn (MathJn) View Source


    MathJn is an autogenerated function. func Jn(n int, x float64) float64 Jn returns the order-n Bessel function of the first kind.
    Special cases are:
    Jn(n, ±Inf) = 0 Jn(n, NaN) = NaN

    Signature:

    func(n int, x float) float

  • golang/math.ldexp (MathLdexp) View Source


    MathLdexp is an autogenerated function. func Ldexp(frac float64, exp int) float64 Ldexp is the inverse of Frexp. It returns frac × 2**exp.
    Special cases are:
    Ldexp(±0, exp) = ±0 Ldexp(±Inf, exp) = ±Inf Ldexp(NaN, exp) = NaN

    Signature:

    func(frac float, exp int) float

  • golang/math.log (MathLog) View Source


    MathLog is an autogenerated function. func Log(x float64) float64 Log returns the natural logarithm of x.
    Special cases are:
    Log(+Inf) = +Inf Log(0) = -Inf Log(x < 0) = NaN Log(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.log_10 (MathLog10) View Source


    MathLog10 is an autogenerated function. func Log10(x float64) float64 Log10 returns the decimal logarithm of x. The special cases are the same as for Log.

    Signature:

    func(x float) float

  • golang/math.log_1_p (MathLog1p) View Source


    MathLog1p is an autogenerated function. func Log1p(x float64) float64 Log1p returns the natural logarithm of 1 plus its argument x. It is more accurate than Log(1 + x) when x is near zero.
    Special cases are:
    Log1p(+Inf) = +Inf Log1p(±0) = ±0 Log1p(-1) = -Inf Log1p(x < -1) = NaN Log1p(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.log_2 (MathLog2) View Source


    MathLog2 is an autogenerated function. func Log2(x float64) float64 Log2 returns the binary logarithm of x. The special cases are the same as for Log.

    Signature:

    func(x float) float

  • golang/math.logb (MathLogb) View Source


    MathLogb is an autogenerated function. func Logb(x float64) float64 Logb returns the binary exponent of x.
    Special cases are:
    Logb(±Inf) = +Inf Logb(0) = -Inf Logb(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.max (MathMax) View Source


    MathMax is an autogenerated function. func Max(x, y float64) float64 Max returns the larger of x or y.
    Special cases are:
    Max(x, +Inf) = Max(+Inf, x) = +Inf Max(x, NaN) = Max(NaN, x) = NaN Max(+0, ±0) = Max(±0, +0) = +0 Max(-0, -0) = -0
    Note that this differs from the built-in function max when called with NaN and +Inf.

    Signature:

    func(x float, y float) float

  • golang/math.min (MathMin) View Source


    MathMin is an autogenerated function. func Min(x, y float64) float64 Min returns the smaller of x or y.
    Special cases are:
    Min(x, -Inf) = Min(-Inf, x) = -Inf Min(x, NaN) = Min(NaN, x) = NaN Min(-0, ±0) = Min(±0, -0) = -0
    Note that this differs from the built-in function min when called with NaN and -Inf.

    Signature:

    func(x float, y float) float

  • golang/math.mod (MathMod) View Source


    MathMod is an autogenerated function. func Mod(x, y float64) float64 Mod returns the floating-point remainder of x/y. The magnitude of the result is less than y and its sign agrees with that of x.
    Special cases are:
    Mod(±Inf, y) = NaN Mod(NaN, y) = NaN Mod(x, 0) = NaN Mod(x, ±Inf) = x Mod(x, NaN) = NaN

    Signature:

    func(x float, y float) float

  • golang/math.na_n (MathNaN) View Source


    MathNaN is an autogenerated function. func NaN() float64 NaN returns an IEEE 754 “not-a-number” value.

    Signature:

    func() float

  • golang/math.pow (MathPow) View Source


    MathPow is an autogenerated function. func Pow(x, y float64) float64 Pow returns x**y, the base-x exponential of y.
    Special cases are (in order):
    Pow(x, ±0) = 1 for any x Pow(1, y) = 1 for any y Pow(x, 1) = x for any x Pow(NaN, y) = NaN Pow(x, NaN) = NaN Pow(±0, y) = ±Inf for y an odd integer < 0 Pow(±0, -Inf) = +Inf Pow(±0, +Inf) = +0 Pow(±0, y) = +Inf for finite y < 0 and not an odd integer Pow(±0, y) = ±0 for y an odd integer > 0 Pow(±0, y) = +0 for finite y > 0 and not an odd integer Pow(-1, ±Inf) = 1 Pow(x, +Inf) = +Inf for |x| > 1 Pow(x, -Inf) = +0 for |x| > 1 Pow(x, +Inf) = +0 for |x| < 1 Pow(x, -Inf) = +Inf for |x| < 1 Pow(+Inf, y) = +Inf for y > 0 Pow(+Inf, y) = +0 for y < 0 Pow(-Inf, y) = Pow(-0, -y) Pow(x, y) = NaN for finite x < 0 and finite non-integer y

    Signature:

    func(x float, y float) float

  • golang/math.pow_10 (MathPow10) View Source


    MathPow10 is an autogenerated function. func Pow10(n int) float64 Pow10 returns 10**n, the base-10 exponential of n.
    Special cases are:
    Pow10(n) = 0 for n < -323 Pow10(n) = +Inf for n > 308

    Signature:

    func(n int) float

  • golang/math.remainder (MathRemainder) View Source


    MathRemainder is an autogenerated function. func Remainder(x, y float64) float64 Remainder returns the IEEE 754 floating-point remainder of x/y.
    Special cases are:
    Remainder(±Inf, y) = NaN Remainder(NaN, y) = NaN Remainder(x, 0) = NaN Remainder(x, ±Inf) = x Remainder(x, NaN) = NaN

    Signature:

    func(x float, y float) float

  • golang/math.round (MathRound) View Source


    MathRound is an autogenerated function. func Round(x float64) float64 Round returns the nearest integer, rounding half away from zero.
    Special cases are:
    Round(±0) = ±0 Round(±Inf) = ±Inf Round(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.round_to_even (MathRoundToEven) View Source


    MathRoundToEven is an autogenerated function. func RoundToEven(x float64) float64 RoundToEven returns the nearest integer, rounding ties to even.
    Special cases are:
    RoundToEven(±0) = ±0 RoundToEven(±Inf) = ±Inf RoundToEven(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.signbit (MathSignbit) View Source


    MathSignbit is an autogenerated function. func Signbit(x float64) bool Signbit reports whether x is negative or negative zero.

    Signature:

    func(x float) bool

  • golang/math.sin (MathSin) View Source


    MathSin is an autogenerated function. func Sin(x float64) float64 Sin returns the sine of the radian argument x.
    Special cases are:
    Sin(±0) = ±0 Sin(±Inf) = NaN Sin(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.sinh (MathSinh) View Source


    MathSinh is an autogenerated function. func Sinh(x float64) float64 Sinh returns the hyperbolic sine of x.
    Special cases are:
    Sinh(±0) = ±0 Sinh(±Inf) = ±Inf Sinh(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.sqrt (MathSqrt) View Source


    MathSqrt is an autogenerated function. func Sqrt(x float64) float64 Sqrt returns the square root of x.
    Special cases are:
    Sqrt(+Inf) = +Inf Sqrt(±0) = ±0 Sqrt(x < 0) = NaN Sqrt(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.tan (MathTan) View Source


    MathTan is an autogenerated function. func Tan(x float64) float64 Tan returns the tangent of the radian argument x.
    Special cases are:
    Tan(±0) = ±0 Tan(±Inf) = NaN Tan(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.tanh (MathTanh) View Source


    MathTanh is an autogenerated function. func Tanh(x float64) float64 Tanh returns the hyperbolic tangent of x.
    Special cases are:
    Tanh(±0) = ±0 Tanh(±Inf) = ±1 Tanh(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.trunc (MathTrunc) View Source


    MathTrunc is an autogenerated function. func Trunc(x float64) float64 Trunc returns the integer value of x.
    Special cases are:
    Trunc(±0) = ±0 Trunc(±Inf) = ±Inf Trunc(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.y_0 (MathY0) View Source


    MathY0 is an autogenerated function. func Y0(x float64) float64 Y0 returns the order-zero Bessel function of the second kind.
    Special cases are:
    Y0(+Inf) = 0 Y0(0) = -Inf Y0(x < 0) = NaN Y0(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.y_1 (MathY1) View Source


    MathY1 is an autogenerated function. func Y1(x float64) float64 Y1 returns the order-one Bessel function of the second kind.
    Special cases are:
    Y1(+Inf) = 0 Y1(0) = -Inf Y1(x < 0) = NaN Y1(NaN) = NaN

    Signature:

    func(x float) float

  • golang/math.yn (MathYn) View Source


    MathYn is an autogenerated function. func Yn(n int, x float64) float64 Yn returns the order-n Bessel function of the second kind.
    Special cases are:
    Yn(n, +Inf) = 0 Yn(n ≥ 0, 0) = -Inf Yn(n < 0, 0) = +Inf if n is odd, -Inf if n is even Yn(n, x < 0) = NaN Yn(n, NaN) = NaN

    Signature:

    func(n int, x float) float

  • golang/math/rand.exp_float_64 (MathrandExpFloat64) View Source


    MathrandExpFloat64 is an autogenerated function. func ExpFloat64() float64 ExpFloat64 returns an exponentially distributed float64 in the range (0, +[math.MaxFloat64]] with an exponential distribution whose rate parameter (lambda) is 1 and whose mean is 1/lambda (1) from the default Source. To produce a distribution with a different rate parameter, callers can adjust the output using:
    sample = ExpFloat64() / desiredRateParameter

    Signature:

    func() float

  • golang/math/rand.float_64 (MathrandFloat64) View Source


    MathrandFloat64 is an autogenerated function. func Float64() float64 Float64 returns, as a float64, a pseudo-random number in the half-open interval [0.0,1.0) from the default Source.

    Signature:

    func() float

  • golang/math/rand.int (MathrandInt) View Source


    MathrandInt is an autogenerated function. func Int() int Int returns a non-negative pseudo-random int from the default Source.

    Signature:

    func() int

  • golang/math/rand.int_63 (MathrandInt63) View Source


    MathrandInt63 is an autogenerated function. func Int63() int64 Int63 returns a non-negative pseudo-random 63-bit integer as an int64 from the default Source.

    Signature:

    func() int

  • golang/math/rand.int_63_n (MathrandInt63n) View Source


    MathrandInt63n is an autogenerated function. func Int63n(n int64) int64 Int63n returns, as an int64, a non-negative pseudo-random number in the half-open interval [0,n) from the default Source. It panics if n <= 0.

    Signature:

    func(n int) int

  • golang/math/rand.intn (MathrandIntn) View Source


    MathrandIntn is an autogenerated function. func Intn(n int) int Intn returns, as an int, a non-negative pseudo-random number in the half-open interval [0,n) from the default Source. It panics if n <= 0.

    Signature:

    func(n int) int

  • golang/math/rand.norm_float_64 (MathrandNormFloat64) View Source


    MathrandNormFloat64 is an autogenerated function. func NormFloat64() float64 NormFloat64 returns a normally distributed float64 in the range [-math.MaxFloat64, +[math.MaxFloat64]] with standard normal distribution (mean = 0, stddev = 1) from the default Source. To produce a different normal distribution, callers can adjust the output using:
    sample = NormFloat64() * desiredStdDev + desiredMean

    Signature:

    func() float

  • golang/os.executable (OsExecutable) View Source


    OsExecutable is an autogenerated function. func Executable() (string, error) Executable returns the path name for the executable that started the current process. There is no guarantee that the path is still pointing to the correct executable. If a symlink was used to start the process, depending on the operating system, the result might be the symlink or the path it pointed to. If a stable result is needed, path/filepath.EvalSymlinks might help.
    Executable returns an absolute path unless an error occurred.
    The main use case is finding resources located relative to an executable.

    Signature:

    func() str

  • golang/os.expand_env (OsExpandEnv) View Source


    OsExpandEnv is an autogenerated function. func ExpandEnv(s string) string ExpandEnv replaces ${var} or $var in the string according to the values of the current environment variables. References to undefined variables are replaced by the empty string.

    Signature:

    func(s str) str

  • golang/os.getegid (OsGetegid) View Source


    OsGetegid is an autogenerated function. func Getegid() int Getegid returns the numeric effective group id of the caller.
    On Windows, it returns -1.

    Signature:

    func() int

  • golang/os.getenv (OsGetenv) View Source


    OsGetenv is an autogenerated function. func Getenv(key string) string Getenv retrieves the value of the environment variable named by the key. It returns the value, which will be empty if the variable is not present. To distinguish between an empty value and an unset value, use LookupEnv.

    Signature:

    func(key str) str

  • golang/os.geteuid (OsGeteuid) View Source


    OsGeteuid is an autogenerated function. func Geteuid() int Geteuid returns the numeric effective user id of the caller.
    On Windows, it returns -1.

    Signature:

    func() int

  • golang/os.getgid (OsGetgid) View Source


    OsGetgid is an autogenerated function. func Getgid() int Getgid returns the numeric group id of the caller.
    On Windows, it returns -1.

    Signature:

    func() int

  • golang/os.getpagesize (OsGetpagesize) View Source


    OsGetpagesize is an autogenerated function. func Getpagesize() int Getpagesize returns the underlying system's memory page size.

    Signature:

    func() int

  • golang/os.getpid (OsGetpid) View Source


    OsGetpid is an autogenerated function. func Getpid() int Getpid returns the process id of the caller.

    Signature:

    func() int

  • golang/os.getppid (OsGetppid) View Source


    OsGetppid is an autogenerated function. func Getppid() int Getppid returns the process id of the caller's parent.

    Signature:

    func() int

  • golang/os.getuid (OsGetuid) View Source


    OsGetuid is an autogenerated function. func Getuid() int Getuid returns the numeric user id of the caller.
    On Windows, it returns -1.

    Signature:

    func() int

  • golang/os.mkdir_temp (OsMkdirTemp) View Source


    OsMkdirTemp is an autogenerated function. func MkdirTemp(dir, pattern string) (string, error) MkdirTemp creates a new temporary directory in the directory dir and returns the pathname of the new directory. The new directory's name is generated by adding a random string to the end of pattern. If pattern includes a "*", the random string replaces the last "*" instead. The directory is created with mode 0o700 (before umask). If dir is the empty string, MkdirTemp uses the default directory for temporary files, as returned by TempDir. Multiple programs or goroutines calling MkdirTemp simultaneously will not choose the same directory. It is the caller's responsibility to remove the directory when it is no longer needed.

    Signature:

    func(dir str, pattern str) str

  • golang/os.read_file (OsReadFile) View Source


    OsReadFile is an autogenerated function. func ReadFile(name string) ([]byte, error) ReadFile reads the named file and returns the contents. A successful call returns err == nil, not err == EOF. Because ReadFile reads the whole file, it does not treat an EOF from Read as an error to be reported.

    Signature:

    func(name str) str


  • OsReadlink is an autogenerated function. func Readlink(name string) (string, error) Readlink returns the destination of the named symbolic link. If there is an error, it will be of type *PathError.
    If the link destination is relative, Readlink returns the relative path without resolving it to an absolute one.

    Signature:

    func(name str) str

  • golang/os.temp_dir (OsTempDir) View Source


    OsTempDir is an autogenerated function. func TempDir() string TempDir returns the default directory to use for temporary files.
    On Unix systems, it returns $TMPDIR if non-empty, else /tmp. On Windows, it uses GetTempPath, returning the first non-empty value from %TMP%, %TEMP%, %USERPROFILE%, or the Windows directory. On Plan 9, it returns /tmp.
    The directory is neither guaranteed to exist nor have accessible permissions.

    Signature:

    func() str

  • golang/os.user_cache_dir (OsUserCacheDir) View Source


    OsUserCacheDir is an autogenerated function. func UserCacheDir() (string, error) UserCacheDir returns the default root directory to use for user-specific cached data. Users should create their own application-specific subdirectory within this one and use that.
    On Unix systems, it returns $XDG_CACHE_HOME as specified by https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html if non-empty, else $HOME/.cache. On Darwin, it returns $HOME/Library/Caches. On Windows, it returns %LocalAppData%. On Plan 9, it returns $home/lib/cache.
    If the location cannot be determined (for example, $HOME is not defined), then it will return an error.

    Signature:

    func() str

  • golang/os.user_config_dir (OsUserConfigDir) View Source


    OsUserConfigDir is an autogenerated function. func UserConfigDir() (string, error) UserConfigDir returns the default root directory to use for user-specific configuration data. Users should create their own application-specific subdirectory within this one and use that.
    On Unix systems, it returns $XDG_CONFIG_HOME as specified by https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html if non-empty, else $HOME/.config. On Darwin, it returns $HOME/Library/Application Support. On Windows, it returns %AppData%. On Plan 9, it returns $home/lib.
    If the location cannot be determined (for example, $HOME is not defined), then it will return an error.

    Signature:

    func() str

  • golang/os.user_home_dir (OsUserHomeDir) View Source


    OsUserHomeDir is an autogenerated function. func UserHomeDir() (string, error) UserHomeDir returns the current user's home directory.
    On Unix, including macOS, it returns the $HOME environment variable. On Windows, it returns %USERPROFILE%. On Plan 9, it returns the $home environment variable.
    If the expected variable is not set in the environment, UserHomeDir returns either a platform-specific default value or a non-nil error.

    Signature:

    func() str

  • golang/os/exec.look_path (OsexecLookPath) View Source


    OsexecLookPath is an autogenerated function. func LookPath(file string) (string, error) LookPath searches for an executable named file in the directories named by the PATH environment variable. If file contains a slash, it is tried directly and the PATH is not consulted. Otherwise, on success, the result is an absolute path.
    In older versions of Go, LookPath could return a path relative to the current directory. As of Go 1.19, LookPath will instead return that path along with an error satisfying errors.Is(err, ErrDot). See the package documentation for more details.

    Signature:

    func(file str) str

  • golang/path.base (PathBase) View Source


    PathBase is an autogenerated function. func Base(path string) string Base returns the last element of path. Trailing slashes are removed before extracting the last element. If the path is empty, Base returns ".". If the path consists entirely of slashes, Base returns "/".

    Signature:

    func(path str) str

  • golang/path.clean (PathClean) View Source


    PathClean is an autogenerated function. func Clean(path string) string Clean returns the shortest path name equivalent to path by purely lexical processing. It applies the following rules iteratively until no further processing can be done:
    1. Replace multiple slashes with a single slash. 2. Eliminate each . path name element (the current directory). 3. Eliminate each inner .. path name element (the parent directory) along with the non-.. element that precedes it. 4. Eliminate .. elements that begin a rooted path: that is, replace "/.." by "/" at the beginning of a path.
    The returned path ends in a slash only if it is the root "/".
    If the result of this process is an empty string, Clean returns the string ".".
    See also Rob Pike, “Lexical File Names in Plan 9 or Getting Dot-Dot Right,” https://9p.io/sys/doc/lexnames.html

    Signature:

    func(path str) str

  • golang/path.dir (PathDir) View Source


    PathDir is an autogenerated function. func Dir(path string) string Dir returns all but the last element of path, typically the path's directory. After dropping the final element using Split, the path is Cleaned and trailing slashes are removed. If the path is empty, Dir returns ".". If the path consists entirely of slashes followed by non-slash bytes, Dir returns a single slash. In any other case, the returned path does not end in a slash.

    Signature:

    func(path str) str

  • golang/path.ext (PathExt) View Source


    PathExt is an autogenerated function. func Ext(path string) string Ext returns the file name extension used by path. The extension is the suffix beginning at the final dot in the final slash-separated element of path; it is empty if there is no dot.

    Signature:

    func(path str) str

  • golang/path.is_abs (PathIsAbs) View Source


    PathIsAbs is an autogenerated function. func IsAbs(path string) bool IsAbs reports whether the path is absolute.

    Signature:

    func(path str) bool

  • golang/path/filepath.abs (PathfilepathAbs) View Source


    PathfilepathAbs is an autogenerated function. func Abs(path string) (string, error) Abs returns an absolute representation of path. If the path is not absolute it will be joined with the current working directory to turn it into an absolute path. The absolute path name for a given file is not guaranteed to be unique. Abs calls Clean on the result.

    Signature:

    func(path str) str

  • golang/path/filepath.base (PathfilepathBase) View Source


    PathfilepathBase is an autogenerated function. func Base(path string) string Base returns the last element of path. Trailing path separators are removed before extracting the last element. If the path is empty, Base returns ".". If the path consists entirely of separators, Base returns a single separator.

    Signature:

    func(path str) str

  • golang/path/filepath.clean (PathfilepathClean) View Source


    PathfilepathClean is an autogenerated function. func Clean(path string) string Clean returns the shortest path name equivalent to path by purely lexical processing. It applies the following rules iteratively until no further processing can be done:
    1. Replace multiple Separator elements with a single one. 2. Eliminate each . path name element (the current directory). 3. Eliminate each inner .. path name element (the parent directory) along with the non-.. element that precedes it. 4. Eliminate .. elements that begin a rooted path: that is, replace "/.." by "/" at the beginning of a path, assuming Separator is '/'.
    The returned path ends in a slash only if it represents a root directory, such as "/" on Unix or `C:\` on Windows.
    Finally, any occurrences of slash are replaced by Separator.
    If the result of this process is an empty string, Clean returns the string ".".
    On Windows, Clean does not modify the volume name other than to replace occurrences of "/" with `\`. For example, Clean("//host/share/../x") returns `\\host\share\x`.
    See also Rob Pike, “Lexical File Names in Plan 9 or Getting Dot-Dot Right,” https://9p.io/sys/doc/lexnames.html

    Signature:

    func(path str) str

  • golang/path/filepath.dir (PathfilepathDir) View Source


    PathfilepathDir is an autogenerated function. func Dir(path string) string Dir returns all but the last element of path, typically the path's directory. After dropping the final element, Dir calls Clean on the path and trailing slashes are removed. If the path is empty, Dir returns ".". If the path consists entirely of separators, Dir returns a single separator. The returned path does not end in a separator unless it is the root directory.

    Signature:

    func(path str) str


  • PathfilepathEvalSymlinks is an autogenerated function. func EvalSymlinks(path string) (string, error) EvalSymlinks returns the path name after the evaluation of any symbolic links. If path is relative the result will be relative to the current directory, unless one of the components is an absolute symbolic link. EvalSymlinks calls Clean on the result.

    Signature:

    func(path str) str

  • golang/path/filepath.ext (PathfilepathExt) View Source


    PathfilepathExt is an autogenerated function. func Ext(path string) string Ext returns the file name extension used by path. The extension is the suffix beginning at the final dot in the final element of path; it is empty if there is no dot.

    Signature:

    func(path str) str

  • golang/path/filepath.from_slash (PathfilepathFromSlash) View Source


    PathfilepathFromSlash is an autogenerated function. func FromSlash(path string) string FromSlash returns the result of replacing each slash ('/') character in path with a separator character. Multiple slashes are replaced by multiple separators.
    See also the Localize function, which converts a slash-separated path as used by the io/fs package to an operating system path.

    Signature:

    func(path str) str

  • golang/path/filepath.has_prefix (PathfilepathHasPrefix) View Source


    PathfilepathHasPrefix is an autogenerated function. func HasPrefix(p, prefix string) bool HasPrefix exists for historical compatibility and should not be used.
    Deprecated: HasPrefix does not respect path boundaries and does not ignore case when required.

    Signature:

    func(p str, prefix str) bool

  • golang/path/filepath.is_abs (PathfilepathIsAbs) View Source


    PathfilepathIsAbs is an autogenerated function. func IsAbs(path string) bool IsAbs reports whether the path is absolute.

    Signature:

    func(path str) bool

  • golang/path/filepath.is_local (PathfilepathIsLocal) View Source


    PathfilepathIsLocal is an autogenerated function. func IsLocal(path string) bool IsLocal reports whether path, using lexical analysis only, has all of these properties:
    - is within the subtree rooted at the directory in which path is evaluated - is not an absolute path - is not empty - on Windows, is not a reserved name such as "NUL"
    If IsLocal(path) returns true, then Join(base, path) will always produce a path contained within base and Clean(path) will always produce an unrooted path with no ".." path elements.
    IsLocal is a purely lexical operation. In particular, it does not account for the effect of any symbolic links that may exist in the filesystem.

    Signature:

    func(path str) bool

  • golang/path/filepath.localize (PathfilepathLocalize) View Source


    PathfilepathLocalize is an autogenerated function. func Localize(path string) (string, error) Localize converts a slash-separated path into an operating system path. The input path must be a valid path as reported by io/fs.ValidPath.
    Localize returns an error if the path cannot be represented by the operating system. For example, the path a\b is rejected on Windows, on which \ is a separator character and cannot be part of a filename.
    The path returned by Localize will always be local, as reported by IsLocal.

    Signature:

    func(path str) str

  • golang/path/filepath.rel (PathfilepathRel) View Source


    PathfilepathRel is an autogenerated function. func Rel(basepath, targpath string) (string, error) Rel returns a relative path that is lexically equivalent to targpath when joined to basepath with an intervening separator. That is, Join(basepath, Rel(basepath, targpath)) is equivalent to targpath itself. On success, the returned path will always be relative to basepath, even if basepath and targpath share no elements. An error is returned if targpath can't be made relative to basepath or if knowing the current working directory would be necessary to compute it. Rel calls Clean on the result.

    Signature:

    func(basepath str, targpath str) str

  • golang/path/filepath.to_slash (PathfilepathToSlash) View Source


    PathfilepathToSlash is an autogenerated function. func ToSlash(path string) string ToSlash returns the result of replacing each separator character in path with a slash ('/') character. Multiple separators are replaced by multiple slashes.

    Signature:

    func(path str) str

  • golang/path/filepath.volume_name (PathfilepathVolumeName) View Source


    PathfilepathVolumeName is an autogenerated function. func VolumeName(path string) string VolumeName returns leading volume name. Given "C:\foo\bar" it returns "C:" on Windows. Given "\\host\share\foo" it returns "\\host\share". On other platforms it returns "".

    Signature:

    func(path str) str

  • golang/runtime.cpu_profile (RuntimeCPUProfile) View Source


    RuntimeCPUProfile is an autogenerated function. func CPUProfile() []byte CPUProfile panics. It formerly provided raw access to chunks of a pprof-format profile generated by the runtime. The details of generating that format have changed, so this functionality has been removed.
    Deprecated: Use the runtime/pprof package, or the handlers in the net/http/pprof package, or the testing package's -test.cpuprofile flag instead.

    Signature:

    func() str

  • golang/runtime.gomaxprocs (RuntimeGOMAXPROCS) View Source


    RuntimeGOMAXPROCS is an autogenerated function. func GOMAXPROCS(n int) int GOMAXPROCS sets the maximum number of CPUs that can be executing simultaneously and returns the previous setting. It defaults to the value of runtime.NumCPU. If n < 1, it does not change the current setting. This call will go away when the scheduler improves.

    Signature:

    func(n int) int

  • golang/runtime.goroot (RuntimeGOROOT) View Source


    RuntimeGOROOT is an autogenerated function. func GOROOT() string GOROOT returns the root of the Go tree. It uses the GOROOT environment variable, if set at process start, or else the root used during the Go build.

    Signature:

    func() str

  • golang/runtime.num_cgo_call (RuntimeNumCgoCall) View Source


    RuntimeNumCgoCall is an autogenerated function. func NumCgoCall() int64 NumCgoCall returns the number of cgo calls made by the current process.

    Signature:

    func() int

  • golang/runtime.num_cpu (RuntimeNumCPU) View Source


    RuntimeNumCPU is an autogenerated function. func NumCPU() int NumCPU returns the number of logical CPUs usable by the current process.
    The set of available CPUs is checked by querying the operating system at process startup. Changes to operating system CPU allocation after process startup are not reflected.

    Signature:

    func() int

  • golang/runtime.num_goroutine (RuntimeNumGoroutine) View Source


    RuntimeNumGoroutine is an autogenerated function. func NumGoroutine() int NumGoroutine returns the number of goroutines that currently exist.

    Signature:

    func() int

  • golang/runtime.read_trace (RuntimeReadTrace) View Source


    RuntimeReadTrace is an autogenerated function. func ReadTrace() []byte ReadTrace returns the next chunk of binary tracing data, blocking until data is available. If tracing is turned off and all the data accumulated while it was on has been returned, ReadTrace returns nil. The caller must copy the returned data before calling ReadTrace again. ReadTrace must be called from one goroutine at a time.

    Signature:

    func() str

  • golang/runtime.set_mutex_profile_fraction (RuntimeSetMutexProfileFraction) View Source


    RuntimeSetMutexProfileFraction is an autogenerated function. func SetMutexProfileFraction(rate int) int SetMutexProfileFraction controls the fraction of mutex contention events that are reported in the mutex profile. On average 1/rate events are reported. The previous rate is returned.
    To turn off profiling entirely, pass rate 0. To just read the current rate, pass rate < 0. (For n>1 the details of sampling may change.)

    Signature:

    func(rate int) int

  • golang/runtime.stack (RuntimeStack) View Source


    RuntimeStack is an autogenerated function. func Stack(buf []byte, all bool) int Stack formats a stack trace of the calling goroutine into buf and returns the number of bytes written to buf. If all is true, Stack formats stack traces of all other goroutines into buf after the trace for the current goroutine.

    Signature:

    func(buf str, all bool) int

  • golang/runtime.version (RuntimeVersion) View Source


    RuntimeVersion is an autogenerated function. func Version() string Version returns the Go tree's version string. It is either the commit hash and date at the time of the build or, when possible, a release tag like "go1.3".

    Signature:

    func() str

  • golang/strconv.append_bool (StrconvAppendBool) View Source


    StrconvAppendBool is an autogenerated function. func AppendBool(dst []byte, b bool) []byte AppendBool appends "true" or "false", according to the value of b, to dst and returns the extended buffer.

    Signature:

    func(dst str, b bool) str

  • golang/strconv.append_int (StrconvAppendInt) View Source


    StrconvAppendInt is an autogenerated function. func AppendInt(dst []byte, i int64, base int) []byte AppendInt appends the string form of the integer i, as generated by FormatInt, to dst and returns the extended buffer.

    Signature:

    func(dst str, i int, base int) str

  • golang/strconv.append_quote (StrconvAppendQuote) View Source


    StrconvAppendQuote is an autogenerated function. func AppendQuote(dst []byte, s string) []byte AppendQuote appends a double-quoted Go string literal representing s, as generated by Quote, to dst and returns the extended buffer.

    Signature:

    func(dst str, s str) str

  • golang/strconv.append_quote_to_ascii (StrconvAppendQuoteToASCII) View Source


    StrconvAppendQuoteToASCII is an autogenerated function. func AppendQuoteToASCII(dst []byte, s string) []byte AppendQuoteToASCII appends a double-quoted Go string literal representing s, as generated by QuoteToASCII, to dst and returns the extended buffer.

    Signature:

    func(dst str, s str) str

  • golang/strconv.append_quote_to_graphic (StrconvAppendQuoteToGraphic) View Source


    StrconvAppendQuoteToGraphic is an autogenerated function. func AppendQuoteToGraphic(dst []byte, s string) []byte AppendQuoteToGraphic appends a double-quoted Go string literal representing s, as generated by QuoteToGraphic, to dst and returns the extended buffer.

    Signature:

    func(dst str, s str) str

  • golang/strconv.atoi (StrconvAtoi) View Source


    StrconvAtoi is an autogenerated function. func Atoi(s string) (int, error) Atoi is equivalent to ParseInt(s, 10, 0), converted to type int.

    Signature:

    func(s str) int

  • golang/strconv.can_backquote (StrconvCanBackquote) View Source


    StrconvCanBackquote is an autogenerated function. func CanBackquote(s string) bool CanBackquote reports whether the string s can be represented unchanged as a single-line backquoted string without control characters other than tab.

    Signature:

    func(s str) bool

  • golang/strconv.format_bool (StrconvFormatBool) View Source


    StrconvFormatBool is an autogenerated function. func FormatBool(b bool) string FormatBool returns "true" or "false" according to the value of b.

    Signature:

    func(b bool) str

  • golang/strconv.format_int (StrconvFormatInt) View Source


    StrconvFormatInt is an autogenerated function. func FormatInt(i int64, base int) string FormatInt returns the string representation of i in the given base, for 2 <= base <= 36. The result uses the lower-case letters 'a' to 'z' for digit values >= 10.

    Signature:

    func(i int, base int) str

  • golang/strconv.itoa (StrconvItoa) View Source


    StrconvItoa is an autogenerated function. func Itoa(i int) string Itoa is equivalent to FormatInt(int64(i), 10).

    Signature:

    func(i int) str

  • golang/strconv.parse_bool (StrconvParseBool) View Source


    StrconvParseBool is an autogenerated function. func ParseBool(str string) (bool, error) ParseBool returns the boolean value represented by the string. It accepts 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False. Any other value returns an error.

    Signature:

    func(str str) bool

  • golang/strconv.parse_float (StrconvParseFloat) View Source


    StrconvParseFloat is an autogenerated function. func ParseFloat(s string, bitSize int) (float64, error) ParseFloat converts the string s to a floating-point number with the precision specified by bitSize: 32 for float32, or 64 for float64. When bitSize=32, the result still has type float64, but it will be convertible to float32 without changing its value.
    ParseFloat accepts decimal and hexadecimal floating-point numbers as defined by the Go syntax for floating-point literals. If s is well-formed and near a valid floating-point number, ParseFloat returns the nearest floating-point number rounded using IEEE754 unbiased rounding. (Parsing a hexadecimal floating-point value only rounds when there are more bits in the hexadecimal representation than will fit in the mantissa.)
    The errors that ParseFloat returns have concrete type *NumError and include err.Num = s.
    If s is not syntactically well-formed, ParseFloat returns err.Err = ErrSyntax.
    If s is syntactically well-formed but is more than 1/2 ULP away from the largest floating point number of the given size, ParseFloat returns f = ±Inf, err.Err = ErrRange.
    ParseFloat recognizes the string "NaN", and the (possibly signed) strings "Inf" and "Infinity" as their respective special floating point values. It ignores case when matching.
    [floating-point literals]: https://go.dev/ref/spec#Floating-point_literals

    Signature:

    func(s str, bitSize int) float

  • golang/strconv.quote (StrconvQuote) View Source


    StrconvQuote is an autogenerated function. func Quote(s string) string Quote returns a double-quoted Go string literal representing s. The returned string uses Go escape sequences (\t, \n, \xFF, \u0100) for control characters and non-printable characters as defined by IsPrint.

    Signature:

    func(s str) str

  • golang/strconv.quote_to_ascii (StrconvQuoteToASCII) View Source


    StrconvQuoteToASCII is an autogenerated function. func QuoteToASCII(s string) string QuoteToASCII returns a double-quoted Go string literal representing s. The returned string uses Go escape sequences (\t, \n, \xFF, \u0100) for non-ASCII characters and non-printable characters as defined by IsPrint.

    Signature:

    func(s str) str

  • golang/strconv.quote_to_graphic (StrconvQuoteToGraphic) View Source


    StrconvQuoteToGraphic is an autogenerated function. func QuoteToGraphic(s string) string QuoteToGraphic returns a double-quoted Go string literal representing s. The returned string leaves Unicode graphic characters, as defined by IsGraphic, unchanged and uses Go escape sequences (\t, \n, \xFF, \u0100) for non-graphic characters.

    Signature:

    func(s str) str

  • golang/strconv.quoted_prefix (StrconvQuotedPrefix) View Source


    StrconvQuotedPrefix is an autogenerated function. func QuotedPrefix(s string) (string, error) QuotedPrefix returns the quoted string (as understood by Unquote) at the prefix of s. If s does not start with a valid quoted string, QuotedPrefix returns an error.

    Signature:

    func(s str) str

  • golang/strconv.unquote (StrconvUnquote) View Source


    StrconvUnquote is an autogenerated function. func Unquote(s string) (string, error) Unquote interprets s as a single-quoted, double-quoted, or backquoted Go string literal, returning the string value that s quotes. (If s is single-quoted, it would be a Go character literal; Unquote returns the corresponding one-character string.)

    Signature:

    func(s str) str

  • golang/strings.clone (StringsClone) View Source


    StringsClone is an autogenerated function. func Clone(s string) string Clone returns a fresh copy of s. It guarantees to make a copy of s into a new allocation, which can be important when retaining only a small substring of a much larger string. Using Clone can help such programs use less memory. Of course, since using Clone makes a copy, overuse of Clone can make programs use more memory. Clone should typically be used only rarely, and only when profiling indicates that it is needed. For strings of length zero the string "" will be returned and no allocation is made.

    Signature:

    func(s str) str

  • golang/strings.compare (StringsCompare) View Source


    StringsCompare is an autogenerated function. func Compare(a, b string) int Compare returns an integer comparing two strings lexicographically. The result will be 0 if a == b, -1 if a < b, and +1 if a > b.
    Use Compare when you need to perform a three-way comparison (with slices.SortFunc, for example). It is usually clearer and always faster to use the built-in string comparison operators ==, <, >, and so on.

    Signature:

    func(a str, b str) int

  • golang/strings.contains (StringsContains) View Source


    StringsContains is an autogenerated function. func Contains(s, substr string) bool Contains reports whether substr is within s.

    Signature:

    func(s str, substr str) bool

  • golang/strings.contains_any (StringsContainsAny) View Source


    StringsContainsAny is an autogenerated function. func ContainsAny(s, chars string) bool ContainsAny reports whether any Unicode code points in chars are within s.

    Signature:

    func(s str, chars str) bool

  • golang/strings.count (StringsCount) View Source


    StringsCount is an autogenerated function. func Count(s, substr string) int Count counts the number of non-overlapping instances of substr in s. If substr is an empty string, Count returns 1 + the number of Unicode code points in s.

    Signature:

    func(s str, substr str) int

  • golang/strings.equal_fold (StringsEqualFold) View Source


    StringsEqualFold is an autogenerated function. func EqualFold(s, t string) bool EqualFold reports whether s and t, interpreted as UTF-8 strings, are equal under simple Unicode case-folding, which is a more general form of case-insensitivity.

    Signature:

    func(s str, t str) bool

  • golang/strings.has_prefix (StringsHasPrefix) View Source


    StringsHasPrefix is an autogenerated function. func HasPrefix(s, prefix string) bool HasPrefix reports whether the string s begins with prefix.

    Signature:

    func(s str, prefix str) bool

  • golang/strings.has_suffix (StringsHasSuffix) View Source


    StringsHasSuffix is an autogenerated function. func HasSuffix(s, suffix string) bool HasSuffix reports whether the string s ends with suffix.

    Signature:

    func(s str, suffix str) bool

  • golang/strings.index (StringsIndex) View Source


    StringsIndex is an autogenerated function. func Index(s, substr string) int Index returns the index of the first instance of substr in s, or -1 if substr is not present in s.

    Signature:

    func(s str, substr str) int

  • golang/strings.index_any (StringsIndexAny) View Source


    StringsIndexAny is an autogenerated function. func IndexAny(s, chars string) int IndexAny returns the index of the first instance of any Unicode code point from chars in s, or -1 if no Unicode code point from chars is present in s.

    Signature:

    func(s str, chars str) int

  • golang/strings.join (StringsJoin) View Source


    StringsJoin is an autogenerated function. func Join(elems []string, sep string) string Join concatenates the elements of its first argument to create a single string. The separator string sep is placed between elements in the resulting string.

    Signature:

    func(elems []str, sep str) str

  • golang/strings.last_index (StringsLastIndex) View Source


    StringsLastIndex is an autogenerated function. func LastIndex(s, substr string) int LastIndex returns the index of the last instance of substr in s, or -1 if substr is not present in s.

    Signature:

    func(s str, substr str) int

  • golang/strings.last_index_any (StringsLastIndexAny) View Source


    StringsLastIndexAny is an autogenerated function. func LastIndexAny(s, chars string) int LastIndexAny returns the index of the last instance of any Unicode code point from chars in s, or -1 if no Unicode code point from chars is present in s.

    Signature:

    func(s str, chars str) int

  • golang/strings.repeat (StringsRepeat) View Source


    StringsRepeat is an autogenerated function. func Repeat(s string, count int) string Repeat returns a new string consisting of count copies of the string s.
    It panics if count is negative or if the result of (len(s) * count) overflows.

    Signature:

    func(s str, count int) str

  • golang/strings.replace (StringsReplace) View Source


    StringsReplace is an autogenerated function. func Replace(s, old, new string, n int) string Replace returns a copy of the string s with the first n non-overlapping instances of old replaced by new. If old is empty, it matches at the beginning of the string and after each UTF-8 sequence, yielding up to k+1 replacements for a k-rune string. If n < 0, there is no limit on the number of replacements.

    Signature:

    func(s str, old str, new str, n int) str

  • golang/strings.replace_all (StringsReplaceAll) View Source


    StringsReplaceAll is an autogenerated function. func ReplaceAll(s, old, new string) string ReplaceAll returns a copy of the string s with all non-overlapping instances of old replaced by new. If old is empty, it matches at the beginning of the string and after each UTF-8 sequence, yielding up to k+1 replacements for a k-rune string.

    Signature:

    func(s str, old str, new str) str

  • golang/strings.title (StringsTitle) View Source


    StringsTitle is an autogenerated function. func Title(s string) string Title returns a copy of the string s with all Unicode letters that begin words mapped to their Unicode title case.
    Deprecated: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.

    Signature:

    func(s str) str

  • golang/strings.to_lower (StringsToLower) View Source


    StringsToLower is an autogenerated function. func ToLower(s string) string ToLower returns s with all Unicode letters mapped to their lower case.

    Signature:

    func(s str) str

  • golang/strings.to_title (StringsToTitle) View Source


    StringsToTitle is an autogenerated function. func ToTitle(s string) string ToTitle returns a copy of the string s with all Unicode letters mapped to their Unicode title case.

    Signature:

    func(s str) str

  • golang/strings.to_upper (StringsToUpper) View Source


    StringsToUpper is an autogenerated function. func ToUpper(s string) string ToUpper returns s with all Unicode letters mapped to their upper case.

    Signature:

    func(s str) str

  • golang/strings.to_valid_utf_8 (StringsToValidUTF8) View Source


    StringsToValidUTF8 is an autogenerated function. func ToValidUTF8(s, replacement string) string ToValidUTF8 returns a copy of the string s with each run of invalid UTF-8 byte sequences replaced by the replacement string, which may be empty.

    Signature:

    func(s str, replacement str) str

  • golang/strings.trim (StringsTrim) View Source


    StringsTrim is an autogenerated function. func Trim(s, cutset string) string Trim returns a slice of the string s with all leading and trailing Unicode code points contained in cutset removed.

    Signature:

    func(s str, cutset str) str

  • golang/strings.trim_left (StringsTrimLeft) View Source


    StringsTrimLeft is an autogenerated function. func TrimLeft(s, cutset string) string TrimLeft returns a slice of the string s with all leading Unicode code points contained in cutset removed.
    To remove a prefix, use TrimPrefix instead.

    Signature:

    func(s str, cutset str) str

  • golang/strings.trim_prefix (StringsTrimPrefix) View Source


    StringsTrimPrefix is an autogenerated function. func TrimPrefix(s, prefix string) string TrimPrefix returns s without the provided leading prefix string. If s doesn't start with prefix, s is returned unchanged.

    Signature:

    func(s str, prefix str) str

  • golang/strings.trim_right (StringsTrimRight) View Source


    StringsTrimRight is an autogenerated function. func TrimRight(s, cutset string) string TrimRight returns a slice of the string s, with all trailing Unicode code points contained in cutset removed.
    To remove a suffix, use TrimSuffix instead.

    Signature:

    func(s str, cutset str) str

  • golang/strings.trim_space (StringsTrimSpace) View Source


    StringsTrimSpace is an autogenerated function. func TrimSpace(s string) string TrimSpace returns a slice of the string s, with all leading and trailing white space removed, as defined by Unicode.

    Signature:

    func(s str) str

  • golang/strings.trim_suffix (StringsTrimSuffix) View Source


    StringsTrimSuffix is an autogenerated function. func TrimSuffix(s, suffix string) string TrimSuffix returns s without the provided trailing suffix string. If s doesn't end with suffix, s is returned unchanged.

    Signature:

    func(s str, suffix str) str

  • history (HistoryFunc) View Source


    HistoryFunc is special function which returns the Nth oldest value seen. It must store up incoming values until it gets enough to return the desired one. A restart of the program, will expunge the stored state. This obviously takes more memory, the further back you wish to index. A change in the index var is generally not useful, but it is permitted. Moving it to a smaller value will cause older index values to be expunged. If this is undesirable, a max count could be added. This was not implemented with efficiency in mind. Since some functions might not send out un-changed values, it might also make sense to implement a *time* based hysteresis, since this only looks at the last N changed values. A time based hysteresis would tick every precision-width, and store whatever the latest value at that time is.

    Signature:

    func(value ?1, index int) ?1

  • iter.filter (FilterFunc) View Source


    FilterFunc is the standard filter iterator function that runs a function on each element in a list. That function must return true to keep the element, or false otherwise. The function then returns a list with the subset of kept elements from the input list. This implements the signature: `func(inputs []?1, function func(?1) bool) []?1` instead of the alternate with the two input args swapped, because while the latter is more common with languages that support partial function application, the former variant that we implemented is much more readable when using an inline lambda.

    Signature:

    func(inputs []?1, function func(name-which-can-vary-over-time ?1) bool) []?1

  • iter.map (MapFunc) View Source


    MapFunc is the standard map iterator function that applies a function to each element in a list. It returns a list with the same number of elements as the input list. There is no requirement that the element output type be the same as the input element type. This implements the signature: `func(inputs []?1, function func(?1) ?2) []?2` instead of the alternate with the two input args swapped, because while the latter is more common with languages that support partial function application, the former variant that we implemented is much more readable when using an inline lambda. should that be a different function? I think a different function is best.

    Signature:

    func(inputs []?1, function func(name-which-can-vary-over-time ?1) ?2) []?2

  • len (Len) View Source


    Len returns the number of elements in a list or the number of key pairs in a map. It can operate on either of these types.

    Signature:

    func(0 ?1) int

  • list.concat (ListConcatFunc) View Source


    ListConcatFunc is a function which combines a number of lists into one list. It can take one or more arguments. It combines them in argument order.

    Signature:

    < polymorphic >

  • list.intersection (ListIntersection) View Source


    ListIntersection returns the list of common values between two lists.

    Signature:

    func(a []?1, b []?1) []?1

  • list.lookup (ListLookupFunc) View Source


    ListLookupFunc is a list index lookup function. It can take either two or three arguments. The first argument is the list to lookup a value in. The second is the integer index. If you specify a third argument, then this value will be returned if the list index is not present. If the third argument is omitted, then this function errors if the list index is not present. Passing a negative index will always result in an error.

    Signature:

    < polymorphic >

  • list_lookup (ListLookupFunc) View Source


    ListLookupFunc is a list index lookup function. If you provide a negative index, then it will return the zero value for that type.

    Signature:

    func(list []?1, index int) ?1

  • list_lookup_default (ListLookupDefaultFunc) View Source


    ListLookupDefaultFunc is a list index lookup function. If you provide a negative index, then it will return the default value you specified for this function. support passing a value for erroring functions. (Bad index could be an err!)

    Signature:

    func(list []?1, index int, default ?1) ?1

  • local.pool (PoolFunc) View Source


    PoolFunc is a function that returns a unique integer from a pool of numbers. Within a given namespace, it returns the same integer for a given name. It is a simple mechanism to allocate numbers to different inputs when we don't have a hashing alternative. It does not allocate zero.

    Signature:

    func(namespace str, uid str) int

  • local.vardir (VarDirFunc) View Source


    VarDirFunc is a function that returns the absolute, full path in the deploy from an input path that is relative to the calling file. If you pass it an empty string, you'll just get the absolute deploy directory path that you're in.

    Signature:

    func(path str) str

  • map.keys (MapKeys) View Source


    MapKeys returns a list of keys from the map.

    Signature:

    func(x map{?1: ?2}) []?1

  • map.lookup (MapLookupFunc) View Source


    MapLookupFunc is a key map lookup function. It can take either two or three arguments. The first argument is the map to lookup a value by key in. The second is the key to use. If you specify a third argument, then this value will be returned if the map key is not present. If the third argument is omitted, then this function errors if the map key is not present.

    Signature:

    < polymorphic >

  • map.values (MapValues) View Source


    MapValues returns a list of values from the map.

    Signature:

    func(x map{?1: ?2}) []?2

  • map_lookup (MapLookupFunc) View Source


    MapLookupFunc is a key map lookup function. If you provide a missing key, then it will return the zero value for that type.

    Signature:

    func(map map{?1: ?2}, key ?1) ?2

  • map_lookup_default (MapLookupDefaultFunc) View Source


    MapLookupDefaultFunc is a key map lookup function. If you provide a missing key, then it will return the default value you specified for this function. support passing a value for erroring functions. (Bad index could be an err!)

    Signature:

    func(map map{?1: ?2}, key ?1, default ?2) ?2

  • math.fortytwo (FortyTwo) View Source


    FortyTwo returns 42 as either an int or a float. This is not especially useful, but was built for a fun test case of a simple poly function with two different return types, but no input args.

    Signature:

    func() ?1

  • math.minus1 (Minus1) View Source


    Minus1 takes an int and subtracts one from it.

    Signature:

    func(x int) int

  • math.mod (Mod) View Source


    Mod returns mod(x, y), the remainder of x/y. The two values must be either both of KindInt or both of KindFloat, and it will return the same kind. If you pass in a divisor of zero, this will error, eg: mod(x, 0) = NaN.

    Signature:

    func(0 ?1, 1 ?1) ?1

  • math.pow (Pow) View Source


    Pow returns x ^ y, the base-x exponential of y.

    Signature:

    func(x float, y float) float

  • math.sqrt (Sqrt) View Source


    Sqrt returns sqrt(x), the square root of x.

    Signature:

    func(x float) float

  • net.cidr_to_ip (CidrToIP) View Source


    CidrToIP returns the IP from a CIDR address.

    Signature:

    func(a str) str

  • net.cidr_to_mask (CidrToMask) View Source


    CidrToMask returns the subnet mask from a CIDR address.

    Signature:

    func(a str) str

  • net.cidr_to_prefix (CidrToPrefix) View Source


    CidrToPrefix returns the prefix from a CIDR address. For example, if you give us 192.0.2.0/24 then we will return "24" as a string.

    Signature:

    func(a str) str

  • net.is_mac (IsMac) View Source


    IsMac takes a string and returns true if it's a mac in the standard format.

    Signature:

    func(a str) bool

  • net.macfmt (MacFmt) View Source


    MacFmt takes a MAC address with hyphens and converts it to a format with colons.

    Signature:

    func(a str) str

  • net.macs (Macs) View Source


    Macs returns the list of mac addresses that are seen on the machine.

    Signature:

    func() []str

  • net.oldmacfmt (OldMacFmt) View Source


    OldMacFmt takes a MAC address with colons and converts it to a format with hyphens. This is the old deprecated style that nobody likes.

    Signature:

    func(a str) str

  • os.args (Args) View Source


    Args returns the `argv` of the current process. Keep in mind that this will return different values depending on how this is deployed, so don't expect a result on your deploy client to behave the same as a server receiving code.

    Signature:

    func() []str

  • os.expand_home (ExpandHome) View Source


    ExpandHome expands any tilde patterns in the input path according to the currently running user. While most of the time its likely this is `root`, there is no reason the program is necessarily running as root!

    Signature:

    func(0 str) str

  • os.family (Family) View Source


    Family returns the distro family.

    Signature:

    func() str

  • os.is_family_archlinux (IsFamilyArchLinux) View Source


    IsFamilyArchLinux detects if the os family is archlinux.

    Signature:

    func() bool

  • os.is_family_debian (IsFamilyDebian) View Source


    IsFamilyDebian detects if the os family is debian.

    Signature:

    func() bool

  • os.is_family_redhat (IsFamilyRedHat) View Source


    IsFamilyRedHat detects if the os family is redhat.

    Signature:

    func() bool

  • os.parse_distro_uid (ParseDistroUID) View Source


    ParseDistroUID parses a distro UID into its component values. If it cannot parse correctly, all the struct fields have the zero values. NOTE: The UID pattern is subject to change.

    Signature:

    func(0 str) struct{distro str; version str; arch str}

  • os.readfile (ReadFileFunc) View Source


    ReadFileFunc is a function that reads the full contents from a local file. If the file contents change or the file path changes, a new string will be sent. Please note that this is different from the readfile function in the deploy package.

    Signature:

    func(filename str) str

  • os.system (SystemFunc) View Source


    SystemFunc runs a string as a shell command, then produces each line from stdout. If the input string changes, then the commands are executed one after the other and the concatenation of their outputs is produced line by line.
    Note that in the likely case in which the process emits several lines one after the other, the downstream resources might not run for every line unless the "Meta:realize" metaparam is set to true.

    Signature:

    func(cmd str) str

  • panic (Panic) View Source


    Panic returns an error when it receives a non-empty string or a true boolean. The error should cause the function engine to shutdown. If there's no error, it returns false.

    Signature:

    func(x ?1) bool

  • random1 (Random1Func) View Source


    Random1Func returns one random string of a certain length. takes the first value and then puts backpressure on the stream. This should notify parent functions somehow that their values are no longer required so that they can shutdown if possible. Maybe it should be returning a stream of floats [0,1] as well, which someone can later map to the alphabet that they want. Should random() take an interval to know how often to spit out values? It could also just do it once per second, and we could filter for less. If we want something high precision, we could add that in the future... We could name that "random" and this one can be "random1" until we deprecate it.

    Signature:

    func(length int) str

  • regexp.match (Match) View Source


    Match matches whether a string matches the regexp pattern.

    Signature:

    func(pattern str, s str) bool

  • strings.left_pad (LeftPad) View Source


    LeftPad adds multiples of the pad string to the left of the input string until it reaches a minimum length. If the padding string is not an integer multiple of the missing length to pad, then this will overshoot. It is better to overshoot than to undershoot because if you need a string of a precise length, then it's easier to truncate the result, rather than having to pad even more. Most scenarios pad with a single char meaning this is not even an issue.

    Signature:

    func(s str, pad str, len int) str

  • strings.right_pad (RightPad) View Source


    RightPad adds multiples of the pad string to the right of the input string until it reaches a minimum length. If the padding string is not an integer multiple of the missing length to pad, then this will overshoot. It is better to overshoot than to undershoot because if you need a string of a precise length, then it's easier to truncate the result, rather than having to pad even more. Most scenarios pad with a single char meaning this is not even an issue.

    Signature:

    func(s str, pad str, len int) str

  • strings.split (Split) View Source


    Split splits the input string using the separator and returns the segments as a list.

    Signature:

    func(a str, b str) []str

  • strings.substr (SubStr) View Source


    SubStr returns a substring of the input string from low to high.

    Signature:

    func(s str, low int, high int) str

  • strings.to_lower (ToLower) View Source


    ToLower turns a string to lowercase.

    Signature:

    func(a str) str

  • sys.cpu_count (CPUCountFact) View Source


    CPUCountFact is a fact that returns the current CPU count.

    Signature:

    func() int

  • sys.defaultenv (DefaultEnv) View Source


    DefaultEnv gets environment variable by name or returns default if non existing.

    Signature:

    func(0 str, 1 str) str

  • sys.env (Env) View Source


    Env returns a map of all keys and their values.

    Signature:

    func() map{str: str}

  • sys.getenv (GetEnv) View Source


    GetEnv gets environment variable by name or returns empty string if non existing.

    Signature:

    func(0 str) str

  • sys.hasenv (HasEnv) View Source


    HasEnv returns true if environment variable exists.

    Signature:

    func(0 str) bool

  • sys.hostname (HostnameFact) View Source


    HostnameFact is a function that returns the hostname.

    Signature:

    func() str

  • sys.load (LoadFact) View Source


    LoadFact is a fact which returns the current system load.

    Signature:

    func() struct{x1 float; x5 float; x15 float}

  • sys.uptime (UptimeFact) View Source


    UptimeFact is a fact which returns the current uptime of your system.

    Signature:

    func() int

  • test.fastcount (FastCountFact) View Source


    FastCountFact is a fact that counts up as fast as possible from zero forever.

    Signature:

    func() int

  • test.one_instance_a (OneInstanceFact) View Source


    OneInstanceFact is a fact which flips a bool repeatedly. This is an example fact and is not meant for serious computing. This would be better served by a flip function which you could specify an interval for.

    Signature:

    func() str

  • test.one_instance_b (OneInstanceFact) View Source


    OneInstanceFact is a fact which flips a bool repeatedly. This is an example fact and is not meant for serious computing. This would be better served by a flip function which you could specify an interval for.

    Signature:

    func() str

  • test.one_instance_c (OneInstanceFact) View Source


    OneInstanceFact is a fact which flips a bool repeatedly. This is an example fact and is not meant for serious computing. This would be better served by a flip function which you could specify an interval for.

    Signature:

    func() str

  • test.one_instance_d (OneInstanceFact) View Source


    OneInstanceFact is a fact which flips a bool repeatedly. This is an example fact and is not meant for serious computing. This would be better served by a flip function which you could specify an interval for.

    Signature:

    func() str

  • test.one_instance_e (OneInstanceFact) View Source


    OneInstanceFact is a fact which flips a bool repeatedly. This is an example fact and is not meant for serious computing. This would be better served by a flip function which you could specify an interval for.

    Signature:

    func() str

  • test.one_instance_f (OneInstanceFact) View Source


    OneInstanceFact is a fact which flips a bool repeatedly. This is an example fact and is not meant for serious computing. This would be better served by a flip function which you could specify an interval for.

    Signature:

    func() str

  • test.one_instance_g (OneInstanceFact) View Source


    OneInstanceFact is a fact which flips a bool repeatedly. This is an example fact and is not meant for serious computing. This would be better served by a flip function which you could specify an interval for.

    Signature:

    func() str

  • test.one_instance_h (OneInstanceFact) View Source


    OneInstanceFact is a fact which flips a bool repeatedly. This is an example fact and is not meant for serious computing. This would be better served by a flip function which you could specify an interval for.

    Signature:

    func() str

  • util.hostname_mapper (HostnameMapper) View Source


    HostnameMapper takes a map from mac address to hostname, and finds a hostname that corresponds to one of the mac addresses on this machine. If it cannot find a match, it returns the empty string. If it's ambiguous, it errors. This is useful for bootstrapping the hostname setup on hosts.

    Signature:

    func(0 map{str: str}) str

  • value.get (GetFunc) View Source


    GetFunc is special function which looks up the stored `Any` field in the value resource that it gets it from. If it is initialized with a fixed Type field, then it becomes a statically typed version that can only return keys of that type. It is instead recommended to use the Get* functions that are more strictly typed.

    Signature:

    < polymorphic >

  • value.get_bool (GetFunc) View Source


    GetFunc is special function which looks up the stored `Any` field in the value resource that it gets it from. If it is initialized with a fixed Type field, then it becomes a statically typed version that can only return keys of that type. It is instead recommended to use the Get* functions that are more strictly typed.

    Signature:

    func(key str) struct{value bool; ready bool}

  • value.get_float (GetFunc) View Source


    GetFunc is special function which looks up the stored `Any` field in the value resource that it gets it from. If it is initialized with a fixed Type field, then it becomes a statically typed version that can only return keys of that type. It is instead recommended to use the Get* functions that are more strictly typed.

    Signature:

    func(key str) struct{value float; ready bool}

  • value.get_int (GetFunc) View Source


    GetFunc is special function which looks up the stored `Any` field in the value resource that it gets it from. If it is initialized with a fixed Type field, then it becomes a statically typed version that can only return keys of that type. It is instead recommended to use the Get* functions that are more strictly typed.

    Signature:

    func(key str) struct{value int; ready bool}

  • value.get_str (GetFunc) View Source


    GetFunc is special function which looks up the stored `Any` field in the value resource that it gets it from. If it is initialized with a fixed Type field, then it becomes a statically typed version that can only return keys of that type. It is instead recommended to use the Get* functions that are more strictly typed.

    Signature:

    func(key str) struct{value str; ready bool}

  • world.exchange (ExchangeFunc) View Source


    ExchangeFunc is special function which returns all the values of a given key in the exposed world, and sets it's own.

    Signature:

    func(namespace str, value str) map{str: str}

  • world.getval (GetValFunc) View Source


    GetValFunc is special function which returns the value of a given key in the exposed world.

    Signature:

    func(key str) struct{value str; exists bool}

  • world.kvlookup (KVLookupFunc) View Source


    KVLookupFunc is special function which returns all the values of a given key in the exposed world. It is similar to exchange, but it does not set a key.

    Signature:

    func(namespace str) map{str: str}

  • world.schedule (ScheduleFunc) View Source


    ScheduleFunc is special function which determines where code should run in the cluster.

    Signature:

    < polymorphic >