uranai

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: MIT Imports: 12 Imported by: 0

README

uranai-kafka

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEventHubSaramaConfig added in v1.0.0

func NewEventHubSaramaConfig(connString string) *sarama.Config

Types

type Batch

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

func NewBatch

func NewBatch(t *FortuneTeller, p Publisher) *Batch

func (*Batch) Run

func (b *Batch) Run(ctx context.Context) error

type Client

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

func NewClient

func NewClient(httpClient *http.Client, resourceName, deploymentName, apiVersion, accessToken string) *Client

func (*Client) Get

func (c *Client) Get(ctx context.Context, request *m.CompletionRequest) (*m.CompletionResponse, error)

type FortuneTeller

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

func NewFortuneTeller

func NewFortuneTeller(client *Client, temperature float32) *FortuneTeller

func (*FortuneTeller) Listen

func (t *FortuneTeller) Listen(ctx context.Context) (*ResultSet, error)

type Publisher

type Publisher interface {
	Publish(ctx context.Context, resultSet *ResultSet) error
}

type Result

type Result struct {
	Rank         int32     `json:"rank"`
	Name         string    `json:"name"`
	LuckyItem    string    `json:"lucky_item"`
	LuckyColor   string    `json:"lucky_color"`
	LuckyService string    `json:"lucky_service"`
	CareerLuck   int32     `json:"career_luck"`
	LoveLuck     int32     `json:"love_luck"`
	HealthLuck   int32     `json:"health_luck"`
	Description  string    `json:"description"`
	CreatedAt    time.Time `json:"created_at"`
}

type ResultSet

type ResultSet struct {
	Results []Result `json:"results"`
}

type SaramaPublisher added in v1.0.0

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

func NewSaramaPublisher added in v1.0.0

func NewSaramaPublisher(c sarama.SyncProducer, topicName string) *SaramaPublisher

func (SaramaPublisher) Publish added in v1.0.0

func (s SaramaPublisher) Publish(ctx context.Context, resultSet *ResultSet) error

Directories

Path Synopsis
app

Jump to

Keyboard shortcuts

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