store

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: Apache-2.0, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PaginatedResult added in v0.3.0

type PaginatedResult struct {
	Page       int64       `json:"page"`
	Limit      int64       `json:"limit"`
	TotalCount int64       `json:"total_count"`
	TotalPages int64       `json:"total_pages"`
	Records    interface{} `json:"records"`
}

PaginatedResult represents database records with pagination metadata

type Pagination added in v0.3.0

type Pagination struct {
	Page  int64 `form:"page"`
	Limit int64 `form:"limit"`
}

Pagination represents the pagination parameters

func (*Pagination) Validate added in v0.3.0

func (p *Pagination) Validate() error

Validate sanitizes the pagination parameters

type Store

type Store struct {
	Epoch       epochStore
	Miner       minerStore
	Transaction transactionStore
	Event       eventStore
	// contains filtered or unexported fields
}

Store handles database operations

func New

func New(connStr string, logMode logger.LogLevel) (*Store, error)

New creates a store from the connection string

func (*Store) Begin added in v0.4.0

func (s *Store) Begin() error

Begin starts a database transaction

func (*Store) Close

func (s *Store) Close() error

Close closes the database connection

func (*Store) Commit added in v0.4.0

func (s *Store) Commit() error

Commit commits the database transaction

func (*Store) Conn

func (s *Store) Conn() (*sql.DB, error)

Conn returns the underlying database connection

func (*Store) DatabaseSize added in v0.4.0

func (s *Store) DatabaseSize() (int64, error)

DatabaseSize returns the size of the database

func (*Store) Rollback added in v0.4.0

func (s *Store) Rollback() error

Rollback rolls back the database transaction

func (*Store) Test added in v0.2.0

func (s *Store) Test() error

Test checks the database connection

Jump to

Keyboard shortcuts

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