statistics

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOmitReferencesContext added in v0.3.4

func NewOmitReferencesContext(ctx context.Context) context.Context

func OmitReferencesFromContext added in v0.3.4

func OmitReferencesFromContext(ctx context.Context) bool

Types

type ActionStatistics

type ActionStatistics struct {
	Count    int            `json:"count" bson:"count,minsize"`
	Users    map[string]int `json:"users,omitempty" bson:"users,omitempty,minsize"`
	Comments []string       `json:"comments,omitempty" bson:"comments,omitempty"`
	Assets   []string       `json:"assets,omitempty" bson:"assets,omitempty"`
	Sections []string       `json:"sections,omitempty" bson:"sections,omitempty"`
}

type ActionStatisticsAccumulator

type ActionStatisticsAccumulator struct {
	Counts, Comments, Assets, Users aggregate.Int
}

func NewActionStatisticsAccumulator

func NewActionStatisticsAccumulator() *ActionStatisticsAccumulator

func (*ActionStatisticsAccumulator) Accumulate

func (a *ActionStatisticsAccumulator) Accumulate(ctx context.Context, object interface{})

func (*ActionStatisticsAccumulator) ActionStatistics added in v0.3.4

func (a *ActionStatisticsAccumulator) ActionStatistics(ctx context.Context) *ActionStatistics

func (*ActionStatisticsAccumulator) Combine added in v0.3.4

func (a *ActionStatisticsAccumulator) Combine(object interface{})

type ActionTypes added in v0.3.4

type ActionTypes struct {
	All    *ActionStatistics            `json:"all,omitempty" bson:"all,omitempty"`
	Types  map[string]*ActionStatistics `json:"types" bson:",inline"`
	Ratios map[string]float64           `json:"ratios,omitempty" bson:"ratios,omitempty"`
}

type ActionTypesAccumulator added in v0.3.4

type ActionTypesAccumulator struct {
	All   *ActionStatisticsAccumulator
	Types map[string]*ActionStatisticsAccumulator
}

func NewActionTypesAccumulator added in v0.3.4

func NewActionTypesAccumulator() *ActionTypesAccumulator

func (*ActionTypesAccumulator) Accumulate added in v0.3.4

func (a *ActionTypesAccumulator) Accumulate(ctx context.Context, object interface{})

func (*ActionTypesAccumulator) ActionStatistics added in v0.3.4

func (a *ActionTypesAccumulator) ActionStatistics(ctx context.Context) *ActionTypes

func (*ActionTypesAccumulator) Combine added in v0.3.4

func (a *ActionTypesAccumulator) Combine(object interface{})

type CommentDimensions

type CommentDimensions struct {
	All   *CommentTypes                       `json:"all,omitempty" bson:"all,omitempty"`
	Types map[string]map[string]*CommentTypes `json:"types,omitempty" bson:",inline"`
}

type CommentDimensionsAccumulator

type CommentDimensionsAccumulator struct {
	All   *CommentTypesAccumulator
	Types map[string]map[string]*CommentTypesAccumulator
}

func NewCommentDimensionsAccumulator

func NewCommentDimensionsAccumulator() *CommentDimensionsAccumulator

func (*CommentDimensionsAccumulator) Accumulate

func (a *CommentDimensionsAccumulator) Accumulate(ctx context.Context, object interface{})

func (*CommentDimensionsAccumulator) Combine

func (a *CommentDimensionsAccumulator) Combine(object interface{})

func (*CommentDimensionsAccumulator) CommentDimensions

type CommentStatistics

type CommentStatistics struct {
	Count int `json:"count" bson:"count,minsize"`

	// Replied concerns the comments of this group.
	RepliedCount      int      `json:"replied_count" bson:"replied_count,minsize"`
	RepliedToComments []string `json:"replied_comments,omitempty" bson:"replied_comments,omitempty"`
	RepliedToUsers    []string `json:"replied_users,omitempty" bson:"replied_users,omitempty"`
	RepliedRatio      float64  `json:"replied_ratio" bson:"replied_ratio"`

	// Reply concerns replies to the comments of this group.
	ReplyCount    int      `json:"reply_count" bson:"reply_count,minsize"`
	ReplyComments []string `json:"reply_comments,omitempty" bson:"reply_comments,omitempty"`
	ReplyUsers    []string `json:"reply_users,omitempty" bson:"reply_users,omitempty"`
	ReplyRatio    float64  `json:"reply_ratio" bson:"reply_ratio"`

	// First and last comments.
	First time.Time `json:"first,omitempty" bson:"first,omitempty"`
	Last  time.Time `json:"last,omitempty" bson:"last,omitempty"`

	// Text analysis.
	WordCountAverage float64 `json:"word_count_average" bson:"word_count_average"`
}

type CommentStatisticsAccumulator

type CommentStatisticsAccumulator struct {
	Counts, RepliedComments, RepliedUsers, ReplyComments, ReplyUsers aggregate.Int
	First                                                            *aggregate.Oldest
	Last                                                             *aggregate.Newest
}

func NewCommentStatisticsAccumulator

func NewCommentStatisticsAccumulator() *CommentStatisticsAccumulator

func (*CommentStatisticsAccumulator) Accumulate

func (a *CommentStatisticsAccumulator) Accumulate(ctx context.Context, object interface{})

func (*CommentStatisticsAccumulator) Combine

func (a *CommentStatisticsAccumulator) Combine(object interface{})

func (*CommentStatisticsAccumulator) CommentStatistics

type CommentTypes

