Documentation
¶
Index ¶
- Constants
- func Clean()
- func DeleteComponentByPkg(pkgPath string) error
- func DeleteImplement(impl *ImplementStmt) error
- func DeleteProviderByPkg(pkg string) error
- func DeleteProviderRequirementByPkg(pkgPath string) error
- func Init()
- func Insert(value ITable) error
- func NamedSelect[T any](query string, args interface{}) ([]T, error)
- func SaveComponent(c *Component) error
- func SaveImplement(impl *ImplementStmt) error
- func SaveProvider(c *Provider) error
- func SaveProviderRequirement(c *ProviderRequirement) error
- func Select[T any](query string, args ...interface{}) ([]T, error)
- type Component
- type ITable
- type ImplementStmt
- type Provider
- type ProviderRequirement
- type Q
Constants ¶
View Source
const SqlCountComponentById = `
select count(1) from components t
where 1 = 1
and t.cmp_pkg_path = ?
and t.cmp_typ_name = ?
`
View Source
const SqlDeleteImplementStmtById = `` /* 210-byte string literal not displayed */
View Source
const SqlDeleteProviderById = `
delete from providers
where 1 = 1
and pvd_pkg_path = ?
and pvd_ori_name = ?
`
View Source
const SqlDeleteProviderRequirementById = `` /* 195-byte string literal not displayed */
View Source
const SqlFindComponentById = `
select * from components t
where 1 = 1
and t.cmp_pkg_path = ?
and t.cmp_typ_name = ?
`
View Source
const SqlFindImplementStmtById = `` /* 212-byte string literal not displayed */
View Source
const SqlFindProviderRequirementByCmpType = `
select * from provider_requirements t
where 1 = 1
and t.pvd_pkg_path = ?
and t.pvd_ori_name = ?
and t.pvd_kind = ?
`
View Source
const TableComponents = `` /* 214-byte string literal not displayed */
TableComponents 该表存储每个Component的信息
View Source
const TableImplementStmts = `` /* 278-byte string literal not displayed */
TableProvider 该表存储Provider的信息和它所能提供的component
View Source
const TableProviderRequirements = `` /* 427-byte string literal not displayed */
TableProviderRequirement 该表存储Provider的信息和它所需要的所有的components
View Source
const TableProviders = `` /* 321-byte string literal not displayed */
TableProvider 该表存储Provider的信息和它所能提供的component
Variables ¶
This section is empty.
Functions ¶
func DeleteComponentByPkg ¶
func DeleteImplement ¶
func DeleteImplement(impl *ImplementStmt) error
func DeleteProviderByPkg ¶
func NamedSelect ¶
func SaveComponent ¶
func SaveImplement ¶
func SaveImplement(impl *ImplementStmt) error
func SaveProvider ¶
func SaveProviderRequirement ¶
func SaveProviderRequirement(c *ProviderRequirement) error
Types ¶
type Component ¶
type ImplementStmt ¶
type ImplementStmt struct {
// component related information
CmpPkgPath string `db:"cmp_pkg_path"`
CmpTypName string `db:"cmp_typ_name"`
// component kind can be found at [types.TypeKind]
// see /dot/internal/types/util.go
CmpKind int `db:"cmp_kind"`
IfacePkgPath string `db:"iface_pkg_path"`
// name is the id field
IfaceName string `db:"iface_name"`
Labels string `db:"labels"`
}
func FindImplementsByImpl ¶
func FindImplementsByImpl(impl *ImplementStmt) ([]ImplementStmt, error)
func FindImplementsByInterface ¶
func FindImplementsByInterface(interfacePackage string, interfaceName string) ([]ImplementStmt, error)
func (*ImplementStmt) IocLabels ¶
func (i *ImplementStmt) IocLabels() string
func (*ImplementStmt) TableName ¶
func (*ImplementStmt) TableName() string
type Provider ¶
type Provider struct {
//
PvdPkgPath string `db:"pvd_pkg_path"`
// note that here the package name might be rewrote
PvdPkgName string `db:"pvd_pkg_name"`
// the original provider name. typically func name or struct name
// func named is used to be write to the wire.Set
PvdOriName string `db:"pvd_ori_name"`
// name is the id field
PvdName string `db:"pvd_name"`
// provider kind, eg: use function or direct a variable
PvdKind string `db:"pvd_kind"`
// 1 represent that results contains error
PvdError int `db:"pvd_error"`
// component related information
CmpPkgPath string `db:"cmp_pkg_path"`
CmpPkgName string `db:"cmp_pkg_name"`
CmpTypName string `db:"cmp_typ_name"`
// component kind can be found at [types.TypeKind]
// see /dot/internal/types/util.go
CmpKind int `db:"cmp_kind"`
Labels string `db:"labels"`
}
type ProviderRequirement ¶
type ProviderRequirement struct {
PvdPkgPath string `db:"pvd_pkg_path"`
PvdPkgName string `db:"pvd_pkg_name"`
PvdOriName string `db:"pvd_ori_name"`
PvdName string `db:"pvd_name"`
PvdKind string `db:"pvd_kind"`
CmpPkgPath string `db:"cmp_pkg_path"`
CmpPkgName string `db:"cmp_pkg_name"`
CmpTypName string `db:"cmp_typ_name"`
// multiple params may have same type, thus use param name to distinct each other
CmpName string `db:"cmp_name"`
CmpKind int `db:"cmp_kind"`
// go:ioc --param name.provider="NewLiu"
CmpPvdName string `db:"cmp_pvd_name"`
Labels string `db:"labels"`
}
ProviderRequirement
func FindProviderRequirements ¶
func FindProviderRequirements(c *Provider) ([]ProviderRequirement, error)
FindProviderRequirements
select * from provider_requirements t where 1 = 1 and t.pvd_pkg_path = ? and t.pvd_ori_name = ? and t.pvd_kind = ?
func (*ProviderRequirement) IocLabels ¶
func (p *ProviderRequirement) IocLabels() string
func (*ProviderRequirement) TableName ¶
func (*ProviderRequirement) TableName() string
Click to show internal directories.
Click to hide internal directories.