Documentation ¶
Overview ¶
From https://github.com/livekit/livekit/blob/master/pkg/sfu/streamallocator/trenddetector.go
Index ¶
- func ArrayIn[T comparable](val T, array []T) (exists bool, index int)
- func Color(str string) string
- func Colorf(format string, a ...any) string
- func CreateJPGImage(img *image.RGBA, quality int) ([]byte, error)
- func CreatePNGImage(img *image.RGBA) ([]byte, error)
- func CreatePNGImageURI(img *image.RGBA) (string, error)
- func GenerateUID(alphabet string, size int) (string, error)
- func HttpJsonRequest(w http.ResponseWriter, r *http.Request, res any) error
- func HttpJsonResponse(w http.ResponseWriter, code int, res any)
- func HttpRequestGET(url string) (string, error)
- func HttpSuccess(w http.ResponseWriter, res ...any) error
- func JsonStringAutoDecode(m any) func(rf reflect.Kind, rt reflect.Kind, data any) (any, error)
- func NewUID(param ...int) (string, error)
- func Unmarshal(in any, raw []byte, callback func() error) error
- func Unzip(zipPath, target string) error
- func Zip(source, zipPath string) error
- type Generator
- type HTTPError
- func HttpBadRequest(res ...string) *HTTPError
- func HttpError(code int, res ...string) *HTTPError
- func HttpForbidden(res ...string) *HTTPError
- func HttpInternalServerError(res ...string) *HTTPError
- func HttpNotFound(res ...string) *HTTPError
- func HttpUnauthorized(res ...string) *HTTPError
- func HttpUnprocessableEntity(res ...string) *HTTPError
- func (e *HTTPError) Cause() error
- func (e *HTTPError) Error() string
- func (e *HTTPError) Msg(str string) *HTTPError
- func (e *HTTPError) Msgf(fmtSt string, args ...any) *HTTPError
- func (e *HTTPError) WithInternalErr(err error) *HTTPError
- func (e *HTTPError) WithInternalMsg(msg string) *HTTPError
- func (e *HTTPError) WithInternalMsgf(fmtStr string, args ...any) *HTTPError
- type TrendDetector
- func (t *TrendDetector) AddValue(value int64)
- func (t *TrendDetector) GetDirection() TrendDirection
- func (t *TrendDetector) GetHighest() int64
- func (t *TrendDetector) GetLowest() int64
- func (t *TrendDetector) GetValues() []int64
- func (t *TrendDetector) Seed(value int64)
- func (t *TrendDetector) ToString() string
- type TrendDetectorParams
- type TrendDirection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayIn ¶
func ArrayIn[T comparable](val T, array []T) (exists bool, index int)
func GenerateUID ¶
GenerateUID is a low-level function to change alphabet and ID size.
func HttpJsonRequest ¶
func HttpJsonResponse ¶
func HttpJsonResponse(w http.ResponseWriter, code int, res any)
func HttpRequestGET ¶
func HttpSuccess ¶
func HttpSuccess(w http.ResponseWriter, res ...any) error
func JsonStringAutoDecode ¶
Types ¶
type HTTPError ¶
type HTTPError struct { Code int `json:"code"` Message string `json:"message"` InternalErr error `json:"-"` InternalMsg string `json:"-"` }
HTTPError is an error with a message and an HTTP status code.
func HttpBadRequest ¶
func HttpForbidden ¶
func HttpInternalServerError ¶
func HttpNotFound ¶
func HttpUnauthorized ¶
func HttpUnprocessableEntity ¶
func (*HTTPError) WithInternalErr ¶
WithInternalErr adds internal error information to the error
func (*HTTPError) WithInternalMsg ¶
WithInternalMsg adds internal message information to the error
type TrendDetector ¶ added in v1.6.12
type TrendDetector struct {
// contains filtered or unexported fields
}
func NewTrendDetector ¶ added in v1.6.12
func NewTrendDetector(params TrendDetectorParams) *TrendDetector
func (*TrendDetector) AddValue ¶ added in v1.6.12
func (t *TrendDetector) AddValue(value int64)
func (*TrendDetector) GetDirection ¶ added in v1.6.12
func (t *TrendDetector) GetDirection() TrendDirection
func (*TrendDetector) GetHighest ¶ added in v1.6.12
func (t *TrendDetector) GetHighest() int64
func (*TrendDetector) GetLowest ¶ added in v1.6.12
func (t *TrendDetector) GetLowest() int64
func (*TrendDetector) GetValues ¶ added in v1.6.12
func (t *TrendDetector) GetValues() []int64
func (*TrendDetector) Seed ¶ added in v1.6.12
func (t *TrendDetector) Seed(value int64)
func (*TrendDetector) ToString ¶ added in v1.6.12
func (t *TrendDetector) ToString() string
type TrendDetectorParams ¶ added in v1.6.12
type TrendDirection ¶ added in v1.6.12
type TrendDirection int
const ( TrendDirectionNeutral TrendDirection = iota TrendDirectionUpward TrendDirectionDownward )
func (TrendDirection) String ¶ added in v1.6.12
func (t TrendDirection) String() string
Click to show internal directories.
Click to hide internal directories.