repository

package
v0.0.0-...-3af2098 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedDataSourceRepoImpl

type CachedDataSourceRepoImpl struct {
	dig.In
	DataSourceRepoImpl
	Redis *redis.Client
}

CachedDataSourceRepoImpl is cached implementation of data_source repository

func (*CachedDataSourceRepoImpl) Find

func (r *CachedDataSourceRepoImpl) Find(ctx context.Context) (list []*DataSource, err error)

Find of data_source entity

func (*CachedDataSourceRepoImpl) FindOne

func (r *CachedDataSourceRepoImpl) FindOne(ctx context.Context, id int64) (e *DataSource, err error)

FindOne data_source entity

type CachedLocaleRepoImpl

type CachedLocaleRepoImpl struct {
	dig.In
	LocaleRepoImpl
	Redis *redis.Client
}

CachedLocaleRepoImpl is cached implementation of locale repository

func (*CachedLocaleRepoImpl) Find

func (r *CachedLocaleRepoImpl) Find(ctx context.Context) (list []*Locale, err error)

Find of locale entity

func (*CachedLocaleRepoImpl) FindOne

func (r *CachedLocaleRepoImpl) FindOne(ctx context.Context, id int64) (e *Locale, err error)

FindOne locale entity

type CachedMetricsUnmatchedRepoImpl

type CachedMetricsUnmatchedRepoImpl struct {
	dig.In
	MetricsUnmatchedRepoImpl
	Redis *redis.Client
}

CachedMetricsUnmatchedRepoImpl is cached implementation of metrics_unmatched repository

func (*CachedMetricsUnmatchedRepoImpl) Find

Find metrics_unmatched entity

func (*CachedMetricsUnmatchedRepoImpl) List

List of metrics_unmatched entity

type CachedTagRepoImpl

type CachedTagRepoImpl struct {
	dig.In
	TagRepoImpl
	Redis *redis.Client
}

CachedTagRepoImpl is cached implementation of tag repository

func (*CachedTagRepoImpl) Find

func (r *CachedTagRepoImpl) Find(ctx context.Context) (list []*Tag, err error)

Find tags

func (*CachedTagRepoImpl) FindOne

func (r *CachedTagRepoImpl) FindOne(ctx context.Context, id int64) (e *Tag, err error)

FindOne tag

type DataSource

type DataSource struct {
	ID        int64     `json:"id"`
	Name      string    `json:"name"`
	Url       string    `json:"url"`
	UpdatedAt time.Time `json:"updated_at"`
	CreatedAt time.Time `json:"created_at"`
}

DataSource represented data_source entity

type DataSourceRepo

type DataSourceRepo interface {
	FindOne(context.Context, int64) (*DataSource, error)
	Find(context.Context) ([]*DataSource, error)
	Insert(context.Context, DataSource) (lastInsertID int64, err error)
	Delete(context.Context, int64) error
	Update(context.Context, DataSource) error
}

DataSourceRepo to handle data_sources entity

func NewDataSourceRepo

func NewDataSourceRepo(impl CachedDataSourceRepoImpl) DataSourceRepo

NewDataSourceRepo return new instance of DataSourceRepo

type DataSourceRepoImpl

type DataSourceRepoImpl struct {
	dig.In
	*sql.DB
}

DataSourceRepoImpl is implementation data_source repository

func (*DataSourceRepoImpl) Delete

func (r *DataSourceRepoImpl) Delete(ctx context.Context, id int64) (err error)

Delete data_source

func (*DataSourceRepoImpl) Find

func (r *DataSourceRepoImpl) Find(ctx context.Context) (list []*DataSource, err error)

Find data_source

func (*DataSourceRepoImpl) FindOne

func (r *DataSourceRepoImpl) FindOne(ctx context.Context, id int64) (e *DataSource, err error)

FindOne data_source

func (*DataSourceRepoImpl) Insert

func (r *DataSourceRepoImpl) Insert(ctx context.Context, e DataSource) (lastInsertID int64, err error)

Insert data_source

func (*DataSourceRepoImpl) Update

func (r *DataSourceRepoImpl) Update(ctx context.Context, e DataSource) (err error)

Update data_source

type Locale

type Locale struct {
	ID          int64     `json:"id"`
	LangCode    string    `json:"lang_code"`
	CountryCode string    `json:"country_code"`
	UpdatedAt   time.Time `json:"updated_at"`
	CreatedAt   time.Time `json:"created_at"`
}

