ormdb

package
v1.0.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: Apache-2.0 Imports: 20 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModuleDB

type ModuleDB interface {
	ormtable.Schema

	// GenesisHandler returns an implementation of appmodule.HasGenesis
	// to be embedded in or called from app module implementations.
	// Ex:
	//   type AppModule struct {
	//     appmodule.HasGenesis
	//   }
	//
	//   func NewKeeper(db ModuleDB) *Keeper {
	//     return &Keeper{genesisHandler: db.GenesisHandler()}
	//   }
	//
	//  func NewAppModule(keeper keeper.Keeper) AppModule {
	//    return AppModule{HasGenesis: keeper.GenesisHandler()}
	//  }
	GenesisHandler() appmodule.HasGenesis
	// contains filtered or unexported methods
}

ModuleDB defines the ORM database type to be used by modules.

func NewModuleDB

func NewModuleDB(schema *ormv1alpha1.ModuleSchemaDescriptor, options ModuleDBOptions) (ModuleDB, error)

NewModuleDB constructs a ModuleDB instance from the provided schema and options.

type ModuleDBOptions

type ModuleDBOptions struct {
	// TypeResolver is an optional type resolver to be used when unmarshaling
	// protobuf messages. If it is nil, protoregistry.GlobalTypes will be used.
	TypeResolver ormtable.TypeResolver

	// FileResolver is an optional file resolver that can be used to retrieve
	// pinned file descriptors that may be different from those available at
	// runtime. The file descriptor versions returned by this resolver will be
	// used instead of the ones provided at runtime by the ModuleSchema.
	FileResolver protodesc.Resolver

	// JSONValidator is an optional validator that can be used for validating
	// messaging when using ValidateJSON. If it is nil, DefaultJSONValidator
	// will be used
	JSONValidator func(proto.Message) error

	// KVStoreService is the storage service to use for the DB if default KV-store storage is used.
	KVStoreService store.KVStoreService

	// KVStoreService is the storage service to use for the DB if memory storage is used.
	MemoryStoreService store.MemoryStoreService

	// KVStoreService is the storage service to use for the DB if transient storage is used.
	TransientStoreService store.TransientStoreService
}

ModuleDBOptions are options for constructing a ModuleDB.

Jump to

Keyboard shortcuts

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