Documentation
¶
Index ¶
- Variables
- func Base64Decode(s string) string
- func Base64Encode(s string) string
- func Contains[T comparable](slice []T, value T) bool
- func ErrorJson(err error) map[string]any
- func ErrorStr(err string, format ...any) map[string]any
- func Exists[T comparable](v []T, el T) bool
- func ExistsMap[T any, U comparable](v []T, el U, mapper func(T) U) bool
- func FindMap[T any, U comparable](v []T, el U, mapper func(T) U) *T
- func FormatValidationError(err validator.FieldError) string
- func FormatValidationErrors(errors validator.ValidationErrors) string
- func GenerateImageProxyToken(imageUrl string) (string, error)
- func GetEmoji(input string) (emoji string, ok bool)
- func GetPermissionLevel(ctx context.Context, guildId, userId uint64) (permission.PermissionLevel, error)
- func GetUrlHost(rawUrl string) string
- func GetUserId(store sessions.Session) uint64
- func HasPermissionToViewTicket(ctx context.Context, guildId, userId uint64, ticket database.Ticket) (bool, *api.RequestError)
- func IsInt(str string) bool
- func IsLoggedIn(store sessions.Session) bool
- func LoadEmoji()
- func Map[T comparable, U any](slice []T, f func(T) U) []U
- func Must(err error)
- func ProxyHook(token string, req *http.Request)
- func Ptr[T any](v T) *T
- func RandString(length int) (string, error)
- func ReadFile(path string) (string, error)
- func Reverse(slice []message.Message) []message.Message
- func RoleToId(role guild.Role) uint64
- func SecondLevelDomain(domain string) string
- func SetNilIfZero[T comparable](value **T)
- func Slice[T any](v ...T) []T
- func StringMax(str string, max int, suffix ...string) string
- func ToSet[T comparable](slice []T) *collections.Set[T]
- func ValueOrZero[T any](v *T) T
- type GuildDto
- type HexColour
Constants ¶
This section is empty.
Variables ¶
View Source
var ArchiverClient *archiverclient.ArchiverClient
View Source
var SecureProxyClient *secureproxy.Client
View Source
var SuccessResponse = gin.H{ "success": true, }
Functions ¶
func Base64Decode ¶
func Base64Encode ¶
func Contains ¶
func Contains[T comparable](slice []T, value T) bool
func Exists ¶
func Exists[T comparable](v []T, el T) bool
func ExistsMap ¶
func ExistsMap[T any, U comparable](v []T, el U, mapper func(T) U) bool
func FindMap ¶
func FindMap[T any, U comparable](v []T, el U, mapper func(T) U) *T
func FormatValidationError ¶
func FormatValidationError(err validator.FieldError) string
func FormatValidationErrors ¶
func FormatValidationErrors(errors validator.ValidationErrors) string
func GenerateImageProxyToken ¶
func GetPermissionLevel ¶
func GetPermissionLevel(ctx context.Context, guildId, userId uint64) (permission.PermissionLevel, error)
func GetUrlHost ¶
func HasPermissionToViewTicket ¶
func HasPermissionToViewTicket(ctx context.Context, guildId, userId uint64, ticket database.Ticket) (bool, *api.RequestError)
TODO: Use this on the ticket list
func IsLoggedIn ¶
func Map ¶
func Map[T comparable, U any](slice []T, f func(T) U) []U
func ProxyHook ¶
Twilight's HTTP proxy doesn't support the typical HTTP proxy protocol - instead you send the request directly to the proxy's host in the URL. This is not how Go's proxy function should be used, but it works :)
func RandString ¶
func SecondLevelDomain ¶
func SetNilIfZero ¶
func SetNilIfZero[T comparable](value **T)
func ToSet ¶
func ToSet[T comparable](slice []T) *collections.Set[T]
func ValueOrZero ¶
func ValueOrZero[T any](v *T) T
Types ¶
type GuildDto ¶
type GuildDto struct { Id uint64 `json:"id,string"` Name string `json:"name"` Icon string `json:"icon"` PermissionLevel permission.PermissionLevel `json:"permission_level"` }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.