repository

package
v0.0.0-...-eaa30f2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2019 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 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:"-"`
	CreatedAt    time.Time `json:"-"`
}

type RuleRepo

type RuleRepo interface {
	Find(ctx context.Context, id int64) (*Rule, error)
	List(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
}

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, id int64) (rule *Rule, err error)

Find rule

func (*RuleRepoImpl) Insert

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

Insert rule

func (*RuleRepoImpl) List

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

List rule

func (*RuleRepoImpl) Update

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

Update rule

type URLStore

type URLStore interface {
	Add(id int, key string, data interface{}) int
	Get(path string, pvalues []string) (data interface{}, pnames []string)
	Delete(id int) bool
	String() string
	Count() int
}

func NewUrlStore

func NewUrlStore() URLStore

NewUrlStore creates a new store.

Jump to

Keyboard shortcuts

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