Documentation ¶
Index ¶
- Constants
- Variables
- func BackendFactory() caskin.CustomizedData
- func FeatureFactory() caskin.CustomizedData
- func FrontendFactory() caskin.CustomizedData
- func GetBackendRootObject() caskin.Object
- func GetFeatureRootObject() caskin.Object
- func GetFrontendRootObject() caskin.Object
- func ManualCreateRootObject(db caskin.MetaDB, factory caskin.ObjectFactory, domain caskin.Domain) (err error)
- func TopSort(tree Relations) []uint64
- type Backend
- type CasbinStruct
- type Dump
- type DumpFileStruct
- type DumpRelation
- type Executor
- func (e *Executor) AuthBackendAPIEnforce(backend *Backend) error
- func (e *Executor) AuthFrontend() []*Frontend
- func (e *Executor) AuthFrontendCaskinStruct(subject string) (*CasbinStruct, error)
- func (e *Executor) BuildVersion() error
- func (e *Executor) CreateBackend(backend *Backend, object caskin.Object) error
- func (e *Executor) CreateFeature(feature *Feature, object caskin.Object) error
- func (e *Executor) CreateFrontend(frontend *Frontend, object caskin.Object) error
- func (e *Executor) DeleteBackend(object caskin.Object) error
- func (e *Executor) DeleteFeature(object caskin.Object) error
- func (e *Executor) DeleteFrontend(object caskin.Object) error
- func (e *Executor) Dump() (*Dump, error)
- func (e *Executor) GetBackend() ([]*caskin.CustomizedDataPair, error)
- func (e *Executor) GetFeature() ([]*caskin.CustomizedDataPair, error)
- func (e *Executor) GetFeatureRelation() (Relations, error)
- func (e *Executor) GetFeatureRelationByFeature(object caskin.Object) (Relation, error)
- func (e *Executor) GetFrontend() ([]*caskin.CustomizedDataPair, error)
- func (e *Executor) GetLatestVersion() (*WebFeatureVersion, error)
- func (e *Executor) GetVersion() ([]*WebFeatureVersion, error)
- func (e *Executor) ModifyFeatureRelationPerFeature(object caskin.Object, relation Relation) error
- func (e *Executor) NormalDomainGetFeatureObject() ([]caskin.Object, error)
- func (e *Executor) NormalDomainGetPolicyList() ([]*caskin.Policy, error)
- func (e *Executor) NormalDomainGetPolicyListByRole(role caskin.Role) ([]*caskin.Policy, error)
- func (e *Executor) NormalDomainModifyPolicyListPerRole(role caskin.Role, input []*caskin.Policy) error
- func (e *Executor) RecoverBackend(backend *Backend, object caskin.Object) error
- func (e *Executor) RecoverFeature(feature *Feature, object caskin.Object) error
- func (e *Executor) RecoverFrontend(frontend *Frontend, object caskin.Object) error
- func (e *Executor) SyncLatestVersionToAllDomain() error
- func (e *Executor) SyncVersionToAllDomain(version *WebFeatureVersion) error
- func (e *Executor) SyncVersionToOneDomain(version *WebFeatureVersion, domain caskin.Domain) error
- func (e *Executor) UpdateBackend(backend *Backend, object caskin.Object) error
- func (e *Executor) UpdateFeature(feature *Feature, object caskin.Object) error
- func (e *Executor) UpdateFrontend(frontend *Frontend, object caskin.Object) error
- type Feature
- type Frontend
- type FrontendType
- type Options
- type Relation
- type Relations
- type VersionedDomain
- type WebFeature
- type WebFeatureVersion
Constants ¶
View Source
const ( ObjectTypeFeature caskin.ObjectType = "feature" ObjectTypeFrontend caskin.ObjectType = "frontend" ObjectTypeBackend caskin.ObjectType = "backend" )
Variables ¶
View Source
var ( DefaultSuperRootName = "github.com/awatercolorpen/caskin/web_feature" DefaultFeatureRootName = "feature-root" DefaultFeatureRootDescription = "root node of feature object" DefaultFeatureRootGroup = "" DefaultFrontendRootKey = "frontend-root" DefaultFrontendRootType = FrontendTypeNil DefaultFrontendRootDescription = "root node of frontend object" DefaultFrontendRootGroup = "" DefaultBackendRootPath = "backend-root" DefaultBackendRootMethod = "" DefaultBackendRootDescription = "root node of backend object" DefaultBackendRootGroup = "" DefaultWebFeatureVersionTableName = "caskin_web_feature_versions" )
View Source
var ( // local cache for LocalCache = cache.New(2*time.Minute, 5*time.Minute) )
Functions ¶
func BackendFactory ¶
func BackendFactory() caskin.CustomizedData
func FeatureFactory ¶
func FeatureFactory() caskin.CustomizedData
func FrontendFactory ¶
func FrontendFactory() caskin.CustomizedData
func GetBackendRootObject ¶
func GetFeatureRootObject ¶
func GetFrontendRootObject ¶
func ManualCreateRootObject ¶
Types ¶
type Backend ¶
type Backend struct { Path string `json:"path"` Method string `json:"method"` Description string `json:"description"` Group string `json:"group"` }
Backend
func (*Backend) GetObjectType ¶
func (b *Backend) GetObjectType() caskin.ObjectType
func (*Backend) JSONQuery ¶
func (b *Backend) JSONQuery() []*datatypes.JSONQueryExpression
type CasbinStruct ¶
type Dump ¶
type Dump struct { Feature []*caskin.CustomizedDataPair `json:"feature"` Frontend []*caskin.CustomizedDataPair `json:"frontend"` Backend []*caskin.CustomizedDataPair `json:"backend"` FeatureTree Relations `json:"feature_tree"` FrontendTree Relations `json:"frontend_tree"` BackendTree Relations `json:"backend_tree"` FeatureRelation Relations `json:"feature_relation"` }
func NewDump ¶
func NewDump(feature, frontend, backend []*caskin.CustomizedDataPair, relations Relations) *Dump
func (*Dump) InitFeatureRelationMap ¶
func (*Dump) InitSingleFeatureRelation ¶
func (*Dump) ToRelation ¶
func (d *Dump) ToRelation() *DumpRelation
type DumpFileStruct ¶
type DumpFileStruct struct { Feature []*Feature `json:"feature"` Frontend []*Frontend `json:"frontend"` Backend []*Backend `json:"backend"` VirtualIndexFeatureTree Relations `json:"virtual_index_feature_tree"` VirtualIndexFrontendTree Relations `json:"virtual_index_frontend_tree"` VirtualIndexBackendTree Relations `json:"virtual_index_backend_tree"` VirtualIndexFeatureRelation Relations `json:"virtual_index_feature_relation"` }
func (*DumpFileStruct) ExportToFile ¶
func (d *DumpFileStruct) ExportToFile(name string) error
func (*DumpFileStruct) ExportToWebFeature ¶
func (d *DumpFileStruct) ExportToWebFeature(w *WebFeature) error
func (*DumpFileStruct) ImportFromDump ¶
func (d *DumpFileStruct) ImportFromDump(dump *Dump) error
func (*DumpFileStruct) ImportFromFile ¶
func (d *DumpFileStruct) ImportFromFile(name string) error
func (*DumpFileStruct) IsValid ¶
func (d *DumpFileStruct) IsValid() error
type DumpRelation ¶
type DumpRelation struct { FeatureTree Relations `json:"feature_tree"` FrontendTree Relations `json:"frontend_tree"` BackendTree Relations `json:"backend_tree"` FeatureRelation Relations `json:"feature_relation"` }
func (*DumpRelation) MergedRelation ¶
func (d *DumpRelation) MergedRelation() Relations
func (*DumpRelation) Scan ¶
func (d *DumpRelation) Scan(value interface{}) error
Scan scan value into Jsonb, implements sql.Scanner interface
func (DumpRelation) Value ¶
func (d DumpRelation) Value() (driver.Value, error)
Value return json value, implement driver.Valuer interface
func (*DumpRelation) Version ¶
func (d *DumpRelation) Version() string
type Executor ¶
type Executor struct { FeatureRootObject func() caskin.Object // contains filtered or unexported fields }
func (*Executor) AuthBackendAPIEnforce ¶
func (*Executor) AuthFrontend ¶
func (*Executor) AuthFrontendCaskinStruct ¶
func (e *Executor) AuthFrontendCaskinStruct(subject string) (*CasbinStruct, error)
func (*Executor) BuildVersion ¶
func (*Executor) CreateBackend ¶
func (*Executor) CreateFeature ¶
func (*Executor) CreateFrontend ¶
func (*Executor) GetBackend ¶
func (e *Executor) GetBackend() ([]*caskin.CustomizedDataPair, error)
func (*Executor) GetFeature ¶
func (e *Executor) GetFeature() ([]*caskin.CustomizedDataPair, error)
func (*Executor) GetFeatureRelation ¶
GetFeatureRelation 1. get all feature to backend and frontend 's relations, not inheritance relations
func (*Executor) GetFeatureRelationByFeature ¶
GetFeatureRelationByFeature 1. get one feature to backend and frontend 's relation, not inheritance relation
func (*Executor) GetFrontend ¶
func (e *Executor) GetFrontend() ([]*caskin.CustomizedDataPair, error)
func (*Executor) GetLatestVersion ¶
func (e *Executor) GetLatestVersion() (*WebFeatureVersion, error)
func (*Executor) GetVersion ¶
func (e *Executor) GetVersion() ([]*WebFeatureVersion, error)
func (*Executor) ModifyFeatureRelationPerFeature ¶
ModifyFeatureRelationPerFeature 1. modify one feature to backend and frontend 's relation, not inheritance relation
func (*Executor) NormalDomainGetFeatureObject ¶
func (*Executor) NormalDomainGetPolicyList ¶
func (*Executor) NormalDomainGetPolicyListByRole ¶
func (*Executor) NormalDomainModifyPolicyListPerRole ¶
func (*Executor) RecoverBackend ¶
func (*Executor) RecoverFeature ¶
func (*Executor) RecoverFrontend ¶
func (*Executor) SyncLatestVersionToAllDomain ¶
func (*Executor) SyncVersionToAllDomain ¶
func (e *Executor) SyncVersionToAllDomain(version *WebFeatureVersion) error
func (*Executor) SyncVersionToOneDomain ¶
func (e *Executor) SyncVersionToOneDomain(version *WebFeatureVersion, domain caskin.Domain) error
func (*Executor) UpdateBackend ¶
func (*Executor) UpdateFeature ¶
type Feature ¶
type Feature struct { Name string `json:"name"` Description string `json:"description"` Group string `json:"group"` }
Feature
func (*Feature) GetObjectType ¶
func (f *Feature) GetObjectType() caskin.ObjectType
func (*Feature) JSONQuery ¶
func (f *Feature) JSONQuery() []*datatypes.JSONQueryExpression
type Frontend ¶
type Frontend struct { Key string `json:"key"` Type FrontendType `json:"type"` Description string `json:"description"` Group string `json:"group"` }
Frontend
func (*Frontend) GetObjectType ¶
func (f *Frontend) GetObjectType() caskin.ObjectType
func (*Frontend) JSONQuery ¶
func (f *Frontend) JSONQuery() []*datatypes.JSONQueryExpression
type FrontendType ¶
type FrontendType string
const ( FrontendTypeNil FrontendType = "" FrontendTypeMenu FrontendType = "menu" FrontendTypeSubFunction FrontendType = "sub_function" )
type Options ¶
type Options struct { DisableCache bool `json:"disable_cache"` Domain caskin.Domain `json:"domain"` }
Options configuration for web_feature
type Relation ¶
type Relation = caskin.InheritanceRelation
type Relations ¶
type Relations = caskin.InheritanceRelations
type VersionedDomain ¶
type WebFeature ¶
type WebFeature struct {
// contains filtered or unexported fields
}
func (*WebFeature) GetExecutor ¶
func (w *WebFeature) GetExecutor(provider caskin.CurrentProvider) *Executor
type WebFeatureVersion ¶
type WebFeatureVersion struct { ID uint64 `gorm:"column:id;primaryKey" json:"id,omitempty"` CreatedAt time.Time `gorm:"column:created_at" json:"created_at,omitempty"` UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at,omitempty"` DeletedAt gorm.DeletedAt `gorm:"column:delete_at;index" json:"-"` SHA256 string `gorm:"column:sha256;unique" json:"sha256,omitempty"` MetaData *DumpRelation `gorm:"column:metadata" json:"metadata,omitempty"` }
func (*WebFeatureVersion) IsCompatible ¶
func (w *WebFeatureVersion) IsCompatible(dump *Dump) error
func (*WebFeatureVersion) TableName ¶
func (w *WebFeatureVersion) TableName() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.