zcontext

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: MPL-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package zcontext is used to store the context information for the application.

Index

Constants

View Source
const (
	KeyContext = "context"

	KeyProject     = KeyContext + ".project"
	KeyProjectID   = KeyProject + ".id"
	KeyProjectName = KeyProject + ".name"

	KeyEnvironment     = KeyContext + ".environment"
	KeyEnvironmentID   = KeyEnvironment + ".id"
	KeyEnvironmentName = KeyEnvironment + ".name"

	KeyService     = KeyContext + ".service"
	KeyServiceID   = KeyService + ".id"
	KeyServiceName = KeyService + ".name"
)

Keys for context

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicInfo

type BasicInfo interface {
	GetID() string
	GetName() string
	Empty() bool
}

BasicInfo represents the basic information of a resource.

func NewBasicInfo

func NewBasicInfo(id, name string) BasicInfo

type Context

type Context interface {
	GetProject() BasicInfo
	SetProject(project BasicInfo)
	ClearProject()

	GetEnvironment() BasicInfo
	SetEnvironment(environment BasicInfo)
	ClearEnvironment()

	GetService() BasicInfo
	SetService(service BasicInfo)
	ClearService()

	ClearAll()
}

Context represents the current context of the CLI, including the current project, environment, service, etc.

func NewViperContext

func NewViperContext(viper *viper.Viper) Context

NewViperContext creates a new Context based on viper

Jump to

Keyboard shortcuts

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