storage

package
v0.0.0-...-b6a3ff4 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

func Init

func Init(cfg config.StorageConfig) (*Handler, error)

func (*Handler) Create

func (h *Handler) Create(ctx context.Context, p proxy.Proxy) (*Proxy, bool, error)

func (*Handler) GetProxies

func (h *Handler) GetProxies(ctx context.Context, opts *QueryOptions) ([]*Proxy, error)

func (*Handler) GetProxiesCount

func (h *Handler) GetProxiesCount(ctx context.Context) (int64, error)

func (*Handler) Remove

func (h *Handler) Remove(ctx context.Context, id uint) error

func (*Handler) Update

func (h *Handler) Update(ctx context.Context, id uint, m map[string]any) error

type Proxy

type Proxy struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	*proxy.Base
	Config string
}

func NewProxy

func NewProxy(p proxy.Proxy) (*Proxy, error)

type QueryOptions

type QueryOptions struct {
	ID               uint
	EmptyCountryCode bool
	CountryCodes     string
	NotCountryCodes  string
	Count            int
	Fast             bool
}

type Result

type Result struct {
	Proxy *Proxy
	Error error
}

Jump to

Keyboard shortcuts

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