state

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID     string `msg:"_id" json:"_id" mapstructure:"_id" bson:"_id"`
	PubKey string `msg:"pubkey" json:"pubkey" mapstructure:"pubkey" bson:"pubkey"`
}

type Conversion

type Conversion struct {
	ID                  string  `msg:"_id" json:"_id" mapstructure:"_id" bson:"_id"`
	AdvertiserAccountID string  `msg:"advertiser_account_id" json:"advertiser_account_id" mapstructure:"advertiser_account_id" bson:"advertiser_account_id"`
	AffiliateAccountID  string  `msg:"affiliate_account_id" json:"affiliate_account_id" mapstructure:"affiliate_account_id" bson:"affiliate_account_id"`
	ClickID             string  `msg:"click_id" json:"click_id" mapstructure:"click_id" bson:"click_id"`
	StreamID            string  `msg:"stream_id" json:"stream_id" mapstructure:"stream_id" bson:"stream_id"`
	OfferID             string  `msg:"offer_id" json:"offer_id" mapstructure:"offer_id" bson:"offer_id"`
	ClientID            string  `msg:"client_id" json:"client_id" mapstructure:"client_id" bson:"client_id"`
	GoalID              string  `msg:"goal_id" json:"goal_id" mapstructure:"goal_id" bson:"goal_id"`
	CreatedAt           float64 `msg:"created_at" json:"created_at" mapstructure:"created_at" bson:"created_at"`
	Comment             string  `msg:"comment" json:"comment" mapstructure:"comment" bson:"comment"`
	Status              string  `msg:"status" json:"status" mapstructure:"status" bson:"status"`
}

type State

type State struct {
	DB *mgo.Database
}

func NewStateFromDB

func NewStateFromDB(db *mgo.Database) *State

NewStateFromDB method constructs MongoDB state

func (*State) AddAccount

func (s *State) AddAccount(account *Account) error

func (*State) AddConversion

func (s *State) AddConversion(conversion *Conversion) error

func (*State) AddTransition

func (s *State) AddTransition(transition *Transition) error

func (*State) DeleteAccount

func (s *State) DeleteAccount(id string) error

func (*State) GetAccount

func (s *State) GetAccount(id string) (*Account, error)

func (*State) GetAccountPubKey

func (s *State) GetAccountPubKey(id string) (*crypto.Key, error)

func (*State) GetConversion

func (s *State) GetConversion(id string) (*Conversion, error)

func (*State) GetTransition

func (s *State) GetTransition(id string) (*Transition, error)

func (*State) HasAccount

func (s *State) HasAccount(id string) bool

func (*State) HasConversion

func (s *State) HasConversion(id string) bool

func (*State) HasTransition

func (s *State) HasTransition(id string) bool

func (*State) ListAccounts

func (s *State) ListAccounts() (result []*Account, err error)

func (*State) ListConversions

func (s *State) ListConversions() (result []*Conversion, err error)

func (*State) ListTransitions

func (s *State) ListTransitions() (result []*Transition, err error)

func (*State) SearchConversions

func (s *State) SearchConversions(query interface{}, limit, offset int) (result []*Conversion, err error)

func (*State) SearchTransitions

func (s *State) SearchTransitions(query interface{}, limit, offset int) (result []*Transition, err error)

func (*State) SetAccount

func (s *State) SetAccount(account *Account) error

func (*State) SetConversion

func (s *State) SetConversion(conversion *Conversion) error

func (*State) SetTransition

func (s *State) SetTransition(transition *Transition) error

type Transition

type Transition struct {
	ID                  string  `msg:"_id" json:"_id" mapstructure:"_id" bson:"_id"`
	AdvertiserAccountID string  `msg:"advertiser_account_id" json:"advertiser_account_id" mapstructure:"advertiser_account_id" bson:"advertiser_account_id"`
	AffiliateAccountID  string  `msg:"affiliate_account_id" json:"affiliate_account_id" mapstructure:"affiliate_account_id" bson:"affiliate_account_id"`
	ClickID             string  `msg:"click_id" json:"click_id" mapstructure:"click_id" bson:"click_id"`
	StreamID            string  `msg:"stream_id" json:"stream_id" mapstructure:"stream_id" bson:"stream_id"`
	OfferID             string  `msg:"offer_id" json:"offer_id" mapstructure:"offer_id" bson:"offer_id"`
	CreatedAt           float64 `msg:"created_at" json:"created_at" mapstructure:"created_at" bson:"created_at"`
	ExpiresIn           int64   `msg:"expires_in" json:"expires_in" mapstructure:"expires_in" bson:"expires_in"`
}

Jump to

Keyboard shortcuts

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