scraphook

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth added in v0.0.6

type Auth struct {
	Config *utils.Config
	Logger *zap.SugaredLogger
}

func (*Auth) Enforce added in v0.0.6

func (auth *Auth) Enforce(sub, obj, act string) bool

func (*Auth) Start added in v0.0.6

func (auth *Auth) Start()

type AuthFake added in v0.0.6

type AuthFake struct {
	Config *utils.Config
	Logger *zap.SugaredLogger
}

func (*AuthFake) Enforce added in v0.0.6

func (auth *AuthFake) Enforce(sub, obj, act string) bool

func (*AuthFake) Start added in v0.0.6

func (auth *AuthFake) Start()

type Broker

type Broker struct {
	Config  *utils.Config
	Logger  *zap.SugaredLogger
	Started bool

	Conn    *amqp.Connection
	Channel *amqp.Channel
}

func (*Broker) Broadcast

func (broker *Broker) Broadcast(message *models.ScraphookMessages) error

func (*Broker) Consume

func (broker *Broker) Consume(handler func(id string, body []byte) error)

func (*Broker) Start

func (broker *Broker) Start()

type BrokerFake

type BrokerFake struct {
}

func (*BrokerFake) Broadcast

func (broker *BrokerFake) Broadcast(message *models.ScraphookMessages) error

func (*BrokerFake) Consume

func (broker *BrokerFake) Consume(handler func(id string, body []byte) error)

func (*BrokerFake) Start

func (broker *BrokerFake) Start()

type Cache

type Cache struct {
	Config *utils.Config
	Logger *zap.SugaredLogger

	Client *goredislib.Client
}

func (*Cache) Exist

func (cache *Cache) Exist(keys ...string) bool

func (*Cache) Get

func (cache *Cache) Get(key string) (string, error)

func (*Cache) Set

func (cache *Cache) Set(key string, value string, expiry time.Duration) error

func (*Cache) Start

func (cache *Cache) Start()

type CacheFake

type CacheFake struct {
	Config utils.Config
	Client *gocache.Cache
}

func (*CacheFake) Exist

func (cache *CacheFake) Exist(keys ...string) bool

func (*CacheFake) Get

func (cache *CacheFake) Get(key string) (string, error)

func (*CacheFake) Set

func (cache *CacheFake) Set(key string, value string, expiry time.Duration) error

func (*CacheFake) Start

func (cache *CacheFake) Start()

type IAuth added in v0.0.6

type IAuth interface {
	Start()
	Enforce(sub, obj, act string) bool
}

type IBroker

type IBroker interface {
	Start()
	Broadcast(message *models.ScraphookMessages) error
	Consume(handler func(id string, body []byte) error)
}

type ICache

type ICache interface {
	Start()
	Get(key string) (string, error)
	Set(key string, value string, expiry time.Duration) error
	Exist(keys ...string) bool
}

type Map

type Map map[string]interface{}

type Paging added in v0.0.6

type Paging struct {
	Before *time.Time
	After  *time.Time
	Limit  int
}

type Tester

type Tester struct {
	Config     *utils.Config
	DBMaster   *gorm.DB
	DBReplicas *gorm.DB
	Broker     IBroker
	Cache      ICache
	Auth       IAuth
}

func (*Tester) Req

func (tester *Tester) Req(req *http.Request) (*XContext, *httptest.ResponseRecorder)

func (*Tester) WithAuth added in v0.0.6

func (tester *Tester) WithAuth()

func (*Tester) WithBroker

func (tester *Tester) WithBroker()

func (*Tester) WithCache

func (tester *Tester) WithCache()

func (*Tester) WithConfig

func (tester *Tester) WithConfig()

func (*Tester) WithDb

func (tester *Tester) WithDb()

type XContext

type XContext struct {
	echo.Context

	Paging *Paging

	Config     *utils.Config
	SLogger    *zap.SugaredLogger
	DBMaster   *gorm.DB
	DBReplicas *gorm.DB
	Broker     IBroker
	Cache      ICache
	Auth       IAuth

	Meta Map
}

func NewTester

func NewTester(method, target string, body []byte) (*XContext, *httptest.ResponseRecorder)

Jump to

Keyboard shortcuts

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