Documentation ¶
Overview ¶
Package entity provides entities for business logic.
Package entity provides entities for business logic.
Package entity provides entities for business logic.
Package entity provides entities for business logic.
Package entity provides entities for business logic.
Package entity provides entities for business logic.
Package entity provides entities for business logic.
Package entity provides entities for business logic.
Package entity provides entities for business logic.
Package entity provides entities for business logic.
Package entity provides entities for business logic.
Index ¶
- Constants
- Variables
- func GetBool(f *Field, val interface{}) interface{}
- func GetBreadcrumb(w []*Workspace, id int64) []string
- func GetBytes(f *Field, val interface{}) (interface{}, error)
- func GetFloat32(f *Field, val interface{}) (interface{}, error)
- func GetFloat64(f *Field, val interface{}) (interface{}, error)
- func GetInt32(f *Field, val interface{}) (interface{}, error)
- func GetInt64(f *Field, val interface{}) (interface{}, error)
- func GetString(f *Field, val interface{}) interface{}
- func GetUInt32(f *Field, val interface{}) (interface{}, error)
- func GetUInt64(f *Field, val interface{}) (interface{}, error)
- func IsDebug() bool
- type ApplicationConfig
- type Auth
- type Config
- type DatabaseConfig
- type Enum
- type EnumValue
- type Error
- type Field
- type FolderRequest
- type FolderResponse
- type GCSAuth
- type GUICommand
- type GUIRequest
- type GUIResponse
- type GUIResponseStatus
- type Info
- type K8SClientConfig
- type K8SPortForward
- type LoadServerResponse
- type LoggerConfig
- type Map
- type Message
- type Method
- type OneOf
- type PortForwardControl
- type ProtobufError
- type Query
- type QueryRequest
- type QueryResponse
- type RuntimeConfig
- type SavedQuery
- type ServerRequest
- type ServerResponse
- type ServerUpdateRequest
- type Service
- type Settings
- type Workspace
- type WorkspaceEvent
- type WorkspaceExpandRequest
- type WorkspaceItemFolder
- type WorkspaceItemQuery
- type WorkspaceItemServer
- type WorkspaceRequest
- type WorkspaceSortingRequest
- type WorkspaceState
- type WorkspaceTreeFilter
- type WorkspaceTreeNode
- type WorkspaceType
Constants ¶
const ( // AuthTypeNone do not use authentication AuthTypeNone = "none" // AuthTypeBasic basic authentication AuthTypeBasic = "basic" // AuthTypeBearer bearer token authentication AuthTypeBearer = "bearer" // AuthTypeJWT jwt token authentication AuthTypeJWT = "jwt" // AuthTypeGCE Google Compute Engine authentication AuthTypeGCE = "google" )
const ( ReflectionServiceFQN = "grpc.reflection.v1alpha.ServerReflection" MethodTypeUnary = "u" MethodTypeClientStream = "cs" MethodTypeServerStream = "ss" MethodTypeBidiStream = "css" )
constants for gRPC client
const ( // MsgCreatingPortForward message creating port forwarding MsgCreatingPortForward = "Creating port forwarding..." // MsgConnectingServer message connecting to server MsgConnectingServer = "Connecting to server..." // MsgServerReflectionInfo message getting information about services MsgServerReflectionInfo = "Getting information about publicly-accessible gRPC services..." )
const ( ProtoTypeEnum = "TYPE_ENUM" ProtoTypeMessage = "TYPE_MESSAGE" )
protobuf types
const ( TypeString = "string" TypeBytes = "bytes" TypeInt32 = "int32" TypeInt64 = "int64" TypeUInt32 = "uint32" TypeUInt64 = "uint64" TypeSInt32 = "sint32" TypeSInt64 = "sint64" TypeFixed32 = "fixed32" TypeFixed64 = "fixed64" TypeSFixed32 = "sfixed32" TypeSFixed64 = "sfixed64" TypeDouble = "double" TypeFloat = "float" TypeBool = "bool" TypeEnum = "enum" TypeMessage = "message" )
protobuf data types
Variables ¶
var ( // ErrK8SPodNotFound error - pod not found ErrK8SPodNotFound = errors.New("pod not found") // ErrNotConnected error - server not connected ErrNotConnected = errors.New("not connected") )
var DefaultSettings = &Settings{ WindowWidth: 1024, WindowHeight: 768, WindowX: structs.Ref(50), WindowY: structs.Ref(50), SingleInstance: structs.Ref(true), ConnectTimeout: structs.Ref(10), RequestTimeout: structs.Ref(30), K8SRequestTimeout: structs.Ref(30), NonBlockingConnection: structs.Ref(true), SortMethodsByName: structs.Ref(true), MaxLoopDepth: structs.Ref(10), }
DefaultSettings settings by default
var ( // ErrWorkspaceNotExists error workspace not exists ErrWorkspaceNotExists = errors.New("workspace not exists") )
Functions ¶
func GetBreadcrumb ¶
GetBreadcrumb returns breadcrumb
func GetFloat32 ¶
GetFloat32 transforms to float32
func GetFloat64 ¶
GetFloat64 transforms to float64
func GetString ¶
func GetString(f *Field, val interface{}) interface{}
GetString transforms to string
Types ¶
type ApplicationConfig ¶
type ApplicationConfig struct { Homepage string `json:"homepage" default:"resources/index.html"` HomepageWin string `json:"homepage_win" default:"../index.html"` IconsPath string `json:"icons_path" default:"resources/icons"` AppIconLinux string `json:"app_icon_linux" default:"app.png"` AppIconDarwin string `json:"app_icon_darwin" default:"warthog.icns"` AppIconWindows string `json:"app_icon_windows" default:"app.ico"` TrayIconLinux string `json:"tray_icon_linux" default:"tray.png"` TrayIconDarwin string `json:"tray_icon_darwin" default:"tray24.png"` TrayIconWindows string `json:"tray_icon_windows" default:"tray.ico"` }
ApplicationConfig base application params
type Auth ¶ added in v0.4.0
type Auth struct { Type string `json:"type,omitempty"` Login string `json:"login,omitempty"` Password string `json:"password,omitempty"` Token string `json:"token,omitempty"` Algorithm string `json:"algorithm,omitempty"` Secret string `json:"secret,omitempty"` PrivateKey string `json:"private_key,omitempty"` SecretBase64 bool `json:"secret_base64,omitempty"` HeaderPrefix string `json:"header_prefix,omitempty"` Payload map[string]interface{} `json:"payload,omitempty"` GoogleScopes []string `json:"google_scopes,omitempty"` GoogleToken string `json:"google_token,omitempty"` }
Auth authentication data
type Config ¶
type Config struct { Application *ApplicationConfig `json:"application"` Database *DatabaseConfig `json:"database"` //Grpc *GrpcConfig `json:"grpc"` Logger *LoggerConfig `json:"logger"` Runtime *RuntimeConfig `json:"runtime"` }
Config application configuration
type DatabaseConfig ¶
type DatabaseConfig struct { DatasourceName string `json:"datasource_name" default:"warthog.db"` DriverName string `json:"driver_name" default:"sqlite3"` }
DatabaseConfig database settings
type Error ¶
type Error struct { Pos ast.SourcePos `json:"pos"` Code uint32 `json:"code"` CodeDescription string `json:"code_description"` Message string `json:"message"` }
Error UI error response
type Field ¶
type Field struct { FQN string `json:"fqn"` ProtoFQN string `json:"proto_fqn"` Name string `json:"name"` Type string `json:"type"` ParentType string `json:"parent_type"` Repeated bool `json:"repeated"` Enum *Enum `json:"enum,omitempty"` Map *Map `json:"map,omitempty"` Message *Message `json:"message,omitempty"` OneOf *OneOf `json:"oneof,omitempty"` Descriptor *desc.FieldDescriptor `json:"-"` }
Field protobuf field
type FolderRequest ¶
type FolderRequest struct { ID int64 `json:"id"` ParentID *int64 `json:"parent_id"` Title string `json:"title"` TypeFilter []WorkspaceType `json:"type_filter"` }
FolderRequest read/create/update/delete folder request
func (*FolderRequest) Model ¶
func (r *FolderRequest) Model(folder map[string]interface{}) error
Model creates FolderRequest from UI request
type FolderResponse ¶
type FolderResponse struct { Folder *Workspace `json:"folder"` Tree []*WorkspaceTreeNode `json:"tree"` }
FolderResponse read/create/update folder response
type GCSAuth ¶ added in v0.5.0
type GCSAuth struct { // Enabled GCS authentication enabled Enabled bool `json:"enabled"` // Project GKE project Project string `json:"project"` // Location cluster location Location string `json:"location"` // Cluster the name of the cluster Cluster string `json:"cluster"` }
GCSAuth GCS authentication request
type GUICommand ¶
type GUICommand string
GUICommand UI command
const ( CmdApplicationState GUICommand = "application.state" CmdSettingsUpdate GUICommand = "settings.update" CmdGetWorkspace GUICommand = "workspace.get" CmdSortingWorkspace GUICommand = "workspace.sorting" CmdDeleteWorkspace GUICommand = "workspace.delete" CmdDuplicateWorkspace GUICommand = "workspace.duplicate" CmdExpandWorkspace GUICommand = "workspace.expand" CmdCreateServer GUICommand = "server.create" CmdUpdateServer GUICommand = "server.update" CmdUpdateServerRequest GUICommand = "server.update.request" CmdLoadServer GUICommand = "server.load" CmdCreateFolder GUICommand = "folder.create" CmdUpdateFolder GUICommand = "folder.update" CmdDeleteFolder GUICommand = "folder.delete" CmdUpdateQuery GUICommand = "query.update" CmdRunQuery GUICommand = "query.run" CmdCancelQuery GUICommand = "query.cancel" CmdCloseStream GUICommand = "query.close.stream" CmdQueryResponse GUICommand = "query.response" CmdDevTools GUICommand = "dev.tools.show" CmdMenuSettings GUICommand = "menu.settings" CmdMenuAbout GUICommand = "menu.about" CmdMessageInfo GUICommand = "message.info" CmdMessageError GUICommand = "message.error" )
UI events
type GUIRequest ¶
type GUIRequest struct { Cmd GUICommand `json:"name"` Payload interface{} `json:"payload"` }
GUIRequest UI request
type GUIResponse ¶
type GUIResponse struct { Status GUIResponseStatus `json:"status"` Error Error `json:"error,omitempty"` Payload interface{} `json:"payload,omitempty"` }
GUIResponse UI response
func ErrorGUIResponse ¶
func ErrorGUIResponse(err error, payload ...interface{}) *GUIResponse
ErrorGUIResponse returns UI error response
type GUIResponseStatus ¶
type GUIResponseStatus string
GUIResponseStatus response status
const ( GUIResponseStatusOK GUIResponseStatus = "ok" GUIResponseStatusError GUIResponseStatus = "error" )
UI response statuses
type Info ¶ added in v0.5.0
type Info struct {
Message string `json:"message"`
}
Info UI info message
type K8SClientConfig ¶ added in v0.5.0
type K8SClientConfig struct { // GCSAuth GCP authentication request GCSAuth *GCSAuth `json:"auth"` // KubeConfigFile absolute path to the kubernetes config file KubeConfigFile string `json:"config_file"` // BearerToken Bearer Token string BearerToken string `json:"bearer_token"` }
K8SClientConfig k8s client config
func (*K8SClientConfig) Model ¶ added in v0.5.0
func (c *K8SClientConfig) Model(cfg map[string]interface{}) error
Model creates K8SClientConfig from UI request
type K8SPortForward ¶ added in v0.5.0
type K8SPortForward struct { // Enabled k8s port forward Enabled bool `json:"enabled"` // k8s client config ClientConfig *K8SClientConfig `json:"client_config"` // Namespace is the pod namespace Namespace string `json:"namespace"` // PodName is the pod name PodName string `json:"pod_name"` // PodNameSelector is the pod name selector PodNameSelector string `json:"pod_name_selector"` // LocalPort is the local port that will be selected to expose the PodPort LocalPort int16 `json:"local_port"` // PodPort is the target port for the pod PodPort int16 `json:"pod_port"` // ErrHandler error handler ErrHandler func(err error) `json:"-"` }
K8SPortForward k8s port forward request
func (*K8SPortForward) Model ¶ added in v0.5.0
func (p *K8SPortForward) Model(req map[string]interface{}) error
Model creates K8SPortForward from UI request
type LoadServerResponse ¶
type LoadServerResponse struct { Server *Workspace `json:"server"` Services []*Service `json:"services"` Query *Workspace `json:"query"` Warning []*ProtobufError `json:"warning"` }
LoadServerResponse server data, methods, and saved queries
type LoggerConfig ¶
type LoggerConfig struct { Level string `json:"level" default:"debug"` TimeFieldFormat string `json:"time_field_format" default:"2006-01-02T15:04:05Z07:00"` PrettyPrint bool `json:"pretty_print" default:"true"` DisableSampling bool `json:"disable_sampling" default:"false"` RedirectStdLogger bool `json:"redirect_std_logger" default:"false"` ErrorStack bool `json:"error_stack" default:"false"` ShowCaller bool `json:"show_caller" default:"false"` }
LoggerConfig logger settings
type Map ¶
type Map struct { KeyType string `json:"key_type"` ValueType string `json:"value_type"` ValueTypeFqn string `json:"-"` ProtoValueType string `json:"-"` ValueDescriptor *desc.MessageDescriptor `json:"-"` Fields []*Field `json:"fields,omitempty"` }
Map protobuf map
type Message ¶
type Message struct { Name string `json:"name"` Type string `json:"type"` Fields []*Field `json:"fields,omitempty"` Descriptor *desc.MessageDescriptor `json:"-"` }
Message protobuf message
type Method ¶
type Method struct { Name string `json:"name"` Type string `json:"type"` Input []*Field `json:"input,omitempty"` Descriptor *desc.MethodDescriptor `json:"-"` }
Method gRPC method
type PortForwardControl ¶ added in v0.5.0
type ProtobufError ¶
type ProtobufError struct { Pos ast.SourcePos `json:"pos"` Code uint32 `json:"code"` CodeDescription string `json:"code_description"` Warning string `json:"warning"` Err error `json:"err"` }
ProtobufError protobuf parsing warning or error
type Query ¶
type Query struct { ServerID int64 Service string Method string Data map[string]interface{} Metadata []string }
Query gRPC request
type QueryRequest ¶
type QueryRequest struct { ID int64 `json:"id"` ServerID int64 `json:"server_id"` Title string `json:"title"` WorkspaceItemQuery }
QueryRequest read/create/update/delete query
func (*QueryRequest) Model ¶
func (r *QueryRequest) Model(req map[string]interface{}) error
Model creates QueryRequest from UI request
type QueryResponse ¶
type QueryResponse struct { Time string `json:"time"` JsonString string `json:"json_string"` SpentTime string `json:"spent_time"` Header map[string][]string `json:"header"` Trailer map[string][]string `json:"trailer"` Error *Error `json:"error"` Sent uint `json:"sent"` Received uint `json:"received"` }
QueryResponse gRPC response
type RuntimeConfig ¶
type RuntimeConfig struct {
GoMaxProcs int `json:"go_max_procs" default:"0"`
}
RuntimeConfig runtime settings
type SavedQuery ¶
type SavedQuery struct { Input interface{} `json:"input"` Metadata interface{} `json:"metadata"` }
SavedQuery saved query
func (*SavedQuery) Model ¶
func (s *SavedQuery) Model(req map[string]interface{})
Model creates SavedQuery from UI request
type ServerRequest ¶
type ServerRequest struct { ID int64 `json:"id"` FolderID int64 `json:"folder_id"` Title string `json:"title"` WorkspaceItemServer }
ServerRequest read/create/delete server request
func (*ServerRequest) Model ¶
func (r *ServerRequest) Model(req map[string]interface{}) error
Model creates ServerRequest from UI request
type ServerResponse ¶
type ServerResponse struct { Server *Workspace `json:"server"` Query *Workspace `json:"query"` Tree []*WorkspaceTreeNode `json:"tree"` }
ServerResponse read/create/update server response
type ServerUpdateRequest ¶
type ServerUpdateRequest struct { ID int64 `json:"id"` Service string `json:"service"` Method string `json:"method"` Request *SavedQuery `json:"request"` }
ServerUpdateRequest update server request
func (*ServerUpdateRequest) Model ¶
func (r *ServerUpdateRequest) Model(req map[string]interface{}) error
Model creates ServerUpdateRequest from UI request
type Settings ¶ added in v0.3.14
type Settings struct { WindowWidth int `json:"window_width"` WindowHeight int `json:"window_height"` WindowX *int `json:"window_x"` WindowY *int `json:"window_y"` SingleInstance *bool `json:"single_instance"` ConnectTimeout *int `json:"connect_timeout"` RequestTimeout *int `json:"request_timeout"` K8SRequestTimeout *int `json:"k8s_request_timeout"` NonBlockingConnection *bool `json:"non_blocking_connection"` SortMethodsByName *bool `json:"sort_methods_by_name"` MaxLoopDepth *int `json:"max_loop_depth"` }
Settings application settings
type Workspace ¶
type Workspace struct { ID int64 `json:"id"` ParentID *int64 `json:"parent_id"` HasChild *bool `json:"has_child"` Type WorkspaceType `json:"type"` Title string `json:"text"` Breadcrumb []string `json:"breadcrumb"` Data interface{} `json:"data"` Sort *int `json:"sort"` Expanded *bool `json:"expanded"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Workspace workspace item
type WorkspaceEvent ¶ added in v0.5.5
type WorkspaceEvent string
WorkspaceEvent workspace event
func (WorkspaceEvent) String ¶ added in v0.5.5
func (e WorkspaceEvent) String() string
String returns workspace event string
type WorkspaceExpandRequest ¶
WorkspaceExpandRequest workspace expand/collapse request
func (*WorkspaceExpandRequest) Model ¶
func (r *WorkspaceExpandRequest) Model(payload map[string]interface{}) error
Model creates WorkspaceExpandRequest from UI request
type WorkspaceItemFolder ¶
type WorkspaceItemFolder struct { }
WorkspaceItemFolder stored folder data
type WorkspaceItemQuery ¶
type WorkspaceItemQuery struct { Service string `json:"service"` Method string `json:"method"` Description string `json:"description"` Request *SavedQuery `json:"request"` }
WorkspaceItemQuery stored query data
func (*WorkspaceItemQuery) Model ¶
func (s *WorkspaceItemQuery) Model(req map[string]interface{}) error
Model creates WorkspaceItemQuery from UI request
type WorkspaceItemServer ¶
type WorkspaceItemServer struct { Addr string `json:"addr,omitempty"` UseReflection bool `json:"use_reflection,omitempty"` ProtoFiles []string `json:"proto_files,omitempty"` ImportPath []string `json:"import_path,omitempty"` NoTLS bool `json:"no_tls,omitempty"` Insecure bool `json:"insecure,omitempty"` RootCertificate string `json:"root_certificate,omitempty"` ClientCertificate string `json:"client_certificate,omitempty"` ClientKey string `json:"client_key,omitempty"` Request map[string]map[string]*SavedQuery `json:"request"` Auth *Auth `json:"auth"` K8SPortForward *K8SPortForward `json:"k8s"` }
WorkspaceItemServer stored server data
func (*WorkspaceItemServer) IsK8SEnabled ¶ added in v0.5.0
func (s *WorkspaceItemServer) IsK8SEnabled() bool
IsK8SEnabled checks whether it is enabled k8s port forwarding
func (*WorkspaceItemServer) Model ¶
func (s *WorkspaceItemServer) Model(server map[string]interface{}) error
Model creates WorkspaceItemServer from UI request
type WorkspaceRequest ¶
type WorkspaceRequest struct { Type []WorkspaceType `json:"type"` SelectedID int64 `json:"selected_id"` }
WorkspaceRequest workspace request by type
func (*WorkspaceRequest) Model ¶
func (r *WorkspaceRequest) Model(payload map[string]interface{}) error
Model creates WorkspaceRequest from UI request
type WorkspaceSortingRequest ¶
type WorkspaceSortingRequest struct {
Nodes []*Workspace `json:"nodes"`
}
WorkspaceSortingRequest workspace sorting request
func (*WorkspaceSortingRequest) Model ¶
func (r *WorkspaceSortingRequest) Model(payload map[string]interface{}) error
Model creates WorkspaceSortingRequest from UI request
type WorkspaceState ¶
type WorkspaceState struct { Folders int `json:"folders"` Servers int `json:"servers"` Queries int `json:"queries"` StartupWorkspaceID *int64 `json:"startup_workspace_id"` }
WorkspaceState count of folders/servers/queries
type WorkspaceTreeFilter ¶
type WorkspaceTreeFilter struct {
Type []WorkspaceType
}
WorkspaceTreeFilter filtering workspace by type
type WorkspaceTreeNode ¶
type WorkspaceTreeNode struct { Data *Workspace `json:"data"` Text string `json:"text"` Nodes []*WorkspaceTreeNode `json:"nodes"` }
WorkspaceTreeNode workspace tree node
func MakeWorkspaceTree ¶
func MakeWorkspaceTree(w []*Workspace, filter *WorkspaceTreeFilter, selectedID int64) []*WorkspaceTreeNode
MakeWorkspaceTree creates workspace tree for UI
type WorkspaceType ¶
type WorkspaceType string
WorkspaceType workspace type
const ( WorkspaceTypeFolder WorkspaceType = "f" WorkspaceTypeServer WorkspaceType = "s" WorkspaceTypeQuery WorkspaceType = "r" WorkspaceDuplicatePostfix = "Copy" WorkspaceEventServerUpdated = "server.updated" )
workspace types
func (WorkspaceType) String ¶
func (t WorkspaceType) String() string
String returns workspace type string