db

package
v0.0.0-...-e5993db Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrefixAddressKey        = "linked"
	PrefixAddressSeenTx     = "address-seen-tx"
	PrefixAddressTime       = "addresstime"
	PrefixBlock             = "block"
	PrefixCookies           = "cookies"
	PrefixBotRunningCount   = "memobot-running-count"
	PrefixBotStreamsCount   = "memobot-num-streams"
	PrefixCompletedTx       = "completed"
	PrefixFlag              = "flags"
	PrefixProfile           = "profile"
	PrefixSavedAddressTweet = "saved"
	PrefixTweetTx           = "tweets"
	PrefixTxBlock           = "txblock"
	PrefixTxInput           = "input"
	PrefixTxOutput          = "output"

	PrefixSubBotCommand = "sub-bot-command"
)
View Source
const Spacer = '-'

Variables

This section is empty.

Functions

func Delete

func Delete(objects []ObjectI) error

func GetDb

func GetDb() (*leveldb.DB, error)

func GetFirstItem

func GetFirstItem(obj ObjectI, prefix []byte) error

func GetItem

func GetItem(obj ObjectI) error

func GetKeyVal

func GetKeyVal(iter iterator.Iterator) ([]byte, []byte)

func GetLastItem

func GetLastItem(obj ObjectI, prefix []byte) error

func GetNum

func GetNum(prefix []byte) (int, error)

func GetObjectCombinedUid

func GetObjectCombinedUid(o ObjectI) []byte

func GetSpecificItem

func GetSpecificItem(obj ObjectI) error

func HasCompletedTx

func HasCompletedTx(txHash [32]byte) (bool, error)

func Save

func Save(objects []ObjectI) error

func Set

func Set(obj ObjectI, iter iterator.Iterator)

Types

type AddressLinkedKey

type AddressLinkedKey struct {
	Address [25]byte
	UserID  int64
	Key     []byte
}

func GetAddressKey

func GetAddressKey(address [25]byte, userId int64) (*AddressLinkedKey, error)

func GetAllAddressKey

func GetAllAddressKey() ([]*AddressLinkedKey, error)

func (*AddressLinkedKey) Deserialize

func (k *AddressLinkedKey) Deserialize(d []byte)

func (*AddressLinkedKey) GetPrefix

func (k *AddressLinkedKey) GetPrefix() string

func (*AddressLinkedKey) GetUid

func (k *AddressLinkedKey) GetUid() []byte

func (*AddressLinkedKey) Serialize

func (k *AddressLinkedKey) Serialize() []byte

func (*AddressLinkedKey) SetUid

func (k *AddressLinkedKey) SetUid(b []byte)

type AddressSeenTx

type AddressSeenTx struct {
	Address [25]byte
	Seen    time.Time
	TxHash  [32]byte
}

func GetAllAddressSeenTx

func GetAllAddressSeenTx() ([]*AddressSeenTx, error)

func GetRecentAddressSeenTx

func GetRecentAddressSeenTx(address [25]byte) (*AddressSeenTx, error)

func (*AddressSeenTx) Deserialize

func (t *AddressSeenTx) Deserialize([]byte)

func (*AddressSeenTx) GetPrefix

func (t *AddressSeenTx) GetPrefix() string

func (*AddressSeenTx) GetUid

func (t *AddressSeenTx) GetUid() []byte

func (*AddressSeenTx) Serialize

func (t *AddressSeenTx) Serialize() []byte

func (*AddressSeenTx) SetUid

func (t *AddressSeenTx) SetUid(b []byte)

type AddressWalletTime

type AddressWalletTime struct {
	Address [25]byte
	Time    time.Time
}

func GetAddressTime

func GetAddressTime(address [25]byte) (*AddressWalletTime, error)

func (*AddressWalletTime) Deserialize

func (t *AddressWalletTime) Deserialize(d []byte)

func (*AddressWalletTime) GetPrefix

func (t *AddressWalletTime) GetPrefix() string

func (*AddressWalletTime) GetUid

func (t *AddressWalletTime) GetUid() []byte

func (*AddressWalletTime) Serialize

func (t *AddressWalletTime) Serialize() []byte

func (*AddressWalletTime) SetUid

func (t *AddressWalletTime) SetUid(b []byte)