Locale represented locale entity

type LocaleRepo

type LocaleRepo interface {
	FindOne(context.Context, int64) (*Locale, error)
	Find(context.Context) ([]*Locale, error)
	Insert(context.Context, Locale) (lastInsertID int64, err error)
	Delete(context.Context, int64) error
	Update(context.Context, Locale) error
}

LocaleRepo to handle locales entity

func NewLocaleRepo

func NewLocaleRepo(impl CachedLocaleRepoImpl) LocaleRepo

NewLocaleRepo return new instance of LocaleRepo

type LocaleRepoImpl

type LocaleRepoImpl struct {
	dig.In
	*sql.DB
}

LocaleRepoImpl is implementation locale repository

func (*LocaleRepoImpl) Delete

func (r *LocaleRepoImpl) Delete(ctx context.Context, id int64) (err error)

Delete locale

func (*LocaleRepoImpl) Find

func (r *LocaleRepoImpl) Find(ctx context.Context) (list []*Locale, err error)

Find locale

func (*LocaleRepoImpl) FindOne

func (r *LocaleRepoImpl) FindOne(ctx context.Context, id int64) (e *Locale, err error)

FindOne locale

func (*LocaleRepoImpl) Insert

func (r *LocaleRepoImpl) Insert(ctx context.Context, e Locale) (lastInsertID int64, err error)

Insert locale

func (*LocaleRepoImpl) Update

func (r *LocaleRepoImpl) Update(ctx context.Context, e Locale) (err error)

Update locale

type MetricsUnmatched

