persist

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	LoadPolicy(model casbin.Model)
	SavePolicy(model casbin.Model)
}

type DBAdapter

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

The database adapter for policy persistence, can load policy from database or save policy to database. For now, only MySQL is tested, but it should work for other RDBMS.

func NewDBAdapter

func NewDBAdapter(driverName string, dataSourceName string) *DBAdapter

The constructor for DBAdapter.

func (*DBAdapter) LoadPolicy

func (a *DBAdapter) LoadPolicy(model casbin.Model)

Load policy from database.

func (*DBAdapter) SavePolicy

func (a *DBAdapter) SavePolicy(model casbin.Model)

Save policy to database.

type FileAdapter

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

The file adapter for policy persistence, can load policy from file or save policy to file.

func NewFileAdapter

func NewFileAdapter(filePath string) *FileAdapter

The constructor for FileAdapter.

func (*FileAdapter) LoadPolicy

func (a *FileAdapter) LoadPolicy(model casbin.Model)

Load policy from file.

func (*FileAdapter) SavePolicy

func (a *FileAdapter) SavePolicy(model casbin.Model)

Save policy to file.

Jump to

Keyboard shortcuts

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