integration

package
v0.0.0-...-7ea75fa Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DBinstance *mongo.Database

Functions

func NewHttpClient

func NewHttpClient[T any]() client[T]

func NewHttpClientWithTimeout

func NewHttpClientWithTimeout[T any](timeout time.Duration) client[T]

Types

type Async

type Async interface {
	Execute(Request)
}

func NewAsyncHttpClient

func NewAsyncHttpClient(collection *mongo.Collection, try Try) Async

type Client

type Client[T any] interface {
	Send(Request) (*Response[T], error)
}

type DBDataConnection

type DBDataConnection struct {
	Host     string
	Port     string
	DBName   string
	User     string
	Password string
}

func (DBDataConnection) Connect

func (db DBDataConnection) Connect() (context.CancelFunc, error)

type RawData

type RawData map[string]any

type Request

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

func NewRequest

func NewRequest(context context.Context, url string, options ...RequestOptions) Request

type RequestOptions

type RequestOptions func(*requestOption)

func WithBody

func WithBody(body any) RequestOptions

func WithCorrelationID

func WithCorrelationID() RequestOptions

func WithHeader

func WithHeader(name, value string) RequestOptions

func WithJsonHeaders

func WithJsonHeaders() RequestOptions

func WithMethod

func WithMethod(method string) RequestOptions

type Response

type Response[T any] struct {
	StatusCode int
	Data       *T
	Error      RawData
	Headers    http.Header
}

func (Response[T]) DataToJson

func (r Response[T]) DataToJson() nilo.Option[string]

func (Response[T]) ErrorToJson

func (r Response[T]) ErrorToJson() nilo.Option[string]

func (Response[T]) ValueFromJsonField

func (r Response[T]) ValueFromJsonField(jsonField string) nilo.Option[any]

type Try

type Try int

Jump to

Keyboard shortcuts

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