storage

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store is a storage client

func NewPostgresStore

func NewPostgresStore() (*Store, error)

NewPostgresStore creates a postgres client

func (*Store) AddTransactions

func (store *Store) AddTransactions(item *venmo.FeedItem) error

AddTransactions adds a transaction to the db

func (*Store) Flush

func (store *Store) Flush() error

Flush flushes the store buffer

func (*Store) SampleUsersWithoutBingResults added in v0.0.4

func (store *Store) SampleUsersWithoutBingResults(n int) ([]User, error)

SampleUsersWithoutBingResults samples users

func (*Store) UpdateUser added in v0.0.4

func (store *Store) UpdateUser(user *User) error

UpdateUser updates a user

type Transaction

type Transaction struct {
	ID          int
	Message     string `pg:"type:'varchar'"`
	Story       string `pg:"type:'varchar'"`
	Type        string `pg:"type:'varchar'"`
	Created     string `pg:"type:'timestamp'"`
	Updated     string `pg:"type:'timestamp'"`
	ActorUserID int
	RecipientID int
}

Transaction is postgres transaction

type User

type User struct {
	ID           int
	Transactions []Transaction          `pg:"many2many:user_to_transactions"`
	Username     string                 `pg:"type:'varchar'"`
	PictureURL   string                 `pg:"type:'varchar'"`
	Name         string                 `pg:"type:'varchar'"`
	FirstName    string                 `pg:"type:'varchar'"`
	LastName     string                 `pg:"type:'varchar'"`
	Created      string                 `pg:"type:'timestamp'"`
	IsBusiness   bool                   `pg:"type:'boolean',default:false"`
	Cancelled    bool                   `pg:"type:'boolean',default:false"`
	ExternalID   string                 `pg:"type:'varchar'"`
	BingResults  map[string]interface{} `pg:"type:'json'"`
}

User is a postgres user

type UserToTransaction

type UserToTransaction struct {
	UserID        int
	TransactionID int
	IsActor       bool `pg:"type:'boolean'"`
}

UserToTransaction is relation between users and transactions

Jump to

Keyboard shortcuts

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