blockchainstore

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

README

blockchainstore

Documentation

Index

Constants

View Source
const BLOCK_TABLE_NAME = "blocks_block"

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	dataobject.DataObject
}

func NewBlock

func NewBlock() *Block

func NewBlockFromExistingData

func NewBlockFromExistingData(data map[string]string) *Block

func NewBlockFromJSON

func NewBlockFromJSON(json string) *Block

func (*Block) Data

func (o *Block) Data() string

func (*Block) PreviousHash

func (o *Block) PreviousHash() string

func (*Block) SetData

func (o *Block) SetData(data string) *Block

func (*Block) SetPreviousHash

func (o *Block) SetPreviousHash(previousHash string) *Block

func (*Block) SetThisHash

func (o *Block) SetThisHash(thisHash string) *Block

func (*Block) SetTimestamp

func (o *Block) SetTimestamp(timestamp string) *Block

func (*Block) ThisHash

func (o *Block) ThisHash() string

func (*Block) Timestamp

func (o *Block) Timestamp() string

Timestamp is the time when the block was created

Returns: - string: the time when the block was created

type BlockQueryOptions

type BlockQueryOptions struct {
	ID   string
	IDIn []string
	// Status      string
	// StatusIn    []string
	Offset      int
	Limit       int
	SortOrder   string
	OrderBy     string
	CountOnly   bool
	WithDeleted bool
}

type Blockchain

type Blockchain struct {
	dataobject.DataObject
}

func NewBlockchain

func NewBlockchain() *Blockchain

type NewStoreOptions

type NewStoreOptions struct {
	BlockTableName     string
	DB                 *sql.DB
	DbDriverName       string
	TimeoutSeconds     int64
	AutomigrateEnabled bool
	DebugEnabled       bool
}

NewStoreOptions define the options for creating a new block store

type Store

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

func NewStore

func NewStore(opts NewStoreOptions) (*Store, error)

NewStore creates a new block store

func (*Store) AutoMigrate

func (store *Store) AutoMigrate() error

AutoMigrate auto migrate

func (*Store) BlockCreate

func (store *Store) BlockCreate(ctx context.Context, block *Block) error

func (*Store) BlockDelete

func (store *Store) BlockDelete(ctx context.Context, block *Block) error

func (*Store) BlockDeleteByID

func (store *Store) BlockDeleteByID(ctx context.Context, id string) error

func (*Store) BlockFindByID

func (store *Store) BlockFindByID(ctx context.Context, id string) (*Block, error)

func (*Store) BlockList

func (store *Store) BlockList(ctx context.Context, options BlockQueryOptions) ([]Block, error)

func (*Store) BlockUpdate

func (store *Store) BlockUpdate(ctx context.Context, block *Block) error

func (*Store) EnableDebug

func (st *Store) EnableDebug(debug bool)

EnableDebug - enables the debug option

type StoreInterface

type StoreInterface interface {
	BlockCreate(ctx context.Context, block *Block) error
	BlockDelete(ctx context.Context, block *Block) error
	BlockDeleteByID(ctx context.Context, blockID string) error
	BlockFindByID(ctx context.Context, id string) (*Block, error)
	BlockList(ctx context.Context, options BlockQueryOptions) ([]Block, error)
	BlockUpdate(ctx context.Context, block *Block) error
}

Jump to

Keyboard shortcuts

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