params

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0, UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Overview

Package params provides a lightweight implementation inspired by the x/params module of the Cosmos SDK.

It includes a keeper for managing key-value pairs with module identifiers as prefixes, along with a global querier for retrieving any key from any module.

Changes: This version removes the concepts of subspaces and proposals, allowing the creation of multiple keepers identified by a provided prefix. Proposals may be added later when governance modules are introduced. The transient store and .Modified helper have also been removed but can be implemented later if needed. Keys are represented as strings instead of []byte.

XXX: removes isAlphaNum validation for keys.

Index

Constants

View Source
const (
	ModuleName = "params"
	StoreKey   = ModuleName
)

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(params ParamsKeeper) paramsHandler

Types

type ParamsKeeper

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

global paramstore Keeper.

func NewParamsKeeper

func NewParamsKeeper(key store.StoreKey, prefix string) ParamsKeeper

NewParamsKeeper returns a new ParamsKeeper.

func (ParamsKeeper) GetBool

func (pk ParamsKeeper) GetBool(ctx sdk.Context, key string, ptr *bool)

func (ParamsKeeper) GetBytes

func (pk ParamsKeeper) GetBytes(ctx sdk.Context, key string, ptr *[]byte)

func (ParamsKeeper) GetInt64

func (pk ParamsKeeper) GetInt64(ctx sdk.Context, key string, ptr *int64)

func (ParamsKeeper) GetRaw

func (pk ParamsKeeper) GetRaw(ctx sdk.Context, key string) []byte

func (ParamsKeeper) GetString

func (pk ParamsKeeper) GetString(ctx sdk.Context, key string, ptr *string)

func (ParamsKeeper) GetUint64

func (pk ParamsKeeper) GetUint64(ctx sdk.Context, key string, ptr *uint64)

func (ParamsKeeper) Has

func (pk ParamsKeeper) Has(ctx sdk.Context, key string) bool

func (ParamsKeeper) Logger

func (pk ParamsKeeper) Logger(ctx sdk.Context) *slog.Logger

Logger returns a module-specific logger. XXX: why do we expose this?

func (ParamsKeeper) SetBool

func (pk ParamsKeeper) SetBool(ctx sdk.Context, key string, value bool)

func (ParamsKeeper) SetBytes

func (pk ParamsKeeper) SetBytes(ctx sdk.Context, key string, value []byte)

func (ParamsKeeper) SetInt64

func (pk ParamsKeeper) SetInt64(ctx sdk.Context, key string, value int64)

func (ParamsKeeper) SetString

func (pk ParamsKeeper) SetString(ctx sdk.Context, key, value string)

func (ParamsKeeper) SetUint64

func (pk ParamsKeeper) SetUint64(ctx sdk.Context, key string, value uint64)

type ParamsKeeperI

type ParamsKeeperI interface {
	GetString(ctx sdk.Context, key string, ptr *string)
	GetInt64(ctx sdk.Context, key string, ptr *int64)
	GetUint64(ctx sdk.Context, key string, ptr *uint64)
	GetBool(ctx sdk.Context, key string, ptr *bool)
	GetBytes(ctx sdk.Context, key string, ptr *[]byte)

	SetString(ctx sdk.Context, key string, value string)
	SetInt64(ctx sdk.Context, key string, value int64)
	SetUint64(ctx sdk.Context, key string, value uint64)
	SetBool(ctx sdk.Context, key string, value bool)
	SetBytes(ctx sdk.Context, key string, value []byte)

	Has(ctx sdk.Context, key string) bool
	GetRaw(ctx sdk.Context, key string) []byte
}

Jump to

Keyboard shortcuts

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