type CommentTypes struct {
	All    *CommentStatistics            `json:"all,omitempty" bson:"all,omitempty"`
	Types  map[string]*CommentStatistics `json:"types,omitempty" bson:",inline"`
	Ratios map[string]float64            `json:"ratios,omitempty" bson:"ratios,omitempty"`
}

type CommentTypesAccumulator

type CommentTypesAccumulator struct {
	All   *CommentStatisticsAccumulator
	Types map[string]*CommentStatisticsAccumulator
}

func NewCommentTypesAccumulator

func NewCommentTypesAccumulator() *CommentTypesAccumulator

func (*CommentTypesAccumulator) Accumulate

func (a *CommentTypesAccumulator) Accumulate(ctx context.Context, object interface{})

func (*CommentTypesAccumulator) Combine

func (a *CommentTypesAccumulator) Combine(object interface{})

func (*CommentTypesAccumulator) CommentTypes

func (a *CommentTypesAccumulator) CommentTypes(ctx context.Context) *CommentTypes

type ReceivedActionStatisticsAccumulator added in v0.3.4

type ReceivedActionStatisticsAccumulator struct {
	*ActionStatisticsAccumulator
}

func NewReceivedActionStatisticsAccumulator added in v0.3.4

func NewReceivedActionStatisticsAccumulator() *ReceivedActionStatisticsAccumulator

func (*ReceivedActionStatisticsAccumulator) Accumulate added in v0.3.4

func (a *ReceivedActionStatisticsAccumulator) Accumulate(ctx context.Context, object interface{})

func (*ReceivedActionStatisticsAccumulator) Combine added in v0.3.4

func (a *ReceivedActionStatisticsAccumulator) Combine(object interface{})

type ReceivedActionTypesAccumulator added in v0.3.4

type ReceivedActionTypesAccumulator struct {
	All   *ReceivedActionStatisticsAccumulator
	Types map[string]*ReceivedActionStatisticsAccumulator
}

func NewReceivedActionTypesAccumulator added in v0.3.4

func NewReceivedActionTypesAccumulator() *ReceivedActionTypesAccumulator

func (*ReceivedActionTypesAccumulator) Accumulate added in v0.3.4

func (a *ReceivedActionTypesAccumulator) Accumulate(ctx context.Context, object interface{})

func (*ReceivedActionTypesAccumulator) ActionStatistics added in v0.3.4

func (a *ReceivedActionTypesAccumulator) ActionStatistics(ctx context.Context) *ActionTypes

func (*ReceivedActionTypesAccumulator) Combine added in v0.3.4

func (a *ReceivedActionTypesAccumulator) Combine(object interface{})

type User

type User struct {
	model.User `bson:",inline"`
	Statistics *UserStatistics `json:"statistics,omitempty" bson:"statistics,omitempty"`
	Reference  *UserStatistics `json:"reference,omitempty" bson:"reference,omitempty"`
}

type UserAccumulator

type UserAccumulator struct {
	DimensionAccumulator map[string]aggregate.Int
}

func NewUserAccumulator

func NewUserAccumulator() *UserAccumulator

Returns the aggregation map for the different variables

func (*UserAccumulator) Accumulate

func (a *UserAccumulator) Accumulate(ctx context.Context, object interface{})

Acumulates aggregate the values on the different dimensions for object (in this case a user)

func (*UserAccumulator) Combine

func (a *UserAccumulator) Combine(object interface{})

func (*UserAccumulator) Dimensions added in v0.3.4

func (a *UserAccumulator) Dimensions() []*model.Dimension

Dimensions bring all the dimmensions for the user

type UserActions

type UserActions struct {
	Performed *ActionTypes `json:"performed" bson:"performed"`
	Received  *ActionTypes `json:"received" bson:"received"`
}

Actions performed BY the user or ON the user

type UserActionsAccumulator added in v0.3.4

type UserActionsAccumulator struct {
	Performed *ActionTypesAccumulator
	Received  *ReceivedActionTypesAccumulator
}

func NewUserActionsAccumulator added in v0.3.4

func NewUserActionsAccumulator() *UserActionsAccumulator

func (*UserActionsAccumulator) Accumulate added in v0.3.4

func (a *UserActionsAccumulator) Accumulate(ctx context.Context, object interface{})

func (*UserActionsAccumulator) Combine added in v0.3.4

func (a *UserActionsAccumulator) Combine(object interface{})

func (*UserActionsAccumulator) UserActions added in v0.3.4

func (a *UserActionsAccumulator) UserActions(ctx context.Context) *UserActions

type UserStatistics

type UserStatistics struct {
	Actions  *UserActions       `json:"actions" bson:"actions"`
	Comments *CommentDimensions `json:"comments" bson:"comments"`
}

type UserStatisticsAccumulator

type UserStatisticsAccumulator struct {
	Comments     *CommentDimensionsAccumulator
	Actions      *UserActionsAccumulator
	CommentIDMap map[interface{}]struct{}
}

func NewUserStatisticsAccumulator

func NewUserStatisticsAccumulator() *UserStatisticsAccumulator

func (*UserStatisticsAccumulator) Accumulate

func (a *UserStatisticsAccumulator) Accumulate(ctx context.Context, object interface{})

func (*UserStatisticsAccumulator) Combine

func (a *UserStatisticsAccumulator) Combine(object interface{})

func (*UserStatisticsAccumulator) CommentIDs added in v0.3.4

func (a *UserStatisticsAccumulator) CommentIDs(ctx context.Context) []interface{}

func (*UserStatisticsAccumulator) UserStatistics

func (a *UserStatisticsAccumulator) UserStatistics(ctx context.Context) *UserStatistics

Jump to

Keyboard shortcuts

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