common

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BodyTypeJSON = "application/json"
	BodyTypeForm = "application/x-www-form-urlencoded"
	BodyTypeText = "text/plain"
)

Variables

This section is empty.

Functions

func CheckBodyParam

func CheckBodyParam(bodyJSON string, bodyFile string) (string, error)

CheckBodyParam checks if the body parameter is provided in JSON or file format.

func NewID

func NewID() int64

NewID generates a new ID for each request.

func ParseHTTPParams

func ParseHTTPParams(method string, headers []string, body string, bodyFile string) ([]byte, map[string]string, error)

nolint

Types

type Bar

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

Bar represents a thread-safe progress bar.

func NewBar

func NewBar(total int64, t time.Time) *Bar

NewBar returns a new progress bar with the given total count.

func (*Bar) Finish

func (b *Bar) Finish()

Finish marks the bar as complete and prints the final state.

func (*Bar) Increment

func (b *Bar) Increment()

Increment advances the progress by 1 and redraws the bar if needed.

type TimeBar

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

TimeBar represents a thread-safe time-based progress bar.

func NewTimeBar

func NewTimeBar(totalDuration time.Duration) *TimeBar

NewTimeBar returns a new time-based progress bar with the given duration.

func (*TimeBar) Finish

func (b *TimeBar) Finish()

Finish stops the progress bar and ensures the final state is drawn.

func (*TimeBar) Start

func (b *TimeBar) Start()

Start begins automatic updates in a background goroutine.

Jump to

Keyboard shortcuts

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