datastoreadapter

package module
v2.0.1 Latest Latest
Warning

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

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

README

datastore-adapter

A GCP datastore adapter for Casbin

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadModel

func LoadModel(db *datastore.Client) (model.Model, error)

LoadModel loads a casbin model definition from a datastore entity.

func LoadModelWithConfig

func LoadModelWithConfig(db *datastore.Client, config Config) (model.Model, error)

LoadModel loads a casbin model definition from a datastore entity.

func NewAdapter

func NewAdapter(db *datastore.Client) persist.Adapter

NewAdapter is the constructor for Adapter. A valid datastore client must be provided.

func NewAdapterWithConfig

func NewAdapterWithConfig(db *datastore.Client, config Config) persist.Adapter

NewAdapter is the constructor for Adapter. A valid datastore client must be provided.

func SaveModel

func SaveModel(db *datastore.Client, path string) error

SaveModel loads a casbin model definition from the specified file and store it to a datastore entity.

func SaveModelWithConfig

func SaveModelWithConfig(db *datastore.Client, path string, config Config) error

SaveModel loads a casbin model definition from the specified file and store it to a datastore entity.

Types

type CasbinModelConf

type CasbinModelConf struct {
	Text string `datastore:"text,noindex"`
}

type CasbinRule

type CasbinRule struct {
	PType string `datastore:"p_type"`
	V0    string `datastore:"v0"`
	V1    string `datastore:"v1"`
	V2    string `datastore:"v2"`
	V3    string `datastore:"v3"`
	V4    string `datastore:"v4"`
	V5    string `datastore:"v5"`
}

CasbinRule represents a rule in Casbin.

type Config

type Config struct {
	// Datastore kind name.
	// Optional. (Default: "casbin")
	Kind string
	// Datastore namespace.
	// Optional. (Default: "")
	Namespace string
}

Jump to

Keyboard shortcuts

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