core

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 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 DateFormat

func DateFormat(t time.Time, layout string) string

func Err

func Err(c *Ctx, code int) error

func GetAdminObjects

func GetAdminObjects() []object.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 Now

func Now() time.Time

func Ok

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

func ParseDate

func ParseDate(date string) time.Time

func Push

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

func RandNumberText

func RandNumberText(n int) string

func RandText

func RandText(n int) string

func RegisterAdminCheckRouter

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

func RegisterAdminObject

func RegisterAdminObject(objs []object.AdminObject)

func RegisterCheckRouter

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

func RegisterDatabase

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

func RegisterNoCheckRouter

func RegisterNoCheckRouter(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 SetZoneOffset

func SetZoneOffset(offset int)

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