Documentation
¶
Index ¶
- type Account
- type Conversion
- type State
- func (s *State) AddAccount(account *Account) error
- func (s *State) AddConversion(conversion *Conversion) error
- func (s *State) AddTransition(transition *Transition) error
- func (s *State) GetAccount(id string) (*Account, error)
- func (s *State) GetAccountPubKey(id string) (*crypto.Key, error)
- func (s *State) GetConversion(id string) (*Conversion, error)
- func (s *State) GetTransition(id string) (*Transition, error)
- func (s *State) HasAccount(id string) bool
- func (s *State) HasConversion(id string) bool
- func (s *State) HasTransition(id string) bool
- func (s *State) ListAccounts() (result []*Account, err error)
- func (s *State) ListConversions() (result []*Conversion, err error)
- func (s *State) ListTransitions() (result []*Transition, err error)
- func (s *State) SearchAccounts(query interface{}, limit, offset int) (result []*Account, err error)
- func (s *State) SearchConversions(query interface{}, limit, offset int) (result []*Conversion, err error)
- func (s *State) SearchTransitions(query interface{}, limit, offset int) (result []*Transition, err error)
- func (s *State) SetAccount(account *Account) error
- func (s *State) SetConversion(conversion *Conversion) error
- func (s *State) SetTransition(transition *Transition) error
- type Transition
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"`
}
Account struct keeps account related fields.
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"`
}
Conversion struct keep conversion related fields.
type State ¶
State struct contains pointer to MongoDB instance.
func NewStateFromDB ¶
NewStateFromDB method constructs MongoDB state.
func (*State) AddAccount ¶
AddAccount method adds new account if all checks were passed.
func (*State) AddConversion ¶
func (s *State) AddConversion(conversion *Conversion) error
AddConversion method adds new conversion to the state if it not exists.
func (*State) AddTransition ¶
func (s *State) AddTransition(transition *Transition) error
AddTransition method adds new transition to state if it not exists.
func (*State) GetAccount ¶
GetAccount method returns account from accounts collection by given accoutn id.
func (*State) GetAccountPubKey ¶
GetAccountPubKey method returns public key by given account id.
func (*State) GetConversion ¶
func (s *State) GetConversion(id string) (*Conversion, error)
GetConversion method gets conversion from state by it identifier.
func (*State) GetTransition ¶
func (s *State) GetTransition(id string) (*Transition, error)
GetTransition method gets transition from state by given id.
func (*State) HasAccount ¶
HasAccount method checks if account exists in state or not exists.
func (*State) HasConversion ¶
HasConversion method checks exists conversion in state ot not.
func (*State) HasTransition ¶
HasTransition method checks exists conversion in state or not exists.
func (*State) ListAccounts ¶
ListAccounts method returns all accounts from the state.
func (*State) ListConversions ¶
func (s *State) ListConversions() (result []*Conversion, err error)
ListConversions method returns list of all conversions in state.
func (*State) ListTransitions ¶
func (s *State) ListTransitions() (result []*Transition, err error)
ListTransitions method returns list of all transitions from state.
func (*State) SearchAccounts ¶ added in v1.2.0
SearchAccounts method returns accounts by given search query, limit and offset parameters.
func (*State) SearchConversions ¶
func (s *State) SearchConversions(query interface{}, limit, offset int) (result []*Conversion, err error)
SearchConversions method finds conversions using mongodb query language.
func (*State) SearchTransitions ¶
func (s *State) SearchTransitions(query interface{}, limit, offset int) (result []*Transition, err error)
SearchTransitions method finds conversions in state using mongodb query language.
func (*State) SetAccount ¶
SetAccount method adds account in state.
func (*State) SetConversion ¶
func (s *State) SetConversion(conversion *Conversion) error
SetConversion inserts new conversion to state without any checks.
func (*State) SetTransition ¶
func (s *State) SetTransition(transition *Transition) error
SetTransition method inserts new transition in state without any checks.
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"`
}
Transition struct keeps transition related fields.