type Block

type Block struct {
	BlockHash [32]byte
	Block     []byte
}

func (*Block) Deserialize

func (b *Block) Deserialize(d []byte)

func (*Block) GetPrefix

func (b *Block) GetPrefix() string

func (*Block) GetUid

func (b *Block) GetUid() []byte

func (*Block) Serialize

func (b *Block) Serialize() []byte

func (*Block) SetUid

func (b *Block) SetUid(u []byte)

type BotStreamsCount

type BotStreamsCount struct {
	Count int
}

func GetBotStreamsCount

func GetBotStreamsCount() (*BotStreamsCount, error)

func (*BotStreamsCount) Deserialize

func (c *BotStreamsCount) Deserialize(d []byte)

func (*BotStreamsCount) GetPrefix

func (c *BotStreamsCount) GetPrefix() string

func (*BotStreamsCount) GetUid

func (c *BotStreamsCount) GetUid() []byte

func (*BotStreamsCount) Serialize

func (c *BotStreamsCount) Serialize() []byte

func (*BotStreamsCount) SetUid

func (c *BotStreamsCount) SetUid([]byte)

type CompletedTx

type CompletedTx struct {
	TxHash [32]byte
}

func (*CompletedTx) Deserialize

func (t *CompletedTx) Deserialize([]byte)

func (*CompletedTx) GetPrefix

func (t *CompletedTx) GetPrefix() string

func (*CompletedTx) GetUid

func (t *CompletedTx) GetUid() []byte

func (*CompletedTx) Serialize

func (t *CompletedTx) Serialize() []byte

func (*CompletedTx) SetUid

func (t *CompletedTx) SetUid(b []byte)

type Cookies

type Cookies struct {
	CookieData []byte
}

func GetCookies

func GetCookies() (*Cookies, error)

func (*Cookies) Deserialize

func (c *Cookies) Deserialize(d []byte)

func (*Cookies) GetPrefix

func (c *Cookies) GetPrefix() string

func (*Cookies) GetUid

func (c *Cookies) GetUid() []byte

func (*Cookies) Serialize

func (c *Cookies) Serialize() []byte

func (*Cookies) SetUid

func (c *Cookies) SetUid(_ []byte)

type Flag

type Flag struct {
	Address [25]byte
	UserID  int64
	Flags   Flags
}

func GetFlag

func GetFlag(address [25]byte, userId int64) (*Flag, error)

func (*Flag) Deserialize

func (f *Flag) Deserialize(d []byte)

func (*Flag) GetPrefix

func (f *Flag) GetPrefix() string

func (*Flag) GetUid

func (f *Flag) GetUid() []byte

func (*Flag) Serialize

func (f *Flag) Serialize() []byte

func (*Flag) SetUid

func (f *Flag) SetUid(b []byte)

type Flags

type Flags struct {
	Link    bool `json:"link"`
	Date    bool `json:"date"`
	CatchUp bool `json:"catch_up"`
}

func GetDefaultFlags

func GetDefaultFlags() Flags

type ObjectI

type ObjectI interface {
	GetPrefix() string
	GetUid() []byte
	SetUid([]byte)
	Serialize() []byte
	Deserialize([]byte)
}

type Profile

type Profile struct {
	Owner   [25]byte
	UserID  int64
	Profile []byte
}

func GetProfile

func GetProfile(address [25]byte, userId int64) (*Profile, error)

func (*Profile) Deserialize

func (o *Profile) Deserialize(d []byte)

func (*Profile) GetPrefix

func (o *Profile) GetPrefix() string

func (*Profile) GetUid

func (o *Profile) GetUid() []byte

func (*Profile) Serialize

func (o *Profile) Serialize() []byte

func (*Profile) SetUid

func (o *Profile) SetUid(b []byte)

type SavedAddressTweet

type SavedAddressTweet struct {
	Address [25]byte
	UserID  int64
	TweetId int64
	TxHash  []byte
}

func GetAllSavedAddressTweet

func GetAllSavedAddressTweet(prefix []byte) ([]*SavedAddressTweet, error)

func GetRecentSavedAddressTweet

func GetRecentSavedAddressTweet(address [25]byte, userId int64) (*SavedAddressTweet, error)

func GetSavedAddressTweet

