core

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(password, plain string) bool

func Err

func Err(c *Ctx, statusCode, code int) error

func Error added in v0.2.1

func Error(c *Ctx, statusCode int, err error) error

func GetAdminObjects

func GetAdminObjects() []model.AdminObject

func HashPassword

func HashPassword(password string) string

func I32

func I32(c *Ctx, key string, defaultValue ...string) int32

func I64

func I64(c *Ctx, key string, defaultValue ...string) int64

func IP

func IP(c *Ctx) string

IP get remote IP

func Int

func Int(c *Ctx, key string, defaultValue ...string) int

func Lang

func Lang() string

func Msg

func Msg(c *Ctx, code int, msg string) error

Msg push common response

func Ok

func Ok(c *fiber.Ctx, data interface{}) error

func Push

func Push(c *fiber.Ctx, code int) error

func RegisterAPIAuth added in v0.2.1

func RegisterAPIAuth(fn func(ctx *fiber.Ctx) error)

func RegisterAPICheckRouter added in v0.2.0

func RegisterAPICheckRouter(routerType string, f func(fiber.Router))

func RegisterAPINoCheckRouter added in v0.2.0

func RegisterAPINoCheckRouter(routerType string, f func(fiber.Router))

func RegisterAdminAuth added in v0.2.1

func RegisterAdminAuth(fn func(ctx *fiber.Ctx) error)

func RegisterAdminCheckRouter

func RegisterAdminCheckRouter(routerType string, f func(fiber.Router))

func RegisterAdminObject

func RegisterAdminObject(objs []model.AdminObject)

func RegisterDatabase

func RegisterDatabase(dbType string, f func([]*gorm.DB))

func RegisterPublicNoCheckRouter added in v0.2.1

func RegisterPublicNoCheckRouter(routerType string, f func(fiber.Router))

func RegisterRootCheckRouter added in v0.2.0

func RegisterRootCheckRouter(routerType string, f func(fiber.Router))

func Render

func Render(c *Ctx, name string, bind interface{}, layouts ...string) error

func SafeCall

func SafeCall(f func() error, failHandle func(error)) error

func SetLang

func SetLang(l string)

func SetupDatabase

func SetupDatabase(dbs []*gorm.DB)

func SetupRouter

func SetupRouter(app *fiber.App)

func Str

func Str(c *Ctx, key string, defaultValue ...string) string

func StructAsMap

func StructAsMap(form any, fields []string) (vals map[string]any)

func U32

func U32(c *Ctx, key string, defaultValue ...string) uint32

func U64

func U64(c *Ctx, key string, defaultValue ...string) uint64

func Uint

func Uint(c *Ctx, key string, defaultValue ...string) uint

func Validate

func Validate(i interface{}) error

func ViewEngineStart

func ViewEngineStart() *html.Engine

Types

type Ctx

type Ctx = fiber.Ctx

type ExpiredLRUCache

type ExpiredLRUCache[K comparable, V any] struct {
	*lru.Cache[K, expiredLRUCacheValue[V]]
	// contains filtered or unexported fields
}

func NewExpiredLRUCache

func NewExpiredLRUCache[K comparable, V any](size int, expired time.Duration) *ExpiredLRUCache[K, V]

func (*ExpiredLRUCache[K, V]) Add

func (c *ExpiredLRUCache[K, V]) Add(key K, value V) (evicted bool)

func (*ExpiredLRUCache[K, V]) Contains

func (c *ExpiredLRUCache[K, V]) Contains(key K) bool

func (*ExpiredLRUCache[K, V]) Get

func (c *ExpiredLRUCache[K, V]) Get(key K) (value V, ok bool)

func (*ExpiredLRUCache[K, V]) Remove

func (c *ExpiredLRUCache[K, V]) Remove(key K) (present bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL