firestoreadapter

package module
v0.0.0-...-bc86ae4 Latest Latest
Warning

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

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

README

casbin-firestore-adapter

A Google Cloud Firestore adapter for Casbin

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadModel

func LoadModel(client *firestore.Client) (model.Model, error)

LoadModel loads a casbin model definition from Firestore.

func LoadModelWithConfig

func LoadModelWithConfig(client *firestore.Client, config Config) (model.Model, error)

LoadModel loads a casbin model definition from Firestore.

func NewAdapter

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

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

func NewAdapterWithConfig

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

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

func SaveModel

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

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

func SaveModelWithConfig

func SaveModelWithConfig(client *firestore.Client, path string, config Config) error

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

Types

type CasbinModelConf

type CasbinModelConf struct {
	Text string `firestore:"text"`
}

type CasbinRule

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

CasbinRule represents a rule in Casbin.

type Config

type Config struct {
	// Firestore collection name.
	// Optional. (Default: "casbin")
	Collection string
}

Jump to

Keyboard shortcuts

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