Documentation ¶
Overview ¶
Package visitor is a default implementation of models/visitor package visitor related interfaces
Index ¶
- Constants
- func APICreateVisitor(context api.InterfaceApplicationContext) (interface{}, error)
- func APICreateVisitorAttribute(context api.InterfaceApplicationContext) (interface{}, error)
- func APIDeleteVisitor(context api.InterfaceApplicationContext) (interface{}, error)
- func APIDeleteVisitorAttribute(context api.InterfaceApplicationContext) (interface{}, error)
- func APIFacebookLogin(context api.InterfaceApplicationContext) (interface{}, error)
- func APIForgotPassword(context api.InterfaceApplicationContext) (interface{}, error)
- func APIGetGuestsList(context api.InterfaceApplicationContext) (interface{}, error)
- func APIGetVisit(context api.InterfaceApplicationContext) (interface{}, error)
- func APIGetVisitor(context api.InterfaceApplicationContext) (interface{}, error)
- func APIGoogleLogin(context api.InterfaceApplicationContext) (interface{}, error)
- func APIInvalidateVisitor(context api.InterfaceApplicationContext) (interface{}, error)
- func APIListVisitorAttributes(context api.InterfaceApplicationContext) (interface{}, error)
- func APIListVisitors(context api.InterfaceApplicationContext) (interface{}, error)
- func APILogin(context api.InterfaceApplicationContext) (interface{}, error)
- func APILogout(context api.InterfaceApplicationContext) (interface{}, error)
- func APIMailToVisitor(context api.InterfaceApplicationContext) (interface{}, error)
- func APIRegisterVisitor(context api.InterfaceApplicationContext) (interface{}, error)
- func APIResetPassword(context api.InterfaceApplicationContext) (interface{}, error)
- func APIUpdateVisitor(context api.InterfaceApplicationContext) (interface{}, error)
- func APIUpdateVisitorAttribute(context api.InterfaceApplicationContext) (interface{}, error)
- func APIValidateVisitors(context api.InterfaceApplicationContext) (interface{}, error)
- func APIVisitorEmailAvailable(context api.InterfaceApplicationContext) (interface{}, error)
- type DefaultVisitor
- func (it *DefaultVisitor) CheckPassword(passwd string) bool
- func (it *DefaultVisitor) Delete() error
- func (it *DefaultVisitor) FromHashMap(input map[string]interface{}) error
- func (it *DefaultVisitor) GenerateNewPassword() error
- func (it *DefaultVisitor) Get(attribute string) interface{}
- func (it *DefaultVisitor) GetAttributesInfo() []models.StructAttributeInfo
- func (it *DefaultVisitor) GetBillingAddress() visitor.InterfaceVisitorAddress
- func (it *DefaultVisitor) GetCollection() models.InterfaceCollection
- func (it *DefaultVisitor) GetCreatedAt() time.Time
- func (it *DefaultVisitor) GetEmail() string
- func (it *DefaultVisitor) GetFacebookID() string
- func (it *DefaultVisitor) GetFirstName() string
- func (it *DefaultVisitor) GetFullName() string
- func (it *DefaultVisitor) GetGoogleID() string
- func (it *DefaultVisitor) GetID() string
- func (it *DefaultVisitor) GetImplementationName() string
- func (it *DefaultVisitor) GetLastName() string
- func (it *DefaultVisitor) GetModelName() string
- func (it *DefaultVisitor) GetShippingAddress() visitor.InterfaceVisitorAddress
- func (it *DefaultVisitor) GetToken() visitor.InterfaceVisitorCard
- func (it *DefaultVisitor) Invalidate() error
- func (it *DefaultVisitor) IsAdmin() bool
- func (it *DefaultVisitor) IsGuest() bool
- func (it *DefaultVisitor) IsVerified() bool
- func (it *DefaultVisitor) Load(ID string) error
- func (it *DefaultVisitor) LoadByEmail(email string) error
- func (it *DefaultVisitor) LoadByFacebookID(facebookID string) error
- func (it *DefaultVisitor) LoadByGoogleID(googleID string) error
- func (it *DefaultVisitor) New() (models.InterfaceModel, error)
- func (it *DefaultVisitor) ResetPassword() error
- func (it *DefaultVisitor) Save() error
- func (it *DefaultVisitor) Set(attribute string, value interface{}) error
- func (it *DefaultVisitor) SetBillingAddress(address visitor.InterfaceVisitorAddress) error
- func (it *DefaultVisitor) SetID(NewID string) error
- func (it *DefaultVisitor) SetPassword(passwd string) error
- func (it *DefaultVisitor) SetShippingAddress(address visitor.InterfaceVisitorAddress) error
- func (it *DefaultVisitor) SetToken(token visitor.InterfaceVisitorCard) error
- func (it *DefaultVisitor) ToHashMap() map[string]interface{}
- func (it *DefaultVisitor) UpdateResetPassword(key string, passwd string) error
- func (it *DefaultVisitor) Validate(key string) error
- type DefaultVisitorCollection
- func (it *DefaultVisitorCollection) GetDBCollection() db.InterfaceDBCollection
- func (it *DefaultVisitorCollection) GetImplementationName() string
- func (it *DefaultVisitorCollection) GetModelName() string
- func (it *DefaultVisitorCollection) List() ([]models.StructListItem, error)
- func (it *DefaultVisitorCollection) ListAddExtraAttribute(attribute string) error
- func (it *DefaultVisitorCollection) ListFilterAdd(Attribute string, Operator string, Value interface{}) error
- func (it *DefaultVisitorCollection) ListFilterReset() error
- func (it *DefaultVisitorCollection) ListLimit(offset int, limit int) error
- func (it *DefaultVisitorCollection) ListVisitors() []visitor.InterfaceVisitor
- func (it *DefaultVisitorCollection) New() (models.InterfaceModel, error)
Constants ¶
const ( ConstCollectionNameVisitor = "visitor" ConstEmailVerifyExpire = 60 * 60 * 24 ConstEmailPasswordResetExpire = 30 * 60 ConstErrorModule = "visitor" ConstErrorLevel = env.ConstErrorLevelActor ConstConfigPathLostPasswordEmailSubject = "general.mail.lost_password_email_subject" ConstConfigPathLostPasswordEmailTemplate = "general.mail.lost_password_email_template" )
Package global constants
Variables ¶
This section is empty.
Functions ¶
func APICreateVisitor ¶
func APICreateVisitor(context api.InterfaceApplicationContext) (interface{}, error)
APICreateVisitor creates a new visitor
- visitor attributes should be specified in content
- "email" attribute required
func APICreateVisitorAttribute ¶
func APICreateVisitorAttribute(context api.InterfaceApplicationContext) (interface{}, error)
APICreateVisitorAttribute creates a new custom attribute for a visitor model
- attribute parameters "Attribute" and "Label" are required
func APIDeleteVisitor ¶
func APIDeleteVisitor(context api.InterfaceApplicationContext) (interface{}, error)
APIDeleteVisitor deletes existing visitor
- visitor id should be specified in "visitorID" argument
func APIDeleteVisitorAttribute ¶
func APIDeleteVisitorAttribute(context api.InterfaceApplicationContext) (interface{}, error)
APIDeleteVisitorAttribute removes existing custom attribute of a visitor model
- attribute name/code should be provided in "attribute" argument
func APIFacebookLogin ¶
func APIFacebookLogin(context api.InterfaceApplicationContext) (interface{}, error)
APIFacebookLogin makes login and/or registration via Facebook
- "access_token" and "user_id" arguments required needed
- visitor attributes will be taken from Facebook
func APIForgotPassword ¶
func APIForgotPassword(context api.InterfaceApplicationContext) (interface{}, error)
APIForgotPassword changes and sends a new password to visitor e-mail
func APIGetGuestsList ¶
func APIGetGuestsList(context api.InterfaceApplicationContext) (interface{}, error)
APIGetGuestsList returns list of guests GROUP(ed) BY customer_email
func APIGetVisit ¶
func APIGetVisit(context api.InterfaceApplicationContext) (interface{}, error)
APIGetVisit returns current visit related information
func APIGetVisitor ¶
func APIGetVisitor(context api.InterfaceApplicationContext) (interface{}, error)
APIGetVisitor returns visitor information
- visitor id should be specified in "visitorID" argument
func APIGoogleLogin ¶
func APIGoogleLogin(context api.InterfaceApplicationContext) (interface{}, error)
APIGoogleLogin associates the specified email address with a Google account
- "access_token" attribute needed
- visitor attributes will be taken from Google
func APIInvalidateVisitor ¶
func APIInvalidateVisitor(context api.InterfaceApplicationContext) (interface{}, error)
APIInvalidateVisitor invalidate visitor by email, sends a new verification key to email
- visitor email should be specified in "email" argument
func APIListVisitorAttributes ¶
func APIListVisitorAttributes(context api.InterfaceApplicationContext) (interface{}, error)
APIListVisitorAttributes returns a list of visitor attributes
func APIListVisitors ¶
func APIListVisitors(context api.InterfaceApplicationContext) (interface{}, error)
APIListVisitors returns a list of existing visitors
- if "action" parameter is set to "count" result value will be just a number of list items
func APILogin ¶
func APILogin(context api.InterfaceApplicationContext) (interface{}, error)
APILogin makes login for a current visit
- "email" and "password" attributes required
func APILogout ¶
func APILogout(context api.InterfaceApplicationContext) (interface{}, error)
APILogout makes logout for current visit
func APIMailToVisitor ¶
func APIMailToVisitor(context api.InterfaceApplicationContext) (interface{}, error)
APIMailToVisitor sends email to specified visitors
- "subject", "content", "visitor_ids" arguments required
func APIRegisterVisitor ¶
func APIRegisterVisitor(context api.InterfaceApplicationContext) (interface{}, error)
APIRegisterVisitor creates a new visitor, sends verification link to visitor email
- visitor attributes should be included contents
- "email" attribute required
func APIResetPassword ¶
func APIResetPassword(context api.InterfaceApplicationContext) (interface{}, error)
APIResetPassword update visitor password by using verification key from email
func APIUpdateVisitor ¶
func APIUpdateVisitor(context api.InterfaceApplicationContext) (interface{}, error)
APIUpdateVisitor updates existing visitor
- visitor id should be specified in "visitorID" argument
- visitor attributes should be specified in content
func APIUpdateVisitorAttribute ¶
func APIUpdateVisitorAttribute(context api.InterfaceApplicationContext) (interface{}, error)
APIUpdateVisitorAttribute updates existing custom attribute of visitor model
- attribute name/code should be provided in "attribute" argument
- attribute parameters should be provided in request content
- attribute parameters "id" and "name" will be ignored
- static attributes can not be changed
func APIValidateVisitors ¶
func APIValidateVisitors(context api.InterfaceApplicationContext) (interface{}, error)
APIValidateVisitors validates visitors by a key which sends after registration
- verification key should be provided in "key" argument
func APIVisitorEmailAvailable ¶
func APIVisitorEmailAvailable(context api.InterfaceApplicationContext) (interface{}, error)
APIVisitorEmailAvailable creates a new visitor, sends verification link to visitor email
- "email" attribute required and email address in valid format
Types ¶
type DefaultVisitor ¶
type DefaultVisitor struct { Email string FacebookID string GoogleID string FirstName string LastName string BillingAddress visitor.InterfaceVisitorAddress ShippingAddress visitor.InterfaceVisitorAddress Token visitor.InterfaceVisitorCard Password string VerificationKey string Admin bool CreatedAt time.Time *attributes.ModelCustomAttributes // contains filtered or unexported fields }
DefaultVisitor is a default implementer of InterfaceVisitor
func (*DefaultVisitor) CheckPassword ¶
func (it *DefaultVisitor) CheckPassword(passwd string) bool
CheckPassword validates password for the current Visitor
func (*DefaultVisitor) Delete ¶
func (it *DefaultVisitor) Delete() error
Delete removes current Visitor from the database
func (*DefaultVisitor) FromHashMap ¶
func (it *DefaultVisitor) FromHashMap(input map[string]interface{}) error
FromHashMap fills Visitor object attributes from a map[string]interface{}
func (*DefaultVisitor) GenerateNewPassword ¶
func (it *DefaultVisitor) GenerateNewPassword() error
GenerateNewPassword generates new password for the current Visitor
func (*DefaultVisitor) Get ¶
func (it *DefaultVisitor) Get(attribute string) interface{}
Get returns object attribute value or nil for the requested Visitor attribute
func (*DefaultVisitor) GetAttributesInfo ¶
func (it *DefaultVisitor) GetAttributesInfo() []models.StructAttributeInfo
GetAttributesInfo returns the Visitor attributes information in an array
func (*DefaultVisitor) GetBillingAddress ¶
func (it *DefaultVisitor) GetBillingAddress() visitor.InterfaceVisitorAddress
GetBillingAddress returns the billing address for the Visitor
func (*DefaultVisitor) GetCollection ¶
func (it *DefaultVisitor) GetCollection() models.InterfaceCollection
GetCollection returns collection of current instance type
func (*DefaultVisitor) GetCreatedAt ¶
func (it *DefaultVisitor) GetCreatedAt() time.Time
GetCreatedAt returns the Visitor creation date
func (*DefaultVisitor) GetEmail ¶
func (it *DefaultVisitor) GetEmail() string
GetEmail returns the Visitor e-mail which also used as a login ID
func (*DefaultVisitor) GetFacebookID ¶
func (it *DefaultVisitor) GetFacebookID() string
GetFacebookID returns the Visitor's Facebook ID
func (*DefaultVisitor) GetFirstName ¶
func (it *DefaultVisitor) GetFirstName() string
GetFirstName returns the Visitor's first name
func (*DefaultVisitor) GetFullName ¶
func (it *DefaultVisitor) GetFullName() string
GetFullName returns visitor full name
func (*DefaultVisitor) GetGoogleID ¶
func (it *DefaultVisitor) GetGoogleID() string
GetGoogleID returns the Visitor's Google ID
func (*DefaultVisitor) GetID ¶
func (it *DefaultVisitor) GetID() string
GetID returns current ID of the Visitor
func (*DefaultVisitor) GetImplementationName ¶
func (it *DefaultVisitor) GetImplementationName() string
GetImplementationName returns model implementation name for the Visitor
func (*DefaultVisitor) GetLastName ¶
func (it *DefaultVisitor) GetLastName() string
GetLastName returns the Visitor's last name
func (*DefaultVisitor) GetModelName ¶
func (it *DefaultVisitor) GetModelName() string
GetModelName returns model name for the Visitor
func (*DefaultVisitor) GetShippingAddress ¶
func (it *DefaultVisitor) GetShippingAddress() visitor.InterfaceVisitorAddress
GetShippingAddress returns the shipping address for the Visitor
func (*DefaultVisitor) GetToken ¶
func (it *DefaultVisitor) GetToken() visitor.InterfaceVisitorCard
GetToken returns the default card for the Visitor
func (*DefaultVisitor) Invalidate ¶
func (it *DefaultVisitor) Invalidate() error
Invalidate marks a visitor e-mail address as not verified, then sends an e-mail to the Visitor with a new verification key
func (*DefaultVisitor) IsAdmin ¶
func (it *DefaultVisitor) IsAdmin() bool
IsAdmin returns true if the visitor is an Admin (have admin rights)
func (*DefaultVisitor) IsGuest ¶
func (it *DefaultVisitor) IsGuest() bool
IsGuest returns true if instance represents guest visitor
func (*DefaultVisitor) IsVerified ¶
func (it *DefaultVisitor) IsVerified() bool
IsVerified returns true if the Visitor's e-mail has been verified
func (*DefaultVisitor) Load ¶
func (it *DefaultVisitor) Load(ID string) error
Load will retrieve the Visitor information from database
func (*DefaultVisitor) LoadByEmail ¶
func (it *DefaultVisitor) LoadByEmail(email string) error
LoadByEmail loads the Visitor information from the database based on their email address, which must be unique
func (*DefaultVisitor) LoadByFacebookID ¶
func (it *DefaultVisitor) LoadByFacebookID(facebookID string) error
LoadByFacebookID loads the Visitor information from the database based on Facebook account ID
func (*DefaultVisitor) LoadByGoogleID ¶
func (it *DefaultVisitor) LoadByGoogleID(googleID string) error
LoadByGoogleID loads the Visitor information from the database based on Google account ID
func (*DefaultVisitor) New ¶
func (it *DefaultVisitor) New() (models.InterfaceModel, error)
New returns new instance of model implementation object for the Visitor
func (*DefaultVisitor) ResetPassword ¶
func (it *DefaultVisitor) ResetPassword() error
ResetPassword generates new password for the current Visitor
func (*DefaultVisitor) Save ¶
func (it *DefaultVisitor) Save() error
Save stores current Visitor to the database
func (*DefaultVisitor) Set ¶
func (it *DefaultVisitor) Set(attribute string, value interface{}) error
Set will set attribute value of the Visitor to object or return an error
func (*DefaultVisitor) SetBillingAddress ¶
func (it *DefaultVisitor) SetBillingAddress(address visitor.InterfaceVisitorAddress) error
SetBillingAddress updates the billing address for the Visitor
func (*DefaultVisitor) SetID ¶
func (it *DefaultVisitor) SetID(NewID string) error
SetID sets current ID of the current Visitor
func (*DefaultVisitor) SetPassword ¶
func (it *DefaultVisitor) SetPassword(passwd string) error
SetPassword updates the password for the current Visitor
func (*DefaultVisitor) SetShippingAddress ¶
func (it *DefaultVisitor) SetShippingAddress(address visitor.InterfaceVisitorAddress) error
SetShippingAddress updates the shipping address for the Visitor
func (*DefaultVisitor) SetToken ¶
func (it *DefaultVisitor) SetToken(token visitor.InterfaceVisitorCard) error
SetToken updates the default card for the Visitor
func (*DefaultVisitor) ToHashMap ¶
func (it *DefaultVisitor) ToHashMap() map[string]interface{}
ToHashMap represents Visitor object as map[string]interface{}
func (*DefaultVisitor) UpdateResetPassword ¶
func (it *DefaultVisitor) UpdateResetPassword(key string, passwd string) error
UpdateResetPassword takes a visitors verification key and checks it against the database, a new verification email is sent if the key cannot be validated
func (*DefaultVisitor) Validate ¶
func (it *DefaultVisitor) Validate(key string) error
Validate takes a visitors verification key and checks it against the database, a new verification email is sent if the key cannot be validated
type DefaultVisitorCollection ¶
type DefaultVisitorCollection struct {
// contains filtered or unexported fields
}
DefaultVisitorCollection is a default implementer of InterfaceVisitorCollection
func (*DefaultVisitorCollection) GetDBCollection ¶
func (it *DefaultVisitorCollection) GetDBCollection() db.InterfaceDBCollection
GetDBCollection returns database collection for the Visitor
func (*DefaultVisitorCollection) GetImplementationName ¶
func (it *DefaultVisitorCollection) GetImplementationName() string
GetImplementationName returns model implementation name for the Visitor Collection
func (*DefaultVisitorCollection) GetModelName ¶
func (it *DefaultVisitorCollection) GetModelName() string
GetModelName returns model name for the Visitor Collection
func (*DefaultVisitorCollection) List ¶
func (it *DefaultVisitorCollection) List() ([]models.StructListItem, error)
List enumerates items of Visitor model type in a Visitor collection
func (*DefaultVisitorCollection) ListAddExtraAttribute ¶
func (it *DefaultVisitorCollection) ListAddExtraAttribute(attribute string) error
ListAddExtraAttribute provides the ability to add additional attributes if the attribute does not already exist
func (*DefaultVisitorCollection) ListFilterAdd ¶
func (it *DefaultVisitorCollection) ListFilterAdd(Attribute string, Operator string, Value interface{}) error
ListFilterAdd provides the ability to add a selection filter to List() function
func (*DefaultVisitorCollection) ListFilterReset ¶
func (it *DefaultVisitorCollection) ListFilterReset() error
ListFilterReset clears the presets made by ListFilterAdd() and ListAddExtraAttribute() functions
func (*DefaultVisitorCollection) ListLimit ¶
func (it *DefaultVisitorCollection) ListLimit(offset int, limit int) error
ListLimit sets the pagination when provided offset and limit values
func (*DefaultVisitorCollection) ListVisitors ¶
func (it *DefaultVisitorCollection) ListVisitors() []visitor.InterfaceVisitor
ListVisitors returns list of visitor model items in the Visitor Collection
func (*DefaultVisitorCollection) New ¶
func (it *DefaultVisitorCollection) New() (models.InterfaceModel, error)
New returns new instance of model implementation object for the Visitor Collection
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package address is a default implementation of models/visitor package visitor address related interfaces
|
Package address is a default implementation of models/visitor package visitor address related interfaces |
Package token allows to create and use tokens
|
Package token allows to create and use tokens |