func GetSavedAddressTweet(address [25]byte, userId int64, tweetId int64) (*SavedAddressTweet, error)

func (*SavedAddressTweet) Deserialize

func (t *SavedAddressTweet) Deserialize(d []byte)

func (*SavedAddressTweet) GetPrefix

func (t *SavedAddressTweet) GetPrefix() string

func (*SavedAddressTweet) GetUid

func (t *SavedAddressTweet) GetUid() []byte

func (*SavedAddressTweet) Serialize

func (t *SavedAddressTweet) Serialize() []byte

func (*SavedAddressTweet) SetUid

func (t *SavedAddressTweet) SetUid(b []byte)

type SubBotCommand

type SubBotCommand struct {
	HistoryNum int
	BotExists  bool
	TxHash     [32]byte
}

func GetSubBotCommand

func GetSubBotCommand(txHash [32]byte) (*SubBotCommand, error)

func (*SubBotCommand) Deserialize

func (t *SubBotCommand) Deserialize(data []byte)

func (*SubBotCommand) GetPrefix

func (t *SubBotCommand) GetPrefix() string

func (*SubBotCommand) GetUid

func (t *SubBotCommand) GetUid() []byte

func (*SubBotCommand) Serialize

func (t *SubBotCommand) Serialize() []byte

func (*SubBotCommand) SetUid

func (t *SubBotCommand) SetUid(b []byte)

type TweetTx

type TweetTx struct {
	UserID  int64
	TweetId int64
	Tx      []byte
}

func GetAllTweetTx

func GetAllTweetTx() ([]*TweetTx, error)

func GetOldestTweetTx

func GetOldestTweetTx(userId int64) (*TweetTx, error)

func GetRecentTweetTx

func GetRecentTweetTx(userId int64) (*TweetTx, error)

func GetTweetTxs

func GetTweetTxs(userId int64, startTweetId int64, max int) ([]*TweetTx, error)

func (*TweetTx) Deserialize

func (t *TweetTx) Deserialize(d []byte)

func (*TweetTx) GetPrefix

func (t *TweetTx) GetPrefix() string

func (*TweetTx) GetUid

func (t *TweetTx) GetUid() []byte

func (*TweetTx) Serialize

func (t *TweetTx) Serialize() []byte

func (*TweetTx) SetUid

func (t *TweetTx) SetUid(b []byte)

type TxBlock

type TxBlock struct {
	TxHash    [32]byte
	BlockHash [32]byte
}

func (*TxBlock) Deserialize

func (tb *TxBlock) Deserialize([]byte)

func (*TxBlock) GetPrefix

func (tb *TxBlock) GetPrefix() string

func (*TxBlock) GetUid

func (tb *TxBlock) GetUid() []byte

func (*TxBlock) Serialize

func (tb *TxBlock) Serialize() []byte

func (*TxBlock) SetUid

func (tb *TxBlock) SetUid(b []byte)

type TxInput

type TxInput struct {
	PrevHash  [32]byte
	PrevIndex int
}

func GetTxInput

func GetTxInput(prevHash [32]byte, prevIndex int) (*TxInput, error)

func (*TxInput) Deserialize

func (i *TxInput) Deserialize([]byte)

func (*TxInput) GetPrefix

func (i *TxInput) GetPrefix() string

func (*TxInput) GetUid

func (i *TxInput) GetUid() []byte

func (*TxInput) Serialize

func (i *TxInput) Serialize() []byte

func (*TxInput) SetUid

func (i *TxInput) SetUid(b []byte)

type TxOutput

type TxOutput struct {
	Address [25]byte
	TxHash  [32]byte
	Index   int
	Output  []byte
}

func GetTxOutputs

func GetTxOutputs(addresses []wallet.Addr) ([]*TxOutput, error)

func (*TxOutput) Deserialize

func (o *TxOutput) Deserialize(d []byte)

func (*TxOutput) GetPrefix

func (o *TxOutput) GetPrefix() string

func (*TxOutput) GetUid

func (o *TxOutput) GetUid() []byte

func (*TxOutput) Serialize

func (o *TxOutput) Serialize() []byte

func (*TxOutput) SetUid

func (o *TxOutput) SetUid(b []byte)

Jump to

Keyboard shortcuts

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