viewer

package
v0.0.0-...-2b7dfc1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 License: Unlicense Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository interface {
	Create(context.Context, domain.Viewer) error
	FindAll(context.Context, *provider.Query) ([]*domain.Viewer, error)
}

TODO: For demo only and more interface in the future

type RepositoryInstance

type RepositoryInstance struct {
	TableName string
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(db *gorm.DB) *RepositoryInstance

func (RepositoryInstance) Create

func (r RepositoryInstance) Create(ctx context.Context, viewer domain.Viewer) error

TODO: Add instrumentation to monitor performance (Newrelic, StatsD)

func (RepositoryInstance) FindAll

func (r RepositoryInstance) FindAll(ctx context.Context, filter *provider.Query) ([]*domain.Viewer, error)

type Service

type Service interface {
	Statistic(context.Context, *provider.Query) (*cookbook.JSON, error)
}

type ServiceInstance

type ServiceInstance struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(repo Repository) ServiceInstance

func (ServiceInstance) Statistic

func (s ServiceInstance) Statistic(ctx context.Context, query *provider.Query) (*cookbook.JSON, error)

Get counter article viewer max 5 days ago depend on business rules Count result by 5 minutes age, 1 hour ago, 1, 2, 3 days ago depend on business rules TODO: Improve the code for better implementation, in code or sql query

Directories

Path Synopsis
handler

Jump to

Keyboard shortcuts

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