persist

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 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 model.Model)
	SavePolicy(model model.Model)
}

Adapter represents the abstract adapter interface for policy persistence. FileAdapter, DBAdapter inherits this interface.

type DBAdapter

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

DBAdapter represents 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

NewDBAdapter is the constructor for DBAdapter.

func (*DBAdapter) LoadPolicy

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

LoadPolicy loads policy from database.

func (*DBAdapter) SavePolicy

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

SavePolicy saves policy to database.

type FileAdapter

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

FileAdapter represents the file adapter for policy persistence, can load policy from file or save policy to file.

func NewFileAdapter

func NewFileAdapter(filePath string) *FileAdapter

NewFileAdapter is the constructor for FileAdapter.

func (*FileAdapter) LoadPolicy

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

LoadPolicy loads policy from file.

func (*FileAdapter) SavePolicy

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

SavePolicy saves policy to file.

Jump to

Keyboard shortcuts

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