pebbleadapter

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

README

Casbin Pebble Adapter

A Casbin Pebble Adapter (see https://casbin.org/docs/adapters).

  • auto-save functionality
  • filtered adapter functionality

Individual policy lines get saved into the specified Pebble DB which is keyed using a :: delimited value of the role. The value content is a JSON representation of the policy rule.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAdapter

func NewAdapter(db *pebble.DB, prefix string) (persist.BatchAdapter, error)

NewAdapter creates a new adapter. It assumes that the Pebble DB is already open. A prefix is used if given and represents the Pebble prefix to save the under.

Types

type CasbinRule

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

CasbinRule represents a Casbin rule line.

func (*CasbinRule) Rule

func (cr *CasbinRule) Rule() []string

Jump to

Keyboard shortcuts

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