type MetricsUnmatched struct {
	ID          int64     `json:"id"`
	RequestPath string    `json:"request_path"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

MetricsUnmatched represented metrics_unmatched entity

type MetricsUnmatchedCount

type MetricsUnmatchedCount struct {
	RequestPath string    `json:"request_path"`
	Count       int64     `json:"count"`
	Since       time.Time `json:"since"`
}

MetricsUnmatchedCount represented metrics_unmatched entity

type MetricsUnmatchedRepo

type MetricsUnmatchedRepo interface {
	Find(context.Context, int64) (*MetricsUnmatched, error)
	List(context.Context) ([]*MetricsUnmatched, error)
	ListCount(context.Context) ([]*MetricsUnmatchedCount, error)
	Insert(context.Context, MetricsUnmatched) (lastInsertID int64, err error)
	Delete(context.Context, int64) error
	Update(context.Context, MetricsUnmatched) error
}

MetricsUnmatchedRepo to handle metrics_unmatched entity

func NewMetricsUnmatchedRepo

func NewMetricsUnmatchedRepo(impl CachedMetricsUnmatchedRepoImpl) MetricsUnmatchedRepo

NewMetricsUnmatchedRepo return new instance of MetricsUnmatchedRepo

type MetricsUnmatchedRepoImpl

type MetricsUnmatchedRepoImpl struct {
	dig.In
	*sql.DB
}

MetricsUnmatchedRepoImpl is implementation metrics_unmatched repository

func (*MetricsUnmatchedRepoImpl) Delete

func (r *MetricsUnmatchedRepoImpl) Delete(ctx context.Context, id int64) (err error)

Delete metrics_unmatched

func (*MetricsUnmatchedRepoImpl) Find

Find metrics_unmatched

func (*MetricsUnmatchedRepoImpl) Insert

func (r *MetricsUnmatchedRepoImpl) Insert(ctx context.Context, e MetricsUnmatched) (lastInsertID int64, err error)

Insert metrics_unmatched

func (*MetricsUnmatchedRepoImpl) List

func (r *MetricsUnmatchedRepoImpl) List(ctx context.Context) (list []*MetricsUnmatched, err error)

List metrics_unmatched

func (*MetricsUnmatchedRepoImpl) ListCount

func (r *MetricsUnmatchedRepoImpl) ListCount(ctx context.Context) (list []*MetricsUnmatchedCount, err error)

func (*MetricsUnmatchedRepoImpl) Update

Update metrics_unmatched

type Rule

type Rule struct {
	ID           int64     `json:"id"`
	Name         string    `json:"name" validate:"required"`
	UrlPattern   string    `json:"url_pattern" validate:"required"`
	DataSourceID *int64    `json:"data_source_id"`
	UpdatedAt    time.Time `json:"updated_at"`
	CreatedAt    time.Time `json:"created_at"`
}

Rule Entity

type RuleRepo

type RuleRepo interface {
	FindOne(ctx context.Context, id int64) (*Rule, error)
	Find(ctx context.Context) ([]*Rule, error)
	Insert(ctx context.Context, rule Rule) (lastInsertID int64, err error)
	Delete(ctx context.Context, id int64) error
	Update(ctx context.Context, rule Rule) error
}

RuleRepo is rule repository

func NewRuleRepo

func NewRuleRepo(impl RuleRepoImpl) RuleRepo

NewRuleRepo return new instance of RuleRepo

type RuleRepoImpl

type RuleRepoImpl struct {
	dig.In
	*sql.DB
}

RuleRepoImpl is implementation rule repository

func (*RuleRepoImpl) Delete

func (r *RuleRepoImpl) Delete(ctx context.Context, id int64) (err error)

Delete rule

func (*RuleRepoImpl) Find

func (r *RuleRepoImpl) Find(ctx context.Context) (list []*Rule, err error)

Find rule

func (*RuleRepoImpl) FindOne

func (r *RuleRepoImpl) FindOne(ctx context.Context, id int64) (rule *Rule, err error)

FindOne rule

func (*RuleRepoImpl) Insert

func (r *RuleRepoImpl) Insert(ctx context.Context, rule Rule) (lastInsertID int64, err error)

Insert rule

func (*RuleRepoImpl) Update

func (r *RuleRepoImpl) Update(ctx context.Context, rule Rule) (err error)

Update rule

type Tag

type Tag struct {
	ID         int64      `json:"id"`
	RuleID     int64      `json:"rule_id"`
	LocaleID   int64      `json:"locale_id"`
	Type       string     `json:"type"`
	Attributes dbkit.JSON `json:"attributes"`
	Value      string     `json:"value"`
	UpdatedAt  time.Time  `json:"updated_at"`
	CreatedAt  time.Time  `json:"created_at"`
}

Tag represented tag entity

type TagRepo

type TagRepo interface {
	FindOne(context.Context, int64) (*Tag, error)
	Find(context.Context) ([]*Tag, error)
	FindByRuleAndLocale(ctx context.Context, ruleID, localeID int64) ([]*Tag, error)
	Insert(context.Context, Tag) (lastInsertID int64, err error)
	Delete(context.Context, int64) error
	Update(context.Context, Tag) error
}

TagRepo to handle tags entity

func NewTagRepo

func NewTagRepo(impl CachedTagRepoImpl) TagRepo

NewTagRepo return new instance of TagRepo

type TagRepoImpl

type TagRepoImpl struct {
	dig.In
	*sql.DB
}

TagRepoImpl is implementation tag repository

func (*TagRepoImpl) Delete

func (r *TagRepoImpl) Delete(ctx context.Context, id int64) (err error)

Delete tag

func (*TagRepoImpl) Find

func (r *TagRepoImpl) Find(ctx context.Context) (list []*Tag, err error)

Find tags

func (*TagRepoImpl) FindByRuleAndLocale

func (r *TagRepoImpl) FindByRuleAndLocale(ctx context.Context, ruleID, localeID int64) (list []*Tag, err error)

FindByRuleAndLocale to return list of tags based on rule and locale

func (*TagRepoImpl) FindOne

func (r *TagRepoImpl) FindOne(ctx context.Context, id int64) (e *Tag, err error)

FindOne tag

func (*TagRepoImpl) Insert

func (r *TagRepoImpl) Insert(ctx context.Context, e Tag) (lastInsertID int64, err error)

Insert tag

func (*TagRepoImpl) Update

func (r *TagRepoImpl) Update(ctx context.Context, e Tag) (err error)

Update tag

type Transactional

type Transactional struct {
	dig.In
	*sql.DB
}

Transactional database

func (*Transactional) CancelMe

func (t *Transactional) CancelMe(ctx context.Context, err error) error

CancelMe is store error to context to trigger the rollback mechanism

func (*Transactional) CommitMe

func (t *Transactional) CommitMe(ctx *context.Context) func() error

CommitMe to create begin transaction and return commit function to be deffered

Jump to

Keyboard shortcuts

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