Documentation ¶
Index ¶
- func AcctInfo(acct string) (username, host string)
- func Contains[T comparable](list []T, item T) bool
- func GetFieldsAttributes(values map[string][]string) (fields []accountField)
- func GetHeaderToken(header http.Header) (string, error)
- func GetMentions(text string) []string
- func JoinURL(server string, p ...string) string
- func SliceIfNull[T any](slice []T) []T
- func StrEvaluation(str ...string) (v string, ok bool)
- func Unique[T comparable](list []T) []T
- type Map
- type StrMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[T comparable](list []T, item T) bool
Contains returns true if the list contains the item, false otherwise.
func GetFieldsAttributes ¶
GetFieldsAttributes converts a map of fields to a slice of accountFields The map of fields is expected to have keys in the form fields_attributes[<index>][<tag>] Where <index> is an integer and <tag> is one of "name" or "value". The order of the accountFields in the returned slice is determined by the order of the <index> values.
func GetHeaderToken ¶
GetHeaderToken extracts the token from the Authorization header, if any.
func GetMentions ¶
func SliceIfNull ¶
func SliceIfNull[T any](slice []T) []T
SliceIfNull returns the given slice if it is not nil, or an empty slice if it is nil.
func StrEvaluation ¶
StrEvaluation evaluates a list of strings and returns the first non-empty string, or an empty string if no non-empty strings are found.
func Unique ¶
func Unique[T comparable](list []T) []T
Unique returns a new list containing only the unique elements of list. The order of the elements is preserved.