Documentation
¶
Index ¶
- Constants
- Variables
- func CaptureStackTrace() string
- func CloseSafe[T any](ch chan T)
- func DialWebSocket(ctx context.Context, urlStr string, protocols []string, timeout time.Duration) (net.Conn, error)
- func GetGlobalUnicastIp() (string, error)
- func GetVersion() string
- func Hostname() string
- func J(states []string) string
- func Jw(states []string, sep string) string
- func NewServerWSConn(conn net.Conn, rw *bufio.ReadWriter) (net.Conn, error)
- func P(txt string, args ...any)
- func PadString(str string, length int, pad string) string
- func RandId(strLen int) string
- func SlicesEvery[S1 ~[]E, S2 ~[]E, E comparable](col1 S1, col2 S2) bool
- func SlicesNone[S1 ~[]E, S2 ~[]E, E comparable](col1 S1, col2 S2) bool
- func SlicesUniq[S ~[]E, E comparable](coll S) S
- func SlicesWithout[S ~[]E, E comparable](coll S, el E) S
- func Sp(txt string, args ...any) string
- func TruncateStr(s string, maxLength int) string
Constants ¶
const EnvAmHostname = "AM_HOSTNAME"
EnvAmHostname will override the hostname in all machine names.
Variables ¶
var Fmt = message.NewPrinter(language.English)
Fmt is a printer for large numbers
Functions ¶
func CaptureStackTrace ¶ added in v0.17.0
func CaptureStackTrace() string
func CloseSafe ¶ added in v0.10.1
func CloseSafe[T any](ch chan T)
TODO remove if that speeds things up
func DialWebSocket ¶ added in v0.19.7
func DialWebSocket( ctx context.Context, urlStr string, protocols []string, timeout time.Duration, ) (net.Conn, error)
DialWebSocket dials a WebSocket endpoint and returns a net.Conn carrying binary messages as a byte stream. Useful for tunneling stream protocols.
func GetGlobalUnicastIp ¶ added in v0.19.6
func GetVersion ¶
func GetVersion() string
func NewServerWSConn ¶ added in v0.19.7
NewServerWSConn wraps an already upgraded server-side WebSocket into a net.Conn.
func SlicesEvery ¶ added in v0.10.1
func SlicesEvery[S1 ~[]E, S2 ~[]E, E comparable](col1 S1, col2 S2) bool
SlicesEvery returns true if all elements of coll2 are in coll1.
func SlicesNone ¶ added in v0.10.1
func SlicesNone[S1 ~[]E, S2 ~[]E, E comparable](col1 S1, col2 S2) bool
SlicesNone returns true if none of the elements of coll2 are in coll1.
func SlicesUniq ¶ added in v0.10.1
func SlicesUniq[S ~[]E, E comparable](coll S) S
func SlicesWithout ¶ added in v0.10.1
func SlicesWithout[S ~[]E, E comparable](coll S, el E) S
func TruncateStr ¶ added in v0.17.0
TruncateStr with shorten the string and leave a tripedot suffix.
Types ¶
This section is empty.