Documentation ¶
Index ¶
- Variables
- type Action
- type AddEventRequest
- type AddEventResponse
- type AppConfig
- type Category
- type Controller
- type ErrorResponse
- type Event
- type IStorageDB
- type Interactor
- type StoragePostgres
- func (storage *StoragePostgres) AddAction(action *Action) error
- func (storage *StoragePostgres) AddCategory(category *Category) error
- func (storage *StoragePostgres) AddEvent(event *Event) error
- func (storage *StoragePostgres) GetActionByName(name string) (exists bool, action *Action, err error)
- func (storage *StoragePostgres) GetCategoryByName(name string) (exists bool, category *Category, err error)
- func (storage *StoragePostgres) UpsertCategoryActionAssociation(category *Category, action *Action) error
- type Tracking
- type TrackingConfig
- type TrackingOption
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrorNotFound = errors.New(errors.ErrorLevel, int(web.StatusNotFound), "not found")
)
Functions ¶
This section is empty.
Types ¶
type AddEventRequest ¶
type AddEventRequest struct { Category *string `json:"category" validate:"notzero"` Action *string `json:"action" validate:"notzero"` Label *string `json:"label"` Value *int64 `json:"value"` Viewer *string `json:"viewer"` Viewed *string `json:"viewed"` Latitude *float64 `json:"latitude"` Longitude *float64 `json:"longitude"` Street *string `json:"street"` MetaData *json.RawMessage `json:"meta_data"` }
type AddEventResponse ¶
type AddEventResponse struct {
Success bool `json:"success"`
}
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(config *TrackingConfig, interactor *Interactor) *Controller
func (*Controller) AddEventHandler ¶
func (c *Controller) AddEventHandler(ctx *web.Context) error
func (*Controller) RegisterRoutes ¶
func (c *Controller) RegisterRoutes(web manager.IWeb) error
type ErrorResponse ¶
type Event ¶
type Event struct { IdEvent string `json:"id_event" db:"id_event"` Category string `json:"category" db:"-" validate:"notzero"` FkCategory string `json:"-" db:"fk_category"` Action string `json:"action" db:"-" validate:"notzero"` FkAction string `json:"-" db:"fk_action"` Label *string `json:"label" db:"label"` Value *int64 `json:"value" db:"value"` Viewer *string `json:"viewer" db:"viewer"` Viewed *string `json:"viewed" db:"viewed"` Latitude *float64 `json:"latitude" db:"latitude"` Longitude *float64 `json:"longitude" db:"longitude"` Country *string `json:"country" db:"country"` City *string `json:"city" db:"city"` Street *string `json:"street" db:"street"` MetaData *string `json:"meta_data" db:"meta_data"` CreatedAt time.Time `json:"created_at" db.read:"created_at" db.write:"-"` }
type IStorageDB ¶
type Interactor ¶
type Interactor struct {
// contains filtered or unexported fields
}
func NewInteractor ¶
func NewInteractor(service *Tracking, storageDB IStorageDB, geoLocation *geolocation.GeoLocation) *Interactor
func (*Interactor) AddEvent ¶
func (i *Interactor) AddEvent(event *Event) (*AddEventResponse, error)
type StoragePostgres ¶
type StoragePostgres struct {
// contains filtered or unexported fields
}
func NewStoragePostgres ¶
func NewStoragePostgres(config *TrackingConfig) (*StoragePostgres, error)
func (*StoragePostgres) AddAction ¶
func (storage *StoragePostgres) AddAction(action *Action) error
func (*StoragePostgres) AddCategory ¶
func (storage *StoragePostgres) AddCategory(category *Category) error
func (*StoragePostgres) AddEvent ¶
func (storage *StoragePostgres) AddEvent(event *Event) error
func (*StoragePostgres) GetActionByName ¶
func (storage *StoragePostgres) GetActionByName(name string) (exists bool, action *Action, err error)
func (*StoragePostgres) GetCategoryByName ¶
func (storage *StoragePostgres) GetCategoryByName(name string) (exists bool, category *Category, err error)
func (*StoragePostgres) UpsertCategoryActionAssociation ¶
func (storage *StoragePostgres) UpsertCategoryActionAssociation(category *Category, action *Action) error
type Tracking ¶
type Tracking struct {
// contains filtered or unexported fields
}
func (*Tracking) Reconfigure ¶
func (t *Tracking) Reconfigure(options ...TrackingOption)
Reconfigure ...
type TrackingConfig ¶
type TrackingConfig struct { Host string `json:"host"` Dbr *dbr.DbrConfig `json:"dbr"` TokenKey string `json:"token_key"` ExpirationMinutes int64 `json:"expiration_minutes"` Migration *migration.MigrationConfig `json:"migration"` GeoLocation *geolocation.GeoLocationConfig `json:"geo-location"` Log struct { Level string `json:"level"` } `json:"log"` }
TrackingConfig ...
type TrackingOption ¶
type TrackingOption func(t *Tracking)
TrackingOption ...
func WithConfiguration ¶
func WithConfiguration(config *TrackingConfig) TrackingOption
WithConfiguration ...
Source Files ¶
Click to show internal directories.
Click to hide internal directories.