casbin: github.com/casbin/casbin/config Index | Files

package config

import "github.com/casbin/casbin/config"

Index

Package Files

config.go

Variables

var (
    // DEFAULT_SECTION specifies the name of a section if no name provided
    DEFAULT_SECTION = "default"
    // DEFAULT_COMMENT defines what character(s) indicate a comment `#`
    DEFAULT_COMMENT = []byte{'#'}
    // DEFAULT_COMMENT_SEM defines what alternate character(s) indicate a comment `;`
    DEFAULT_COMMENT_SEM = []byte{';'}
    // DEFAULT_MULTI_LINE_SEPARATOR defines what character indicates a multi-line content
    DEFAULT_MULTI_LINE_SEPARATOR = []byte{'\\'}
)

type Config Uses

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

Config represents an implementation of the ConfigInterface

func (*Config) AddConfig Uses

func (c *Config) AddConfig(section string, option string, value string) bool

AddConfig adds a new section->key:value to the configuration.

func (*Config) Bool Uses

func (c *Config) Bool(key string) (bool, error)

Bool lookups up the value using the provided key and converts the value to a bool

func (*Config) Float64 Uses

func (c *Config) Float64(key string) (float64, error)

Float64 lookups up the value using the provided key and converts the value to a float64

func (*Config) Int Uses

func (c *Config) Int(key string) (int, error)

Int lookups up the value using the provided key and converts the value to a int

func (*Config) Int64 Uses

func (c *Config) Int64(key string) (int64, error)

Int64 lookups up the value using the provided key and converts the value to a int64

func (*Config) Set Uses

func (c *Config) Set(key string, value string) error

Set sets the value for the specific key in the Config

func (*Config) String Uses

func (c *Config) String(key string) string

String lookups up the value using the provided key and converts the value to a string

func (*Config) Strings Uses

func (c *Config) Strings(key string) []string

Strings lookups up the value using the provided key and converts the value to an array of string by splitting the string by comma

type ConfigInterface Uses

type ConfigInterface interface {
    String(key string) string
    Strings(key string) []string
    Bool(key string) (bool, error)
    Int(key string) (int, error)
    Int64(key string) (int64, error)
    Float64(key string) (float64, error)
    Set(key string, value string) error
}

ConfigInterface defines the behavior of a Config implementation

func NewConfig Uses

func NewConfig(confName string) (ConfigInterface, error)

NewConfig create an empty configuration representation from file.

func NewConfigFromText Uses

func NewConfigFromText(text string) (ConfigInterface, error)

NewConfigFromText create an empty configuration representation from text.

Package config imports 8 packages (graph) and is imported by 6 packages. Updated 2020-07-04. Refresh now. Tools for package owners.