core

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultName = "DefaultName"

Variables

This section is empty.

Functions

func GetComponent added in v0.0.4

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

func GetFilter added in v0.1.3

func GetFilter[T IFilter](c *Context) T

func GetModel

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

func GetReNewModel added in v0.1.2

func GetReNewModel[T IModel](db *db.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 UnmarshalKeyConfig added in v0.1.3

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

Types

type Context

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

func NewContext added in v0.1.2

func NewContext(config config2.IConfig, defaultModelGroup IModelGroup) *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) AddModelGroup added in v0.1.3

func (c *Context) AddModelGroup(modelGroup ...IModelGroup)

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) *web.HandlerInfo

func (*Context) CertManager added in v0.1.3

func (c *Context) CertManager() *web.CertManager

func (*Context) Copy

func (c *Context) Copy(handlerConfig *web.HandlerConfig, filters []IFilter) *Context

func (*Context) DefaultModelGroup added in v0.1.3

func (c *Context) DefaultModelGroup() IModelGroup

func (*Context) Delete added in v0.1.2

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

func (*Context) Get

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

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) GetFilter added in v0.1.3

func (c *Context) GetFilter(f func(m IFilter) bool) IFilter

func (*Context) GetModel

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

func (*Context) GetModelGroup added in v0.1.3

func (c *Context) GetModelGroup(name string) IModelGroup

func (*Context) GetRunner added in v0.1.2

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

func (*Context) GetService

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

func (*Context) GetTransaction

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

func (*Context) Go added in v0.1.3

func (c *Context) Go(f func(c *Context))

func (*Context) Post

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

func (*Context) Put added in v0.1.2

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

type IComponent added in v0.0.4

type IComponent interface {
	Init(ctx context.Context, config config2.IConfig) error
}

type IConverter added in v0.1.3

type IConverter interface {
	IService
	web.Converter
}

type IFilter added in v0.1.3

type IFilter interface {
	IService
	web.Filter
}

type IModel

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

type IModelGroup added in v0.1.3

type IModelGroup interface {
	IService
	AddModel(model ...IModel)
	GetModel() []IModel
	AutoCreateTable(autoCreateTable bool)
	SwitchDB(db *db.DB, context *Context) error
	SetDefaultDB(db *db.DB)
	Name() string
	GetTransaction() *model.Transaction
}

type IRest

type IRest interface {
	IService
}

type IRun added in v0.1.3

type IRun interface {
	Run(ctx context.Context) error
}

type IRunner added in v0.1.2

type IRunner interface {
	IService
	Run(ctx context.Context) error
}

type IService

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

type ModelGroup added in v0.1.3

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

func DefaultModelGroup added in v0.1.3

func DefaultModelGroup() *ModelGroup

func EmptyModelGroup added in v0.1.3

func EmptyModelGroup(name string) *ModelGroup

func NewModelGroup added in v0.1.3

func NewModelGroup(db *db.DB, name string) *ModelGroup

func (*ModelGroup) AddModel added in v0.1.3

func (m *ModelGroup) AddModel(model ...IModel)

func (*ModelGroup) AutoCreateTable added in v0.1.4

func (m *ModelGroup) AutoCreateTable(autoCreateTable bool)

func (*ModelGroup) GetModel added in v0.1.3

func (m *ModelGroup) GetModel() []IModel

func (*ModelGroup) GetTransaction added in v0.1.3

func (m *ModelGroup) GetTransaction() *model.Transaction

func (*ModelGroup) Init added in v0.1.3

func (m *ModelGroup) Init(context *Context) error

func (*ModelGroup) Name added in v0.1.3

func (m *ModelGroup) Name() string

func (*ModelGroup) SetDefaultDB added in v0.1.4

func (m *ModelGroup) SetDefaultDB(db *db.DB)

func (*ModelGroup) SwitchDB added in v0.1.3

func (m *ModelGroup) SwitchDB(db *db.DB, context *Context) error

type RestGroup

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

func NewRestGroup

func NewRestGroup(serverConfig *web.ServerConfig, converter IConverter, handles *web.Handles) *RestGroup

func (*RestGroup) AddFilter added in v0.1.3

func (rg *RestGroup) AddFilter(filter ...IFilter) *RestGroup

func (*RestGroup) AddRest

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

func (*RestGroup) Converter added in v0.1.3

func (rg *RestGroup) Converter(converter IConverter) *RestGroup

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 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) Init added in v0.1.2

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

func (*Server) Run added in v0.1.2

func (server *Server) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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