article

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: 5 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.Article) error
	Find(context.Context, map[string]interface{}) (*domain.Article, error)
	FindAll(context.Context, map[string]interface{}) ([]*domain.Article, 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, article domain.Article) error

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

func (RepositoryInstance) Find

func (r RepositoryInstance) Find(ctx context.Context, query map[string]interface{}) (*domain.Article, error)

func (RepositoryInstance) FindAll

func (r RepositoryInstance) FindAll(ctx context.Context, filter map[string]interface{}) ([]*domain.Article, error)

type Service

type Service interface {
	Create(context.Context, domain.Article) (*domain.Article, error)
}

type ServiceInstance

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

func NewService

func NewService(repo Repository) ServiceInstance

func (ServiceInstance) Create

func (s ServiceInstance) Create(ctx context.Context, article domain.Article) (*domain.Article, error)

Directories

Path Synopsis
handler

Jump to

Keyboard shortcuts

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