storage

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Migrations = map[string]*migrate.MemoryMigrationSource{
	dbal.DriverMySQL: {
		Migrations: []*migrate.Migration{
			{
				Id: "1",
				Up: []string{
					`CREATE TABLE IF NOT EXISTS rego_data (
    id 					INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
	collection 			VARCHAR(64) NOT NULL,
	pkey 				VARCHAR(64) NOT NULL,
	document		 	JSON,
	UNIQUE KEY rego_data_uidx_ck (collection, pkey)
)`,
				},
				Down: []string{
					"DROP TABLE rego_data",
				},
			},
		},
	},
	dbal.DriverPostgreSQL: {
		Migrations: []*migrate.Migration{
			{
				Id: "1",
				Up: []string{
					`CREATE TABLE IF NOT EXISTS rego_data (
    id 			SERIAL PRIMARY KEY,
	collection 	VARCHAR(64) NOT NULL,
	pkey 		VARCHAR(64) NOT NULL,
	document	JSON
)`,
					`CREATE UNIQUE INDEX rego_data_uidx_ck ON rego_data (collection, pkey)`,
				},
				Down: []string{
					"DROP TABLE rego_data",
				},
			},
		},
	},
}

Functions

func ListByQuery

func ListByQuery(l *ListRequest, m map[string][]string)

Types

type DeleteRequest

type DeleteRequest struct {
	Collection string
	Key        string
}

type GetRequest

type GetRequest struct {
	Collection string
	Key        string
	Value      interface{}
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(s Manager, h herodot.Writer) *Handler

func (*Handler) Delete

func (*Handler) Get

func (*Handler) List

func (*Handler) Upsert

type ListRequest

type ListRequest struct {
	Collection string
	Value      interface{}
	FilterFunc func(*ListRequest, map[string][]string)
}

func (*ListRequest) Filter

func (l *ListRequest) Filter(m map[string][]string) *ListRequest

type Manager

type Manager interface {
	Get(ctx context.Context, collection string, key string, value interface{}) error
	List(ctx context.Context, collection string, value interface{}, limit, offset int) error
	Upsert(ctx context.Context, collection string, key string, value interface{}) error
	Delete(ctx context.Context, collection string, key string) error
	Storage(ctx context.Context, schema string, collections []string) (storage.Store, error)
}

type MemoryManager

type MemoryManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewMemoryManager

func NewMemoryManager() *MemoryManager

func (*MemoryManager) Delete

func (m *MemoryManager) Delete(_ context.Context, collection, key string) error

func (*MemoryManager) Get

func (m *MemoryManager) Get(_ context.Context, collection, key string, value interface{}) error

func (*MemoryManager) List

func (m *MemoryManager) List(ctx context.Context, collection string, value interface{}, limit, offset int) error

func (*MemoryManager) Storage

func (m *MemoryManager) Storage(ctx context.Context, schema string, collections []string) (storage.Store, error)

func (*MemoryManager) Upsert

func (m *MemoryManager) Upsert(_ context.Context, collection, key string, value interface{}) error

type Policies

type Policies []Policy

Policies is an array of policies.

swagger:ignore

type Policy

type Policy struct {
	// ID is the unique identifier of the ORY Access Policy. It is used to query, update, and remove the ORY Access Policy.
	ID string `json:"id"`

	// Description is an optional, human-readable description.
	Description string `json:"description"`

	// Subjects is an array representing all the subjects this ORY Access Policy applies to.
	Subjects []string `json:"subjects"`

	// Resources is an array representing all the resources this ORY Access Policy applies to.
	Resources []string `json:"resources"`

	// Actions is an array representing all the actions this ORY Access Policy applies to.
	Actions []string `json:"actions"`

	// Effect is the effect of this ORY Access Policy. It can be "allow" or "deny".
	Effect string `json:"effect"`

	// Conditions represents a keyed object of conditions under which this ORY Access Policy is active.
	Conditions map[string]interface{} `json:"conditions"`
}

Policy specifies an ORY Access Policy document.

swagger:ignore

type Registry

type Registry interface {
	StorageManager() Manager
}

type Role

type Role struct {
	// ID is the role's unique id.
	ID string `json:"id"`

	// Members is who belongs to the role.
	Members []string `json:"members"`
}

Role represents a group of users that share the same role. A role could be an administrator, a moderator, a regular user or some other sort of role.

swagger:ignore

type Roles

type Roles []Role

A list of roles.

swagger:ignore

type SQLManager

type SQLManager struct {
	// contains filtered or unexported fields
}

func NewSQLManager

func NewSQLManager(db *sqlx.DB) *SQLManager

func (*SQLManager) CreateSchemas

func (m *SQLManager) CreateSchemas(db *sqlx.DB) (int, error)

func (*SQLManager) Delete

func (m *SQLManager) Delete(ctx context.Context, collection, key string) error

func (*SQLManager) Get

func (m *SQLManager) Get(ctx context.Context, collection, key string, value interface{}) error

func (*SQLManager) List

func (m *SQLManager) List(ctx context.Context, collection string, value interface{}, limit, offset int) error

func (*SQLManager) Storage

func (m *SQLManager) Storage(ctx context.Context, schema string, collections []string) (storage.Store, error)

func (*SQLManager) Upsert

func (m *SQLManager) Upsert(ctx context.Context, collection, key string, value interface{}) error

type UpsertRequest

type UpsertRequest struct {
	Collection string
	Key        string
	Value      interface{}
}

Jump to

Keyboard shortcuts

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