Documentation
¶
Index ¶
- func Chunk[T any](items []T, chunkSize int) (chunks [][]T)
- func Eq(s1, s2 string) bool
- func Hash(str string) string
- func MapKeys[T cmp.Ordered, V any](data map[T]V) []T
- func MergeMapKeys[V any](m map[string]V, adds ...map[string]V) []string
- func MergeSlices[K cmp.Ordered](slices ...[]K) []K
- func RemoveFromSlice[K comparable](base, toRemove []K) []K
- func Reverse[T any](slice []T)
- func SliceToString(slice []string, delimiter string, hook func(string) string) string
- func StringToInt(value string, optionalDefaultValue ...int) int
- func StringToSlice(value string, optionalDefaultValue ...string) []string
- func Truncate(s string, length int) string
- func Uniq(slice []string) []string
- func Unquote(s string) string
- type ErrorResponse
- type List
- type MatrixError
- type Mutex
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MergeMapKeys ¶
MergeMapKeys returns map keys only from multiple maps
func MergeSlices ¶
MergeSlices and remove duplicates
func RemoveFromSlice ¶
func RemoveFromSlice[K comparable](base, toRemove []K) []K
RemoveFromSlice removes elements of toRemove from base slice
func SliceToString ¶
SliceToString converts slice of strings into single string (using strings.Join) with optional hook
func StringToInt ¶
StringToInt converts string to int with optional default value
func StringToSlice ¶
StringToSlice converts comma-separated string to slice with optional default value
Types ¶
type ErrorResponse ¶
type ErrorResponse struct { StatusCode int `json:"-"` // HTTP status code, optional, not serialized Err string `json:"error"` // Error message }
ErrorResponse represents an error response
func NewErrorResponse ¶
func NewErrorResponse(err error, optionalStatusCode ...int) *ErrorResponse
NewErrorResponse creates a new error response
type List ¶
List is unique list, V is used only for AddMapKeys
func NewListFrom ¶
NewListFrom creates a new list and popupates it from slice
func (*List[T, V]) AddMapKeys ¶
func (l *List[T, V]) AddMapKeys(datamap map[T]V)
AddMapKeys adds keys from map to the list
func (*List[T, V]) AddSlice ¶
func (l *List[T, V]) AddSlice(dataslice []T)
AddSlice adds keys from slice to the list
func (*List[T, V]) RemoveSlice ¶
func (l *List[T, V]) RemoveSlice(dataslice []T)
RemoveSlice removes items from data using slice
type MatrixError ¶
MatrixError represents an error response from the Matrix API
func MatrixErrorFrom ¶
func MatrixErrorFrom(r io.Reader) *MatrixError
MatrixErrorFrom creates a new Matrix error from io.Reader
func NewMatrixError ¶
func NewMatrixError(code, err string) *MatrixError
NewMatrixError creates a new Matrix error
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
package format (markdown) is a markdown to html converter, heavily inspired by the mautrix-go/format package
|
package format (markdown) is a markdown to html converter, heavily inspired by the mautrix-go/format package |
Package template provides a handy wrapper around text/template package.
|
Package template provides a handy wrapper around text/template package. |
package workpool provides a simple work pool implementation
|
package workpool provides a simple work pool implementation |