models

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleInit = "initType"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition map[string]interface{}

func (*Condition) Scan

func (c *Condition) Scan(data interface{}) error

Scan 实现方法

func (Condition) Value

func (c Condition) Value() (driver.Value, error)

Value 实现方法

type Config

type Config map[string]interface{}

Config Config.

func (*Config) Scan

func (p *Config) Scan(data interface{}) error

Scan 实现方法.

func (Config) Value

func (p Config) Value() (driver.Value, error)

Value 实现方法.

type FiledPermit

type FiledPermit map[string]Key

func (*FiledPermit) Scan

func (p *FiledPermit) Scan(data interface{}) error

Scan 实现方法.

func (FiledPermit) Value

func (p FiledPermit) Value() (driver.Value, error)

Value 实现方法.

type Filters

type Filters []string

func (*Filters) Scan

func (p *Filters) Scan(data interface{}) error

Scan 实现方法.

func (Filters) Value

func (p Filters) Value() (driver.Value, error)

Value 实现方法.

type Key

type Key struct {
	Type       string      `json:"type,omitempty"`
	Properties FiledPermit `json:"properties,omitempty"`
}

type Limits

type Limits struct {
	Path        string
	Name        string
	Params      FiledPermit
	Response    FiledPermit
	Condition   Condition
	ResponseAll bool
	ParamsAll   bool
}

type LimitsRepo

type LimitsRepo interface {
	CreatePermit(ctx context.Context, roleID string, limits ...*Limits) error
	GetPermit(ctx context.Context, roleID, path string) (*Limits, error)
	DeletePermit(ctx context.Context, roleID string) error
	DeletePermitByPath(ctx context.Context, roleID, path string) error

	CreatePerMatch(ctx context.Context, match *UserRoles) error
	GetPerMatch(ctx context.Context, appID, userID string) (*UserRoles, error)
	DeletePerMatch(ctx context.Context, appID string) error

	// Lock 设置分布式锁
	Lock(ctx context.Context, key string, val interface{}, ttl time.Duration) (bool, error)
	// UnLock 解除分布式锁
	UnLock(ctx context.Context, key string) error
	// PerMatchExpire 给某个键设置过期时间
	PerMatchExpire(ctx context.Context, key string, ttl time.Duration) error
	// PermitExpire PermitExpire
	PermitExpire(ctx context.Context, key string, ttl time.Duration) error

	ExistsKey(ctx context.Context, key string) bool
}

type Permit

type Permit struct {
	ID          string
	RoleID      string
	Path        string
	Params      FiledPermit
	Response    FiledPermit
	Condition   Condition
	Method      string
	ParamsAll   bool
	ResponseAll bool
	CreatedAt   int64
	CreatorID   string
	CreatorName string
}

Permit Permit.

type PermitQuery

type PermitQuery struct {
	ID      string
	RoleID  string
	Path    string
	Method  string
	Paths   []string
	RoleIDs []string
}

type PermitRepo

type PermitRepo interface {
	BatchCreate(db *gorm.DB, form ...*Permit) error

	Get(db *gorm.DB, roleID, path, method string) (*Permit, error)

	Delete(db *gorm.DB, query *PermitQuery) error

	Update(db *gorm.DB, query *PermitQuery, permit *Permit) error

	List(db *gorm.DB, query *PermitQuery, page, size int) ([]*Permit, int64, error)
}

PermitRepo PermitRepo.

type Role

type Role struct {
	ID          string
	AppID       string
	Name        string
	Description string
	CreatedAt   int64
	CreatorID   string
	CreatorName string
	Types       RoleType
}

type RoleGrant

type RoleGrant struct {
	ID        string
	RoleID    string
	AppID     string
	Owner     string
	OwnerName string
	Types     int
	CreatedAt int64
}

type RoleGrantQuery

type RoleGrantQuery struct {
	RoleID  string
	RoleIDs []string
	Owners  []string
	AppID   string
	Types   int
}

type RoleQuery

type RoleQuery struct {
	ID      string
	AppID   string
	Name    string
	RoleIDS []string
	Types   RoleType
}

type RoleRantRepo

type RoleRantRepo interface {
	BatchCreate(db *gorm.DB, roleGrant ...*RoleGrant) error
	Get(db *gorm.DB, id string) (*RoleGrant, error)
	Update(db *gorm.DB, id string, roleGrant *RoleGrant) error
	Delete(db *gorm.DB, query *RoleGrantQuery) error
	List(db *gorm.DB, query *RoleGrantQuery, page, size int) ([]*RoleGrant, int64, error)
}

RoleRantRepo RoleRantRepo

type RoleRepo

type RoleRepo interface {
	BatchCreate(db *gorm.DB, role ...*Role) error
	Get(db *gorm.DB, id string) (*Role, error)
	Update(db *gorm.DB, id string, role *Role) error
	Delete(db *gorm.DB, query *RoleQuery) error
	List(db *gorm.DB, query *RoleQuery, page, size int) ([]*Role, int64, error)
}

RoleRepo RoleRepo.

type RoleType

type RoleType int64

RoleType RoleType.

const (
	// InitType 默认初始化的权限.
	InitType RoleType = 1
	// CreateType CreateType.
	CreateType RoleType = 2
)

type SchemaProperties

type SchemaProperties map[string]SchemaProps

func (*SchemaProperties) Scan

