ral

package
v0.0.0-...-0e73c6a Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDebug

func WithDebug(debug bool) option.Option[Client]

Types

type Client

type Client struct {
	Service Resource
	Debug   bool
}

func NewClient

func NewClient(service Resource, opts ...option.Option[Client]) Client

func (Client) Ral

func (c Client) Ral(ctx context.Context, name string, req Request, respSuc any, respFail any) error

type File

type File resty.File

type Interface

type Interface struct {
	Name   string `toml:"Name"`
	URL    string `toml:"Url"`
	Method string `toml:"Method"`
	Host   string `toml:"Host"`
	Port   string `toml:"Port"`
}

type Record

type Record struct {
	RspCode  int
	Protocol string
	Method   string
	Url      string
	Port     string
	Host     string
	Error    any

	CurlCmd string
	// contains filtered or unexported fields
}

func NewLogRecord

func NewLogRecord() Record

func (*Record) AddField

func (lr *Record) AddField(name string, value any)

func (*Record) AddTimeCostPoint

func (lr *Record) AddTimeCostPoint(name string, d time.Duration)

func (*Record) Flush

func (lr *Record) Flush(l *log.Logger)

func (*Record) PointStart

func (lr *Record) PointStart(name string)

func (*Record) PointStop

func (lr *Record) PointStop(name string)

type Request

type Request struct {
	Header         map[string]string
	Query          map[string]string
	Body           any
	FormData       map[string]string
	PathParams     map[string]string
	UploadFiles    []File
	UploadFilePath map[string]string
	AuthScheme     string
	AuthToken      string
	BasicUserName  string
	BasicPassword  string
}

type Resource

type Resource struct {
	Name         string      `toml:"Name"`
	ConnTimeOut  int         `toml:"ConnTimeOut"`
	WriteTimeOut int         `toml:"WriteTimeOut"`
	ReadTimeOut  int         `toml:"ReadTimeOut"`
	Retry        int         `toml:"Retry"`
	Protocol     string      `toml:"Protocol"`
	Converter    string      `toml:"Converter"`
	Interface    []Interface `toml:"Interface"`
}

type Service

type Service struct {
	Resources []Resource `toml:"Resources"`
}

func NewService

func NewService(file string) Service

type StaticsItem

type StaticsItem struct {
	StartPoint time.Time
	StopPoint  time.Time
}

func (*StaticsItem) GetDuration

func (s *StaticsItem) GetDuration() time.Duration

Jump to

Keyboard shortcuts

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