core

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetComponent added in v0.0.4

func GetComponent[T IComponent](c *Context) T

func GetModel

func GetModel[T IModel](c *Context) T

func GetReNewModel added in v0.1.2

func GetReNewModel[T IModel](db *gorm.DB, c *Context) T

func GetRunner added in v0.1.2

func GetRunner[T IRunner](c *Context) T

func GetService added in v0.1.1

func GetService[T IService](c *Context) T

func UnmarshalConfig added in v0.1.2

func UnmarshalConfig[T any](key string, c *Context) T

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

func NewContext added in v0.1.2

func NewContext(config config2.IConfig, db *gorm.DB, schedule *Schedule) *Context

func (*Context) AddComponent added in v0.1.2

func (c *Context) AddComponent(components ...IComponent)

func (*Context) AddModel

func (c *Context) AddModel(model ...IModel)

func (*Context) AddRunner added in v0.1.2

func (c *Context) AddRunner(runner ...IRunner)

func (*Context) AddService

func (c *Context) AddService(services ...IService)

func (*Context) Any added in v0.1.2

func (c *Context) Any(relativePath string, handlers ...web.HandlerFunc)

func (*Context) AnyAuth added in v0.1.2

func (c *Context) AnyAuth(relativePath string, handlers ...web.HandlerFunc)

func (*Context) AnyRaw added in v0.1.2

func (c *Context) AnyRaw(relativePath string, handlers ...web.HandlerRawFunc)

func (*Context) AnyRawAuth added in v0.1.2

func (c *Context) AnyRawAuth(relativePath string, handlers ...web.HandlerRawFunc)

func (*Context) Copy

func (c *Context) Copy(digestAuth *web.DigestAuth, httpServer *web.HttpServer) *Context

func (*Context) Delete added in v0.1.2

func (c *Context) Delete(relativePath string, handlers ...web.HandlerFunc)

func (*Context) DeleteAuth added in v0.1.2

func (c *Context) DeleteAuth(relativePath string, handlers ...web.HandlerFunc)

func (*Context) DeleteRaw added in v0.1.2

func (c *Context) DeleteRaw(relativePath string, handlers ...web.HandlerRawFunc)

func (*Context) DeleteRawAuth added in v0.1.2

func (c *Context) DeleteRawAuth(relativePath string, handlers ...web.HandlerRawFunc)

func (*Context) Get

func (c *Context) Get(relativePath string, handlers ...web.HandlerFunc)

func (*Context) GetAuth

func (c *Context) GetAuth(relativePath string, handlers ...web.HandlerFunc)

func (*Context) GetComponent added in v0.0.4

func (c *Context) GetComponent(f func(m IComponent) bool) IComponent

func (*Context) GetConfig

func (c *Context) GetConfig() config2.IConfig

func (*Context) GetDB

func (c *Context) GetDB() *gorm.DB

func (*Context) GetModel

func (c *Context) GetModel(f func(m IModel) bool) IModel

func (*Context) GetRaw

func (c *Context) GetRaw(relativePath string, handlers ...web.HandlerRawFunc)

func (*Context) GetRawAuth

func (c *Context) GetRawAuth(relativePath string, handlers ...web.HandlerRawFunc)

func (*Context) GetRunner added in v0.1.2

func (c *Context) GetRunner(f func(m IRunner) bool) IRunner

func (*Context) GetSchedule added in v0.1.1

func (c *Context) GetSchedule() *Schedule

func (*Context) GetService

func (c *Context) GetService(f func(m IService) bool) IService

func (*Context) GetTransaction

func (c *Context) GetTransaction() *model.Transaction

func (*Context) Handle added in v0.1.2

func (c *Context) Handle(httpMethod, relativePath string, handlers ...web.HandlerFunc)

func (*Context) HandleAuth added in v0.1.2

func (c *Context) HandleAuth(httpMethod, relativePath string, handlers ...web.HandlerFunc)

func (*Context) HandleRaw added in v0.1.2

func (c *Context) HandleRaw(httpMethod, relativePath string, handlers ...web.HandlerRawFunc)

func (*Context) HandleRawAuth added in v0.1.2

func (c *Context) HandleRawAuth(httpMethod, relativePath string, handlers ...web.HandlerRawFunc)

func (*Context) Post

func (c *Context) Post(relativePath string, handlers ...web.HandlerFunc)

func (*Context) PostAuth

func (c *Context) PostAuth(relativePath string, handlers ...web.HandlerFunc)

func (*Context) PostRaw

func (c *Context) PostRaw(relativePath string, handlers ...web.HandlerRawFunc)

func (*Context) PostRawAuth

func (c *Context) PostRawAuth(relativePath string, handlers ...web.HandlerRawFunc)

func (*Context) Put added in v0.1.2

func (c *Context) Put(relativePath string, handlers ...web.HandlerFunc)

func (*Context) PutAuth added in v0.1.2

