scoped

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package scoped implements scoping for a hugot Store. It take another store and adds prefixes that are private to various scopes.

- scope.Global data is seen by all users in all channels. - scope.Channel data is private to the current channel. - scope.ChannelUser is private for this user in this channel. - scope.User is private to this user.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	storage.Storer
}

Store implements a store which

func New

func New(base storage.Storer, s scope.Scope, channel, user string) *Store

New returns a new Storer that prefixes the passed in Store with a key defined by the scope as described by the scope and Message

func (*Store) Get

func (s *Store) Get(key []string) (string, bool, error)

Get retries a key from the store

func (*Store) List

func (s *Store) List(key []string) ([][]string, error)

List all items under the provided prefix

func (*Store) Set

func (s *Store) Set(key []string, value string) error

Set a key in the store

func (*Store) Unset

func (s *Store) Unset(key []string) error

Unset a key in the store

Jump to

Keyboard shortcuts

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