oskit

package
v0.0.0-...-ff6a228 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const (
	CloudPlatformAWS    = "aws"
	CloudPlatformAliyun = "aliyun"

	// The name from github, XD.
	CloudPlatformTencent = "tencentyun"
)
View Source
const (
	DeployStageDev     = "dev"
	DeployStageTest    = "test"
	DeployStagePre     = "pre"
	DeployStageRelease = "release"
)

Variables

View Source
var (
	Env       string
	Repo      string
	Version   string
	Swagger   string
	Build     string
	BuildTime string
	Uptime    string
	CreatedAt time.Time
)
View Source
var DeployPolicyMap = map[DeployPolicy]string{

	DeployPolicyBlue: "blue",

	DeployPolicyGreen: "green",

	DeployPolicyRed: "red",

	DeployPolicyBlack: "black",
}

Functions

func CommandContext

func CommandContext(timeout int, binPath string, args []string) (string, error)

func Exec

func Exec(bin string, args []string)

func ExecCommand

func ExecCommand(bin string, args []string) (string, error)

func FromDeployPolicy

func FromDeployPolicy(policy DeployPolicy) string

func GetDeployStage

func GetDeployStage() string

func Init

func Init()

func Install

func Install(tmpPath, binPath string) error

Install command binary.

func IsLinux

func IsLinux() bool

IsLinux system.

func IsMac

func IsMac() bool

IsMac system.

func IsStageDev

func IsStageDev() bool

func IsStageTest

func IsStageTest() bool

func IsWin

func IsWin() bool

IsWin system. linux windows darwin.

func SendReloadSignal

func SendReloadSignal() error

Types

type Bar

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

func (*Bar) Finish

func (bar *Bar) Finish()

func (*Bar) NewOption

func (bar *Bar) NewOption(start, total int64)
Example
package main

import (
	"time"

	"github.com/airdb/toolbox/oskit"
)

func main() {
	var bar oskit.Bar

	bar.NewOption(0, 100)

	for i := 0; i <= 100; i++ {
		time.Sleep(time.Millisecond)
		bar.Play(int64(i))
	}

	bar.Finish()
}
Output:

func (*Bar) NewOptionWithGraph

func (bar *Bar) NewOptionWithGraph(start, total int64, graph string)

func (*Bar) Play

func (bar *Bar) Play(cur int64)

type BuildInfo

type BuildInfo struct {
	GoVersion string
	Env       string
	Repo      string
	Version   string
	Swagger   string `json:"swagger,omitempty"`
	Build     string
	BuildTime string
	Uptime    string
	CreatedAt time.Time
}

Build version info.

func GetBuildInfo

func GetBuildInfo() *BuildInfo

func (*BuildInfo) ToProject

func (info *BuildInfo) ToProject() string

func (*BuildInfo) ToString

func (info *BuildInfo) ToString() string

type DeployPolicy

type DeployPolicy uint
const (
	DeployPolicyBlue DeployPolicy = iota + 1
	DeployPolicyGreen
	DeployPolicyRed
	DeployPolicyBlack
)

func ToEnv

func ToEnv(sPolicy string) DeployPolicy

Jump to

Keyboard shortcuts

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