func (c *Context) PutAuth(relativePath string, handlers ...web.HandlerFunc)

func (*Context) PutRaw added in v0.1.2

func (c *Context) PutRaw(relativePath string, handlers ...web.HandlerRawFunc)

func (*Context) PutRawAuth added in v0.1.2

func (c *Context) PutRawAuth(relativePath string, handlers ...web.HandlerRawFunc)

func (*Context) Use added in v0.1.2

func (c *Context) Use(middlewareFunc ...MiddlewareFunc)

type IComponent added in v0.0.4

type IComponent interface {
	Init(Config config2.IConfig) error
	IDestroy
}

type IDestroy added in v0.1.2

type IDestroy interface {
	Destroy() error
}

type IModel

type IModel interface {
	IService
	IsExist() bool
	CreateTable() error
	DeleteTable() error
	GetTableName() string
	ReNew(db *gorm.DB, c *Context) IModel
}

type IRest

type IRest interface {
	IService
}

type IRunner added in v0.1.2

type IRunner interface {
	IService
	IDestroy
	Run() error
}

type IService

type IService interface {
	Init(Config *Context) error
}

type Info added in v0.1.1

type Info struct {
	UpdateTime time.Time
	Key        string
	// contains filtered or unexported fields
}

type MiddlewareFunc added in v0.1.2

type MiddlewareFunc func(request *web.Request, ctx *Context)

type RestGroup

type RestGroup struct {
	// contains filtered or unexported fields
}

func NewRestGroup

func NewRestGroup(serverConfig *web.ServerConfig) *RestGroup

func (*RestGroup) AddMiddlewares added in v0.1.2

func (rg *RestGroup) AddMiddlewares(middlewareFunc ...MiddlewareFunc) *RestGroup

func (*RestGroup) AddRest

func (rg *RestGroup) AddRest(rest ...IRest) *RestGroup

func (*RestGroup) Authentication

func (rg *RestGroup) Authentication(authentication web.Authentication) *RestGroup

func (*RestGroup) DigestAuth added in v0.1.2

func (rg *RestGroup) DigestAuth() *web.DigestAuth

func (*RestGroup) Merge added in v0.1.2

func (rg *RestGroup) Merge(restGroup *RestGroup) *RestGroup

func (*RestGroup) Port added in v0.1.2

func (rg *RestGroup) Port() int

type RouteInfo added in v0.1.2

type RouteInfo []string

type RouteTree added in v0.1.2

type RouteTree map[string]RouteInfo

func (RouteTree) Has added in v0.1.2

func (rt RouteTree) Has(method, path string) bool

func (RouteTree) Set added in v0.1.2

func (rt RouteTree) Set(method, path string)

type Schedule added in v0.1.1

type Schedule struct {
	// contains filtered or unexported fields
}

func NewSchedule added in v0.1.1

func NewSchedule() *Schedule

func (*Schedule) AddFunc added in v0.1.1

func (c *Schedule) AddFunc(spec string, cmd func()) (cron.EntryID, error)

func (*Schedule) AddIdOrReplaceKeyFunc added in v0.1.1

func (c *Schedule) AddIdOrReplaceKeyFunc(id uint, key string, spec string, cmd func()) (cron.EntryID, bool, error)

func (*Schedule) AddKeyFunc added in v0.1.1

func (c *Schedule) AddKeyFunc(key string, spec string, cmd func()) (cron.EntryID, bool, error)

func (*Schedule) Destroy added in v0.1.2

func (c *Schedule) Destroy() error

func (*Schedule) Init added in v0.1.1

func (c *Schedule) Init(config config2.IConfig) error

func (*Schedule) Name added in v0.1.1

func (c *Schedule) Name() string

func (*Schedule) ReplaceKeyFunc added in v0.1.1

func (c *Schedule) ReplaceKeyFunc(key string, spec string, cmd func()) (cron.EntryID, error)

func (*Schedule) Run added in v0.1.2

func (c *Schedule) Run() error

func (*Schedule) StopIdFunc added in v0.1.1

func (c *Schedule) StopIdFunc(id uint)

func (*Schedule) StopKeyFunc added in v0.1.1

func (c *Schedule) StopKeyFunc(key string)

type ScheduleConfig added in v0.1.1

type ScheduleConfig struct {
	Enable bool
}

func (*ScheduleConfig) Key added in v0.1.1

func (c *ScheduleConfig) Key() string

type Server added in v0.1.2

type Server struct {
	// contains filtered or unexported fields
}

func NewServer added in v0.1.2

func NewServer(restGroups []*RestGroup, runners []IRunner) *Server

func (*Server) Destroy added in v0.1.2

func (server *Server) Destroy() error

func (*Server) Init added in v0.1.2

func (server *Server) Init(context *Context) error

func (*Server) Run added in v0.1.2

func (server *Server) Run() error

Jump to

Keyboard shortcuts

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