client

package
v3.9.9 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JSONSchema string

Functions

func MockTestHelper

func MockTestHelper(t *testing.T, table *schema.Table, builder func(*testing.T, *gomock.Controller) services.HackernewsClient, opts TestOptions)

func New

func New(logger zerolog.Logger, spec Spec, hnClient *hackernews.Client, backend state.Client) (schema.ClientMeta, error)

func UnixTimeResolver

func UnixTimeResolver(fieldName string) schema.ColumnResolver

Types

type Backend

type Backend struct {
	Table      string `json:"table"`
	Connection string `json:"connection"`
}

type Client

type Client struct {
	Spec       Spec
	HackerNews services.HackernewsClient
	Backend    state.Client
	// contains filtered or unexported fields
}

func (*Client) ID

func (*Client) ID() string

func (*Client) Logger

func (c *Client) Logger() *zerolog.Logger

func (*Client) RetryOnError

func (c *Client) RetryOnError(ctx context.Context, tableName string, f func() error) error

RetryOnError will run the given resolver function and retry on rate limit exceeded errors or other retryable errors (like internal server errors) after waiting some amount of time.

type NopBackend

type NopBackend struct{}

func (*NopBackend) Close

func (*NopBackend) Close(ctx context.Context) error

func (*NopBackend) Get

func (*NopBackend) Get(ctx context.Context, table, clientID string) (string, error)

func (*NopBackend) Set

func (*NopBackend) Set(ctx context.Context, table, clientID, value string) error

type Spec

type Spec struct {
	// The number of items to fetch concurrently
	ItemConcurrency int `json:"item_concurrency" jsonschema:"minimum=1,maximum=1000,default=100"`
	// RFC3339 formatted timestamp. Syncing will begin with posts after this date.
	// Relative values like "3 days ago" are also supported.
	// If not specified, the plugin will default to 24 hours ago.
	StartTime configtype.Time `json:"start_time" jsonschema:"format=date-time"`
}

func (*Spec) SetDefaults

func (s *Spec) SetDefaults()

func (*Spec) Validate

func (s *Spec) Validate() error

type TestOptions

type TestOptions struct {
	StartTime time.Time
	Backend   state.Client
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
spec
gen command

Jump to

Keyboard shortcuts

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