access

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

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

Checker manages access control across multiple hosts.

func New

func New(cfg *config.Config) *Checker

func (*Checker) ForHost

func (c *Checker) ForHost(host string) (*HostChecker, error)

type HostChecker

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

HostChecker resolves permissions for a single host.

func (*HostChecker) CanAdmin

func (c *HostChecker) CanAdmin(database, table string) bool

func (*HostChecker) CanRead

func (c *HostChecker) CanRead(database, table string) bool

func (*HostChecker) CanWrite

func (c *HostChecker) CanWrite(database, table string) bool

func (*HostChecker) DatabaseAccess

func (c *HostChecker) DatabaseAccess(database string) Level

func (*HostChecker) FilterDatabases

func (c *HostChecker) FilterDatabases(all []string) []string

func (*HostChecker) IsVisible

func (c *HostChecker) IsVisible(database string) bool

func (*HostChecker) TableAccess

func (c *HostChecker) TableAccess(database, table string) Level

type Level

type Level int
const (
	None Level = iota
	Read
	Write
	Admin
)

func ParseLevel

func ParseLevel(s string) Level

func (Level) String

func (l Level) String() string

type SQLClassification

type SQLClassification struct {
	Kind   SQLKind
	Tables []string
}

func ClassifySQL

func ClassifySQL(query string) SQLClassification

type SQLKind

type SQLKind string
const (
	KindSelect SQLKind = "SELECT"
	KindInsert SQLKind = "INSERT"
	KindUpdate SQLKind = "UPDATE"
	KindDelete SQLKind = "DELETE"
	KindAlter  SQLKind = "ALTER"
	KindCreate SQLKind = "CREATE"
	KindDrop   SQLKind = "DROP"
	KindOther  SQLKind = "OTHER"
)

func (SQLKind) IsDDL

func (k SQLKind) IsDDL() bool

func (SQLKind) IsRead

func (k SQLKind) IsRead() bool

func (SQLKind) IsWrite

func (k SQLKind) IsWrite() bool

Jump to

Keyboard shortcuts

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