Documentation ¶
Index ¶
- Constants
- type APIDoc
- type APINamespace
- type APINamespaceList
- type APINamespaceRepo
- type APIPermitElem
- type APIPermitElemRepo
- type APIPermitGrant
- type APIPermitGrantRepo
- type APIPermitGroup
- type APIPermitGroupRepo
- type APISchema
- type APISchemaFull
- type APISchemaList
- type APISchemaRepo
- type APIService
- type APIServiceList
- type APIServiceRepo
- type CacheType
- type ListPermitElemResp
- type ListPermitGrantResp
- type ListPermitGroupResp
- type PolyAPIArrange
- type PolyAPIDoc
- type PolyAPIFull
- type PolyAPIList
- type PolyAPIRepo
- type PolyAPIScript
- type PolyBuildResult
- type RawAPIContent
- type RawAPICore
- type RawAPIDoc
- type RawAPIFull
- type RawAPIList
- type RawAPIRepo
- type RawPoly
- type RawPolyList
- type RawPolyRepo
- type RedisCache
- type Schema
Constants ¶
const PolyTableName = "api_poly"
PolyTableName is table name
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APINamespaceList ¶
type APINamespaceList struct { List []*APINamespace Total int64 }
APINamespaceList is list of namespace
type APINamespaceRepo ¶
type APINamespaceRepo interface { Create(db *gorm.DB, item *APINamespace) error Delete(db *gorm.DB, path, name string) error Update(db *gorm.DB, item *APINamespace) error UpdateActive(db *gorm.DB, item *APINamespace) error Query(db *gorm.DB, path, name string) (*APINamespace, error) List(db *gorm.DB, path string, active, page, pageSize int) (*APINamespaceList, error) Count(db *gorm.DB, path string) (int, error) Search(db *gorm.DB, parent, namespace, title string, active, page, pageSize int, withSub bool) (*APINamespaceList, error) CreateInBatches(db *gorm.DB, items []*APINamespace) error UpdateValidWithSub(db *gorm.DB, path string, valid uint) error DelByPrefixPath(db *gorm.DB, path string) error }
APINamespaceRepo persistence layer interface
type APIPermitElem ¶
type APIPermitElem struct { ID string Owner string OwnerName string GroupPath string ElemType string ElemID string ElemPath string Desc string ElemPri uint Content string Active uint CreateAt int64 UpdateAt int64 DeleteAt int64 }
APIPermitElem Schema Objects
type APIPermitElemRepo ¶
type APIPermitElemRepo interface { Create(db *gorm.DB, group *APIPermitElem) error Delete(db *gorm.DB, id string) error Update(db *gorm.DB, group *APIPermitElem) error UpdateActive(db *gorm.DB, group *APIPermitElem) error Query(db *gorm.DB, id string) (*APIPermitElem, error) List(db *gorm.DB, groupPath string, page, pageSize int) (*ListPermitElemResp, error) Count(db *gorm.DB, groupID string) (int, error) }
APIPermitElemRepo persistence layer interface
type APIPermitGrant ¶
type APIPermitGrant struct { ID string Owner string OwnerName string GroupPath string GrantType string GrantID string GrantName string GrantPri uint Active uint Desc string CreateAt int64 UpdateAt int64 DeleteAt int64 }
APIPermitGrant Schema Objects
type APIPermitGrantRepo ¶
type APIPermitGrantRepo interface { Create(db *gorm.DB, group *APIPermitGrant) error Delete(db *gorm.DB, id string) error Update(db *gorm.DB, group *APIPermitGrant) error UpdateActive(db *gorm.DB, group *APIPermitGrant) error Query(db *gorm.DB, id string) (*APIPermitGrant, error) QueryGrant(db *gorm.DB, groupPath, grantType, grantID string) (*APIPermitGrant, error) List(db *gorm.DB, groupPath string, page, pageSize int) (*ListPermitGrantResp, error) ListGroups(db *gorm.DB, grantType, grantID string) ([]string, error) Count(db *gorm.DB, groupID string) (int, error) }
APIPermitGrantRepo persistence layer interface
type APIPermitGroup ¶
type APIPermitGroup struct { ID string Owner string OwnerName string Namespace string Name string Title string Access uint Desc string Active uint CreateAt int64 UpdateAt int64 DeleteAt int64 }
APIPermitGroup Schema Objects
type APIPermitGroupRepo ¶
type APIPermitGroupRepo interface { Create(db *gorm.DB, group *APIPermitGroup) error Delete(db *gorm.DB, path, name string) error Update(db *gorm.DB, group *APIPermitGroup) error UpdateActive(db *gorm.DB, group *APIPermitGroup) error Query(db *gorm.DB, path, name string) (*APIPermitGroup, error) List(db *gorm.DB, namespace string, page, pageSize int) (*ListPermitGroupResp, error) Count(db *gorm.DB, path string) (int, error) }
APIPermitGroupRepo persistence layer interface
type APISchemaFull ¶
type APISchemaFull struct { ID string Namespace string Name string Title string Desc string Schema *Schema CreateAt int64 UpdateAt int64 }
APISchemaFull describes api json schema
type APISchemaList ¶
APISchemaList is the list of schema
type APISchemaRepo ¶
type APISchemaRepo interface { Create(db *gorm.DB, schema *APISchemaFull) error Delete(db *gorm.DB, namespace, name string) error Query(db *gorm.DB, namespace, name string) (*APISchemaFull, error) List(db *gorm.DB, namespace string, withSub bool, page, pageSize int) (*APISchemaList, error) }
APISchemaRepo is the interface for api schema db operator
type APIServiceList ¶
type APIServiceList struct { List []*APIService Total int64 }
APIServiceList is list of namespace
type APIServiceRepo ¶
type APIServiceRepo interface { Create(db *gorm.DB, group *APIService) error CreateInBatches(db *gorm.DB, groups []*APIService) error Delete(db *gorm.DB, namespace, name string) error DeleteInBatch(db *gorm.DB, namespace string, names []string) error Update(db *gorm.DB, group *APIService) error UpdateProperty(db *gorm.DB, group *APIService) error UpdateActive(db *gorm.DB, group *APIService) error Query(db *gorm.DB, namespace, name string) (*APIService, error) List(db *gorm.DB, namespace string, page, pageSize int, withSub bool) (*APIServiceList, error) Count(db *gorm.DB, namespace string) (int, error) DelByPrefixPath(db *gorm.DB, path string) error }
APIServiceRepo persistence layer interface
type ListPermitElemResp ¶
type ListPermitElemResp struct { Total int64 `json:"total"` Page int `json:"page"` List []*APIPermitElem `json:"list"` }
ListPermitElemResp ListPermitElemResp
type ListPermitGrantResp ¶
type ListPermitGrantResp struct { Total int64 `json:"total"` Page int `json:"page"` List []*APIPermitGrant `json:"list"` }
ListPermitGrantResp ListPermitGrantResp
type ListPermitGroupResp ¶
type ListPermitGroupResp struct { Total int64 `json:"total"` Page int `json:"page"` List []*APIPermitGroup `json:"list"` }
ListPermitGroupResp ListPermitGroupResp
type PolyAPIArrange ¶
type PolyAPIArrange struct { ID string `gorm:"primarykey"` // uuid Owner string // owner OwnerName string // owner name Namespace string Name string // name Title string Desc string Active uint Valid uint Access uint Method string Arrange string // arrange info CreateAt int64 // create time UpdateAt int64 // update time DeleteAt *int64 // delete time BuildAt int64 // build time }
PolyAPIArrange is view of poly arrange
type PolyAPIDoc ¶
type PolyAPIDoc struct { ID string `gorm:"primarykey"` // uuid Namespace string Name string // name Title string Desc string Doc *APIDoc // API doc BuildAt int64 // build time }
PolyAPIDoc is view of poly doc
type PolyAPIList ¶
type PolyAPIList struct { Total int64 List []*PolyAPIArrange }
PolyAPIList is list of poly api
type PolyAPIRepo ¶
type PolyAPIRepo interface { Create(db *gorm.DB, info *PolyAPIArrange) error Delete(db *gorm.DB, path string, name []string) error UpdateArrange(db *gorm.DB, info *PolyAPIArrange) error UpdateScript(db *gorm.DB, info *PolyBuildResult) error GetArrange(db *gorm.DB, path, name string) (*PolyAPIArrange, error) GetScript(db *gorm.DB, path, name string) (*PolyAPIScript, error) GetDoc(db *gorm.DB, path, name string) (*PolyAPIDoc, error) GetDocInBatches(db *gorm.DB, path [][2]string) ([]*PolyAPIDoc, error) List(db *gorm.DB, namespace string, active, page, pageSize int) (*PolyAPIList, error) UpdateActive(db *gorm.DB, namespace, name string, active uint) error Search(db *gorm.DB, namespace, name, title string, active, page, pageSize int, withSub bool) (*PolyAPIList, error) UpdateValid(db *gorm.DB, path [][2]string, valid uint) error UpdateValidByPrefixPath(db *gorm.DB, namespace string, valid uint) error CreateInBatches(db *gorm.DB, items []*PolyAPIFull) error ListByPrefixPath(db *gorm.DB, namespace string, active, page, pageSize int) ([]*PolyAPIFull, int64, error) DelByPrefixPath(db *gorm.DB, path string) error }
PolyAPIRepo PolyAPIRepo
type PolyAPIScript ¶
type PolyAPIScript struct { ID string `gorm:"primarykey"` // uuid Namespace string Name string // name Active uint Valid uint Method string Script string // script Owner string BuildAt int64 // build time }
PolyAPIScript is view of poly script
type PolyBuildResult ¶
type PolyBuildResult struct { ID string `gorm:"primarykey"` // uuid Namespace string Name string // name Script string // script Doc string // API doc BuildAt int64 // build time }
PolyBuildResult is view of poly build result
type RawAPICore ¶
type RawAPICore struct { ID string Owner string OwnerName string Namespace string Service string Name string Title string Desc string Path string URL string Action string // action Method string // method GET|POST|... Version string Access uint Active uint Valid uint Schema string Host string AuthType string CreateAt int64 // create time UpdateAt int64 // update time DeleteAt *int64 // delete time Content *RawAPIContent }
RawAPICore is the raw api core scheme
type RawAPIDoc ¶
type RawAPIDoc struct { ID string Owner string OwnerName string Namespace string Service string Name string Title string Desc string CreateAt int64 // create time UpdateAt int64 // update time DeleteAt *int64 // delete time Doc *APIDoc }
RawAPIDoc is the raw api doc scheme
type RawAPIList ¶
type RawAPIList struct { Total int64 List []*RawAPICore }
RawAPIList is list of raw api
type RawAPIRepo ¶
type RawAPIRepo interface { Create(db *gorm.DB, raw *RawAPIFull) error CreateInBatches(db *gorm.DB, items []*RawAPIFull) error Del(db *gorm.DB, namespace string, names []string) error Get(db *gorm.DB, path, name string) (*RawAPICore, error) GetDoc(db *gorm.DB, path, name string) (*RawAPIDoc, error) GetDocInBatches(db *gorm.DB, path [][2]string) ([]*RawAPIDoc, error) GetByID(db *gorm.DB, id string) (*RawAPICore, error) GetInBatches(db *gorm.DB, path [][2]string) (*RawAPIList, error) List(db *gorm.DB, namespace, service string, active, page, pageSize int) (*RawAPIList, error) ListByPrefixPath(db *gorm.DB, path string, active, page, pageSize int) ([]*RawAPIFull, int64, error) UpdateActive(db *gorm.DB, namespace, name string, active uint) error UpdateValid(db *gorm.DB, path [][2]string, valid uint) error UpdateValidByPrefixPath(db *gorm.DB, path string, valid uint) error UpdateInBatch(db *gorm.DB, namespace, service, host, schema, authType string) error Search(db *gorm.DB, namespace, name, title string, active, page, pageSize int, withSub bool) (*RawAPIList, error) DelByPrefixPath(db *gorm.DB, path string) error }
RawAPIRepo is the interface for raw api db operator
type RawPolyList ¶
RawPolyList is list of RawPoly
type RawPolyRepo ¶
type RawPolyRepo interface { Create(db *gorm.DB, item *RawPoly) error CreateInBatches(db *gorm.DB, items []*RawPoly) error DeleteByRawAPI(db *gorm.DB, rawPath string) error DeleteByPolyAPI(db *gorm.DB, polyPath string) error DeleteByPolyAPIInBatches(db *gorm.DB, polyPath []string) error QueryByRawAPI(db *gorm.DB, rawPath []string) (*RawPolyList, error) QueryByPolyAPI(db *gorm.DB, polyPath string) (*RawPolyList, error) Update(db *gorm.DB, item []*RawPoly) error ListByPrefixPath(db *gorm.DB, path string) (*RawPolyList, error) DelByPrefixPath(db *gorm.DB, path string) error }
RawPolyRepo is the interface for the relationship between raw and poly api db operator
type RedisCache ¶
type RedisCache interface { PutCache(p interface{}, fullPath string, ty CacheType) error DeleteCache(fullPath string, ty CacheType, includeList bool) error DeleteCacheInBatch(fullPath []string, ty CacheType) error DeletePatternCache(pattern string, ty CacheType, includeList bool) error QueryRaw(fullPath string) (*RawAPICore, error) QueryRawDoc(fullPath string) (*RawAPIDoc, error) QueryRawList(fullPath string) (*RawAPIList, error) QueryPoly(fullPath string) (*PolyAPIScript, error) QueryPolyDoc(fullPath string) (*PolyAPIDoc, error) QueryPolyList(fullPath string) (*PolyAPIList, error) QueryNamespace(fullPath string) (*APINamespace, error) QueryNamespaceList(fullPath string) (*APINamespaceList, error) QueryService(fullPath string) (*APIService, error) QueryServiceList(fullPath string) (*APIServiceList, error) QuerySchema(fullPath string) (*APISchemaFull, error) QuerySchemaList(fullPath string) (*APISchemaList, error) IncAPIStat(apiPath string, raw bool) (int64, error) GetAPIStat(apiPath string, raw bool) (int64, error) }
RedisCache RedisCache