Documentation
¶
Index ¶
- Constants
- Variables
- func GetRequestBody(req *http.Request) ([]byte, error)
- func InitRedisClient() (err error)
- func LimitReader(r io.Reader, n int64) io.Reader
- func NeedColor() bool
- func RedisDel(key string) error
- func RedisGet(key string) (string, error)
- func RedisSet(key string, value string, expiration time.Duration) error
- func SetEventStreamHeaders(c *gin.Context)
- func TruncateByRune[T ~string](s T, length int) T
- func TruncateBytesByRune(b []byte, length int) []byte
- func UnmarshalBody2Node(req *http.Request) (ast.Node, error)
- func UnmarshalBodyReusable(req *http.Request, v any) error
- type LimitedReader
- type RequestBodyKey
Constants ¶
View Source
const (
MaxRequestBodySize = 1024 * 1024 * 50 // 50MB
)
Variables ¶
View Source
var ( UsingSQLite = false UsingPostgreSQL = false UsingMySQL = false )
View Source
var ( SQLitePath = env.String("SQLITE_PATH", "aiproxy.db") SQLiteBusyTimeout = env.Int64("SQLITE_BUSY_TIMEOUT", 3000) )
View Source
var ( RDB *redis.Client RedisEnabled = false )
View Source
var ErrLimitedReaderExceeded = errors.New("limited reader exceeded")
View Source
var StartTime = time.Now().UnixMilli() // unit: millisecond
Functions ¶
func InitRedisClient ¶
func InitRedisClient() (err error)
InitRedisClient This function is called after init()
func SetEventStreamHeaders ¶
func TruncateByRune ¶
func TruncateBytesByRune ¶
Types ¶
type LimitedReader ¶
type RequestBodyKey ¶
type RequestBodyKey struct{}
Click to show internal directories.
Click to hide internal directories.