func (p *SchemaProperties) Scan(data interface{}) error

Scan 实现方法.

func (SchemaProperties) Value

func (p SchemaProperties) Value() (driver.Value, error)

Value 实现方法.

type SchemaProps

type SchemaProps struct {
	Title      string           `json:"title,omitempty"`
	Required   bool             `json:"required,omitempty"`
	Length     int              `json:"length,omitempty"`
	Type       string           `json:"type,omitempty"`
	ReadOnly   bool             `json:"read_only,omitempty"`
	Items      *SchemaProps     `json:"items,omitempty"`
	Properties SchemaProperties `json:"properties,omitempty"`
}

type SerialExcute

type SerialExcute struct {
	Date string
	Incr string
}

SerialExcute SerialExcute

type SerialRepo

type SerialRepo interface {
	Create(ctx context.Context, appID, tableID, fieldID string, values map[string]interface{}) error
	Get(ctx context.Context, appID, tableID, fieldID, field string) string
	GetAll(ctx context.Context, appID, tableID, fieldID string) map[string]string
}

SerialRepo SerialRepo

type SerialScheme

type SerialScheme struct {
	Bit   string `json:"bit"`
	Value string `json:"value"`
	Step  string `json:"step"`
	Date  string `json:"date"`
}

SerialScheme SerialScheme

type SourceType

type SourceType int64

SourceType SourceType.

const (
	FormSource SourceType = 1
)

type Table

type Table struct {
	// id pk
	ID string

	AppID string
	// table id
	TableID string

	// table design json schema
	Schema WebSchema
	// table page config json schema
	Config Config

	CreatedAt int64
}

Table schema info.

type TableQuery

type TableQuery struct {
	AppID    string
	TableID  string
	TableIDS []string
}

type TableRelation

type TableRelation struct {
	ID string
	// app id
	AppID string
	// table id
	TableID string
	// table key name
	FieldName string
	// sub table id
	SubTableID string
	// table type
	SubTableType string
	// filter
	Filter Filters

	CreatedAt int64
}

type TableRelationQuery

type TableRelationQuery struct {
	AppID        string
	TableID      string
	SubTableID   string
	FieldName    string
	SubTableType string
}

type TableRelationRepo

type TableRelationRepo interface {
	BatchCreate(db *gorm.DB, table ...*TableRelation) error
	Find(db *gorm.DB, query *TableRelationQuery) ([]*TableRelation, error)
	Update(db *gorm.DB, tableID, fieldName string, table *TableRelation) error
	Delete(db *gorm.DB, query *TableRelationQuery) error
	Get(db *gorm.DB, tableID, fieldName string) (*TableRelation, error)
	List(db *gorm.DB, query *TableRelationQuery, page, size int) ([]*TableRelation, int64, error)
}

type TableRepo

type TableRepo interface {
	BatchCreate(db *gorm.DB, tables ...*Table) error
	Get(db *gorm.DB, appId, tableID string) (*Table, error)
	Find(db *gorm.DB, query *TableQuery) ([]*Table, error)
	Delete(db *gorm.DB, query *TableQuery) error
	Update(db *gorm.DB, appID, tableID string, table *Table) error
	List(db *gorm.DB, query *TableQuery, page, size int) ([]*Table, int64, error)
}

type TableSchema

type TableSchema struct {
	ID          string
	AppID       string
	TableID     string
	FieldLen    int64
	Title       string
	Description string
	Source      SourceType
	CreatedAt   int64
	UpdatedAt   int64
	CreatorID   string
	CreatorName string
	EditorID    string
	EditorName  string
	Schema      SchemaProperties
}

TableSchema TableSchema.

type TableSchemaQuery

type TableSchemaQuery struct {
	TableID    string
	AppID      string
	Title      string
	SourceType SourceType
}

type TableSchemeRepo

type TableSchemeRepo interface {
	BatchCreate(db *gorm.DB, schema ...*TableSchema) error
	Get(db *gorm.DB, appID, tableID string) (*TableSchema, error)
	Delete(db *gorm.DB, query *TableSchemaQuery) error
	Update(db *gorm.DB, appID, tableID string, baseSchema *TableSchema) error
	List(db *gorm.DB, query *TableSchemaQuery, page, size int) ([]*TableSchema, int64, error)
}

type UserRole

type UserRole struct {
	ID string
	// app id
	UserID string
	// table id
	RoleID string

	AppID string
}

type UserRoleQuery

type UserRoleQuery struct {
	UserID  string
	UserIDS []string
	AppID   string
	RoleID  string
}

type UserRoleRepo

type UserRoleRepo interface {
	BatchCreate(db *gorm.DB, userRole ...*UserRole) error
	Get(db *gorm.DB, appID, userID string) (*UserRole, error)
	Delete(db *gorm.DB, query *UserRoleQuery) error
	List(db *gorm.DB, query *UserRoleQuery, page, size int) ([]*UserRole, int64, error)
}

UserRoleRepo UserRoleRepo.

type UserRoles

type UserRoles struct {
	RoleID string
	UserID string
	AppID  string
}

UserRoles UserRoles

type WebSchema

type WebSchema map[string]interface{}

WebSchema WebSchema.

func (*WebSchema) Scan

func (p *WebSchema) Scan(data interface{}) error

Scan 实现方法.

func (WebSchema) Value

func (p WebSchema) Value() (driver.Value, error)

Value 实现方法.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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