Documentation ¶
Index ¶
- Constants
- Variables
- func Slugify(s string) string
- type AgentOps
- type AuthZ
- type BlobInfo
- type BprintOps
- type Builder
- type BuilderOptions
- type CabinetHub
- type CabinetSource
- type CabinetSourced
- type CoreDB
- type CoreHub
- type Error
- type EventQuery
- type PkvQuery
- type PlugOps
- type PlugStateKV
- type RepoOps
- type SetBatchOptions
- type SetOptions
- type StateHub
- type Store
- type StoreType
- type SyncDB
- type SystemOps
- type TargetOps
- type TenantOps
- type UpdateOptions
- type UserGroupExtra
- type UserMessageOps
- type UserOps
Constants ¶
View Source
const ( DefaultDataAssetsFolder = "data_common" DefaultBprintFolder = "bprints" DefaultTenantPublicFolder = "public" DefaultSystemIconsFolder = "system_icons" )
View Source
const ( VendorSqlite = "sqlite" VendorQL = "ql" VendorPostgres = "postgres" )
Variables ¶
View Source
var ( SlugExp = regexp.MustCompile("^[a-z0-9-]*$") ReplaceSlugExp = regexp.MustCompile("[^a-z0-9]+") ReservedSlugs = []string{"page", "limit", "cursor"} // fixme => copy all reserved words from from autoapi and other )
View Source
var ( DefaultFolders = []string{ DefaultDataAssetsFolder, DefaultBprintFolder, DefaultTenantPublicFolder, DefaultSystemIconsFolder, } )
Functions ¶
Types ¶
type AgentOps ¶
type AgentOps interface { AgentLinkNew(tenantId string, data *entities.AgentLink) error AgentLinkUpdate(tenantId, pid, aid string, id int64, data map[string]any) error AgentLinkGet(tenantId, pid, aid string, id int64) (*entities.AgentLink, error) AgentLinkDel(tenantId, pid, aid string, id int64) error AgentLinkList(tenantId, pid, aid string) ([]*entities.AgentLink, error) AgentLinkListReverse(tenantId, pid, aid string) ([]*entities.AgentLink, error) AgentLinkListByPlug(tenantId, pid string) ([]*entities.AgentLink, error) AgentExtensionNew(tenantId string, data *entities.AgentExtension) error AgentExtensionUpdate(tenantId, pid, aid string, id int64, data map[string]any) error AgentExtensionGet(tenantId, pid, aid string, id int64) (*entities.AgentExtension, error) AgentExtensionDel(tenantId, pid, aid string, id int64) error AgentExtensionList(tenantId, pid, aid string) ([]*entities.AgentExtension, error) AgentExtensionListByPlug(tenantId, pid string) ([]*entities.AgentExtension, error) AgentResourceNew(tenantId string, data *entities.AgentResource) error AgentResourceUpdate(tenantId, pid, aid, slug string, data map[string]any) error AgentResourceGet(tenantId, pid, aid, slug string) (*entities.AgentResource, error) AgentResourceDel(tenantId, pid, aid, slug string) error AgentResourceList(tenantId, pid, aid string) ([]*entities.AgentResource, error) ListResourcePairs(tenantId string, pid, aid string) ([]entities.ResourcePair, error) }
type BprintOps ¶
type BprintOps interface { BprintNew(tenantId string, et *entities.BPrint) error BprintUpdate(tenantId, id string, data map[string]any) error BprintGet(tenantId, id string) (*entities.BPrint, error) BprintDel(tenantId, id string) error BprintList(tenantId, group string) ([]*entities.BPrint, error) }
type Builder ¶
type Builder func(opts BuilderOptions) (Store, error)
type BuilderOptions ¶
type BuilderOptions struct { Config *config.StoreSource LogBuilder func() zerolog.Logger }
type CabinetHub ¶
type CabinetSource ¶
type CabinetSource interface { InitilizeTenent(tenent string, folders []string) error AddFolder(ctx context.Context, tenant, folder string) error AddBlob(ctx context.Context, tenant, folder string, file string, contents []byte) error AddBlobStreaming(ctx context.Context, tenant, folder string, file string, contents io.ReadCloser) error ListRoot(ctx context.Context, tenant string) ([]string, error) ListFolderBlobs(ctx context.Context, tenant, folder string) ([]*BlobInfo, error) GetBlob(ctx context.Context, tenant, folder string, file string) ([]byte, error) DeleteBlob(ctx context.Context, tenant, folder string, file string) error }
type CabinetSourced ¶
type CabinetSourced interface { AddFolder(Context context.Context, folder string) error AddBlob(Context context.Context, folder, file string, contents []byte) error // fixme putblob ListRoot(Context context.Context) ([]string, error) ListFolder(Context context.Context, folder string) ([]*BlobInfo, error) GetBlob(Context context.Context, folder, file string) ([]byte, error) DeleteBlob(Context context.Context, folder, file string) error Name() string }
type CoreDB ¶
type CoreDB interface { Ping() error SystemOps TenantOps TargetOps UserOps SyncDB UserMessageOps UserGroupExtra }
type EventQuery ¶
type PkvQuery ¶
type PkvQuery struct { KeyPrefix string `json:"key_prefix,omitempty"` LoadMeta bool `json:"load_meta,omitempty"` Tag1s []string `json:"tag1s,omitempty"` Tag2s []string `json:"tag2s,omitempty"` Tag3s []string `json:"tag3s,omitempty"` PageCount uint `json:"page_count,omitempty"` Page uint `json:"page,omitempty"` KeyCursor string `json:"key_cursor,omitempty"` NoValue bool `json:"no_value,omitempty"` }
type PlugOps ¶
type PlugOps interface { PlugNew(tenantId string, pg *entities.Plug) error PlugUpdate(tenantId string, id string, data map[string]any) error PlugGet(tenantId, pid string) (*entities.Plug, error) PlugDel(tenantId, pid string) error PlugList(tenantId string, cond map[string]any) ([]*entities.Plug, error) PlugListByBprint(tenantId, bprint string) ([]*entities.Plug, error) AgentNew(tenantId string, data *entities.Agent) error AgentUpdate(tenantId, pid, id string, data map[string]any) error AgentGet(tenantId, pid, id string) (*entities.Agent, error) AgentDel(tenantId, pid, agentId string) error AgentList(tenantId, pid string) ([]*entities.Agent, error) ResourceNew(tenantId string, obj *entities.Resource) error ResourceUpdate(tenantId string, id string, data map[string]any) error ResourceGet(tenantId, rid string) (*entities.Resource, error) ResourceDel(tenantId, rid string) error ResourceList(tenantId string, cond map[string]any) ([]*entities.Resource, error) ResourcesMulti(tenantId string, rids ...string) ([]*entities.Resource, error) ResourcesByTarget(tenantId string, target string) ([]*entities.Resource, error) GetFlowMap(tenantId string) (*flowmap.Data, error) }
type PlugStateKV ¶
type PlugStateKV interface { SetBatch(txid uint32, tenantId, plugId string, opts *SetBatchOptions) error Set(txid uint32, tenantId, plugId, key, value string, opts *SetOptions) error Update(txid uint32, tenantId, plugId, key, value string, opts *UpdateOptions) error Get(txid uint32, tenantId, plugId, key string) (*entities.PlugKV, error) Query(txid uint32, tenantId, plugId string, query *PkvQuery) ([]*entities.PlugKV, error) Del(txid uint32, tenantId, plugId, key string) error DelBatch(txid uint32, tenantId, plugId string, keys []string) error NewTxn() (uint32, error) RollBack(txid uint32) error Commit(txid uint32) error }
type SetBatchOptions ¶
type SetOptions ¶
type StateHub ¶
type StateHub interface { OnTargetAppChange(tenantId string, id int64, data any) OnTargetHookChange(tenantId string, id int64, data any) OnResourceChange(tenantId, id string, data any) OnUserGroupChange(tenantId, id string, data any) OnDataGroupChange(tenantId, gid string, data any) OnDataTableChange(tenantId, gid, tid string, data any) OnDataColumnChange(tenantId, gid, tid, cid string, data any) OnTenantChange(id string, data any) OnDomainChange(tenantId string, id int64, data any) }
type Store ¶
type Store interface { Supports(StoreType) bool CoreDB() CoreDB DynDB() dyndb.DynDB StateDB() PlugStateKV CabinetSource() CabinetSource Name() string }
type SystemOps ¶
type SystemOps interface { AddSystemEvent(data *entities.SystemEvent) error RemoveSystemEvent(id int64) error ListSystemEvent(last int64) ([]*entities.SystemEvent, error) QuerySystemEvent(query EventQuery) ([]*entities.SystemEvent, error) AddSystemKV(tenantId string, data *entities.SystemKV) error UpdateSystemKV(tenantId, key, ktype string, data map[string]any) error GetSystemKV(tenantId, key, ktype string) (*entities.SystemKV, error) RemoveSystemKV(tenantId, key, ktype string) error ListSystemKV(tenantId, ktype, prefix string, last int64) ([]*entities.SystemKV, error) }
type TargetOps ¶
type TargetOps interface { AddTargetHook(data *entities.TargetHook) (int64, error) UpdateTargetHook(tenantId, ttype string, id int64, data map[string]any) error ListTargetHook(tenantId string, cond map[string]any) ([]*entities.TargetHook, error) ListTargetHookByType(tenantId, ttype, target string) ([]*entities.TargetHook, error) ListTargetHookByPlug(tenantId, plug string) ([]*entities.TargetHook, error) GetTargetHook(tenantId, ttype string, id int64) (*entities.TargetHook, error) RemoveTargetHook(tenantId, ttype string, id int64) error AddTargetApp(data *entities.TargetApp) (int64, error) UpdateTargetApp(tenantId, ttype string, id int64, data map[string]any) error ListTargetApp(tenantId string, cond map[string]any) ([]*entities.TargetApp, error) ListTargetAppByType(tenantId, ttype, target string) ([]*entities.TargetApp, error) ListTargetAppByPlug(tenantId, plug string) ([]*entities.TargetApp, error) GetTargetApp(tenantId, ttype string, id int64) (*entities.TargetApp, error) RemoveTargetApp(tenantId, ttype string, id int64) error ListTargetAppByUgroup(tenantId, ugroup string) ([]*entities.TargetApp, error) }
type TenantOps ¶
type TenantOps interface { AddTenant(tenant *entities.Tenant) error UpdateTenant(slug string, data map[string]any) error GetTenant(tenant string) (*entities.Tenant, error) RemoveTenant(slug string) error ListTenant() ([]*entities.Tenant, error) AddDomain(domain *entities.TenantDomain) (int64, error) UpdateDomain(tenantId string, id int64, data map[string]any) error GetDomain(tenantId string, id int64) (*entities.TenantDomain, error) GetDomainByName(tenantId string, name string) (*entities.TenantDomain, error) RemoveDomain(tenantId string, id int64) error ListDomain(tenantId string) ([]*entities.TenantDomain, error) }
type UpdateOptions ¶
type UpdateOptions struct { ForceVer bool `json:"force_ver,omitempty"` WithVerison bool `json:"with_version,omitempty"` Version int `json:"version,omitempty"` SetTag1 bool `json:"set_tag1,omitempty"` SetTag2 bool `json:"set_tag2,omitempty"` SetTag3 bool `json:"set_tag3,omitempty"` Tag1 string `json:"tag1,omitempty"` Tag2 string `json:"tag2,omitempty"` Tag3 string `json:"tag3,omitempty"` SetTTL bool `json:"set_ttl,omitempty"` TTL int `json:"ttl,omitempty"` }
type UserGroupExtra ¶
type UserGroupExtra interface { AddUserGroupAuth(data *entities.UserGroupAuth) error UpdateUserGroupAuth(tenantId string, gslug string, id int64, data map[string]any) error ListUserGroupAuth(tenantId string, gslug string) ([]*entities.UserGroupAuth, error) GetUserGroupAuth(tenantId string, gslug string, id int64) (*entities.UserGroupAuth, error) RemoveUserGroupAuth(tenantId, gslug string, id int64) error AddUserGroupData(data *entities.UserGroupData) error UpdateUserGroupData(tenantId string, gslug string, id int64, data map[string]any) error ListUserGroupData(tenantId string, gslug string) ([]*entities.UserGroupData, error) GetUserGroupData(tenantId string, gslug string, id int64) (*entities.UserGroupData, error) RemoveUserGroupData(tenantId, gslug string, id int64) error }
type UserMessageOps ¶
type UserMessageOps interface { AddUserMessage(msg *entities.UserMessage) (int64, error) UserMessageSetRead(tenantId, user string, id int64) error RemoveUserMessage(tenantId string, userid string, id int64) error ListUserMessages(tenantId string, data *entities.UserMessageReq) ([]*entities.UserMessage, error) ReadUserMessages(tenantId, userId string, id []int64) error DeleteUserMessages(tenantId, userId string, id []int64) error }
type UserOps ¶
type UserOps interface { AddUserGroup(ug *entities.UserGroup) error GetUserGroup(tenantId string, slug string) (*entities.UserGroup, error) ListUserGroups(tenantId string) ([]*entities.UserGroup, error) UpdateUserGroup(tenantId, slug string, data map[string]any) error RemoveUserGroup(tenantId string, ugslug string) error AddUser(user *entities.User, data *entities.UserData) error UpdateUser(tenantId, user string, data map[string]any) error RemoveUser(tenantId string, userid string) error GetUserByID(tenantId string, userid string) (*entities.User, error) GetUserByEmail(tenantId string, email string) (*entities.User, error) ListUsers(tenantId string) ([]*entities.User, error) ListUsersByGroup(tenantId, group string) ([]*entities.User, error) ListUsersMulti(tenantId string, users ...string) ([]*entities.User, error) GetUserData(tenantId string, slug string) (*entities.UserData, error) UpdateUserData(tenantId, slug string, data map[string]any) error AddUserDevice(tenantId string, user string, data *entities.UserDevice) error UpdateUserDevice(tenantId string, user string, id int64, data map[string]any) error GetUserDevice(tenantId string, user string, id int64) (*entities.UserDevice, error) ListUserDevice(tenantId string, user string) ([]*entities.UserDevice, error) RemoveUserDevice(tenantId string, user string, id int64) error }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.