core

package
v0.0.0-...-ad0604f Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolViewRoute = PageRoute(iota)
	ServicesViewRoute
	MessagesViewRoute
	DiscoveryViewRoute
	ConfigViewRoute
	LogViewRoute
	NotFoundRoute
)

Variables

View Source
var Console = newJsConsole()

Functions

func ApiErrorName

func ApiErrorName(code api.ErrorCode) string

func AppendStyles

func AppendStyles(s string)

func ArrangeParams

func ArrangeParams[T any](params map[string]T) []string

func ArrangeServices

func ArrangeServices(services []api.ListServicesEntry)

func Dispatch

func Dispatch(event interface{}, receivers ...SubscriberID)

dispatch func

func DispatcherUnsubscribe

func DispatcherUnsubscribe(id SubscriberID)

unsubscribe func

func Fetch

func Fetch(url string, init *FetchInit, then func(response *FetchResponse), catch func(err *FetchError))

func FetchQuery

func FetchQuery(url string, r interface{}, then func(r *api.Query), catch func(err string))

func FetchQueryWithSocket

func FetchQueryWithSocket(r *api.Query, then func(r *api.Query), catch func(err string))

func FormatMultilineText

func FormatMultilineText(text string) (content []vecty.MarkupOrChild)

func GetLocation

func GetLocation() (path string)

func HTTPUrl

func HTTPUrl(path string) string

func If

func If(cond bool, children ...vecty.ComponentOrHTML) vecty.List

If returns nil if cond is false, otherwise it returns the given children. fixes return type of vecty.If

func LocalStorageClear

func LocalStorageClear()

func LocalStorageGet

func LocalStorageGet(key string) (string, bool)

func LocalStorageRemove

func LocalStorageRemove(key string)

func LocalStorageSet

func LocalStorageSet(key, value string)

func ParamDefaultValue

func ParamDefaultValue(pi *api.ParamInfoEntry) string

func Query

func Query(useSocket bool, r *api.Query, then func(*api.Query), catch func(err string))

func QueryToString

func QueryToString(q interface{}) (string, error)

func ReleaseJSFunc

func ReleaseJSFunc(fn *js.Func) bool

func SafeJSDestroy

func SafeJSDestroy(v *js.Value, fn func(v *js.Value))

func SafeJSOperation

func SafeJSOperation(v *js.Value, fn func(v *js.Value))

func SafeJSValue

func SafeJSValue(v *js.Value, fn func(v *js.Value) js.Value) js.Value

func SessionStorageClear

func SessionStorageClear()

func SessionStorageGet

func SessionStorageGet(key string) (string, bool)

func SessionStorageRemove

func SessionStorageRemove(key string)

func SessionStorageSet

func SessionStorageSet(key, value string)

func SetLocation

func SetLocation(url string)

func StringToQuery

func StringToQuery(s string) (*api.Query, error)

func Stylesheet

func Stylesheet() string

func ToRoute

func ToRoute(route PageRoute) bool

func WebSocketUrl

func WebSocketUrl() string

Types

type CachedQuery

type CachedQuery[T any] struct {
	Value *T
	Error string
}

func (*CachedQuery[T]) Query

func (cq *CachedQuery[T]) Query(useSocket, force bool, r *api.Query, handle func(*api.Query) (*T, string), success func(*T), failure func(err string)) bool

type Classes

type Classes struct {
	Classes []string
}

func (*Classes) ApplyClasses

func (c *Classes) ApplyClasses() vecty.Applyer

func (*Classes) WithClasses

func (c *Classes) WithClasses(classes ...string)

type FetchError

type FetchError struct {
	Name    string
	Message string
}

func (*FetchError) Error

func (fe *FetchError) Error() string

type FetchInit

type FetchInit struct {
	Method string
	Body   string
}

type FetchResponse

type FetchResponse struct {
	OK     bool
	Status int
	Body   string
}

type Keyable

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

func (*Keyable) Key

func (k *Keyable) Key() interface{}

func (*Keyable) WithKey

func (k *Keyable) WithKey(key interface{})

type MainSocketError

type MainSocketError string

type MainSocketMessage

type MainSocketMessage *api.Query

type MainSocketOpened

type MainSocketOpened struct{}

type MainSocketTimeout

type MainSocketTimeout uint

type PageRoute

type PageRoute int

func GetRoute

func GetRoute() PageRoute

type Parameter

type Parameter struct {
	Name  string
	Value string
}

type ParameterBoolData

type ParameterBoolData struct {
	BoolValue bool
}

type ParameterEnumData

type ParameterEnumData struct {
	Options []ParameterEnumOption
}

type ParameterEnumOption

type ParameterEnumOption struct {
	Name     string
	Selected bool
}

type ParameterIntData

type ParameterIntData struct {
	Minimum string
	Maximum string
	Error   string
}

type Parameters

type Parameters []Parameter

func (Parameters) AppendAvailable

func (params Parameters) AppendAvailable(transport *api.ProtocolTransportInfoEntry) (Parameters, bool)

func (Parameters) AvailableNames

func (params Parameters) AvailableNames(transport *api.ProtocolTransportInfoEntry) []string

func (Parameters) ChangeValue

func (params Parameters) ChangeValue(index int, value string) bool

func (Parameters) FirstAvailable

func (params Parameters) FirstAvailable(transport *api.ProtocolTransportInfoEntry) (string, *api.ParamInfoEntry)

func (Parameters) RawParams

func (params Parameters) RawParams() api.RawParamValues

func (Parameters) Remove

func (params Parameters) Remove(index int) (Parameters, bool)

func (Parameters) Replace

func (params Parameters) Replace(index int, name string, transport *api.ProtocolTransportInfoEntry) bool

func (Parameters) ToRender

func (params Parameters) ToRender(transport *api.ProtocolTransportInfoEntry) ([]*RenderParameter, bool)

type ProtocolsInfoWrapper

type ProtocolsInfoWrapper struct {
	Info *api.ProtocolInfoEntry
	// contains filtered or unexported fields
}

type ProtocolsWrapper

type ProtocolsWrapper struct {
	Protocols []*api.ProtocolInfoEntry
	// contains filtered or unexported fields
}

func NewProtocolsWrapper

func NewProtocolsWrapper(protocols *api.ProtocolInfoResult) *ProtocolsWrapper

func (*ProtocolsWrapper) ProtocolAndTransport

func (pw *ProtocolsWrapper) ProtocolAndTransport(protocolID api.ProtocolIdentifier, transportID api.TransportIdentifier) (protocol *api.ProtocolInfoEntry, transport *api.ProtocolTransportInfoEntry)

func (*ProtocolsWrapper) ProtocolAndTransportFullNames

func (pw *ProtocolsWrapper) ProtocolAndTransportFullNames(protocolID api.ProtocolIdentifier, transportID api.TransportIdentifier) (protocolName, transportName string)

func (*ProtocolsWrapper) ProtocolAndTransportNames

func (pw *ProtocolsWrapper) ProtocolAndTransportNames(protocolID api.ProtocolIdentifier, transportID api.TransportIdentifier) (protocolName, transportName string)

type RenderParameter

type RenderParameter struct {
	Parameter
	Index int
	Data  interface{}
}

type ServiceEntryData

type ServiceEntryData struct {
	api.ServiceKey
	Alias  string
	Params Parameters
}

func NewServiceEntryData

func NewServiceEntryData(protocols []*api.ProtocolInfoEntry) *ServiceEntryData

func (*ServiceEntryData) ChangeProtocol

func (sed *ServiceEntryData) ChangeProtocol(protocols []*api.ProtocolInfoEntry, index int) bool

func (*ServiceEntryData) ChangeTransport

func (sed *ServiceEntryData) ChangeTransport(protocols *ProtocolsWrapper, index int) bool

func (*ServiceEntryData) ProtocolAndTransport

func (sed *ServiceEntryData) ProtocolAndTransport(protocols *ProtocolsWrapper) (*api.ProtocolInfoEntry, *api.ProtocolTransportInfoEntry)

func (*ServiceEntryData) ValidateEntryAndAlias

func (sed *ServiceEntryData) ValidateEntryAndAlias(services []api.ListServicesEntry, protocols *ProtocolsWrapper) (entryMessage, aliasMessage string)

type SharedSocket

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

func MainSocket

func MainSocket() *SharedSocket

func (*SharedSocket) Send

func (s *SharedSocket) Send(r *api.Query) (string, bool)

func (*SharedSocket) SendWithTimeout

func (s *SharedSocket) SendWithTimeout(r *api.Query, t *Timeout) (string, bool)

type SubscriberFn

type SubscriberFn func(event interface{})

subscriberFn function signature for the subscriber

type SubscriberID

type SubscriberID int

subscriberID identifier type for the subscriber

func DispatcherSubscribe

func DispatcherSubscribe(fn SubscriberFn) SubscriberID

subscribe func

type Timeout

type Timeout struct {
	ID uint
	// contains filtered or unexported fields
}

func (*Timeout) Clear

func (t *Timeout) Clear()

func (*Timeout) Reset

func (t *Timeout) Reset(delay uint) *Timeout

func (*Timeout) Set

func (t *Timeout) Set(fn func(), delay uint) *Timeout

type WebSocket

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

func NewWebSocket

func NewWebSocket(url string) *WebSocket

func (*WebSocket) Close

func (ws *WebSocket) Close() error

func (*WebSocket) OnClose

func (ws *WebSocket) OnClose(fn func())

func (*WebSocket) OnError

func (ws *WebSocket) OnError(fn func())

func (*WebSocket) OnMessage

func (ws *WebSocket) OnMessage(fn func(data string))

func (*WebSocket) OnOpen

func (ws *WebSocket) OnOpen(fn func())

func (*WebSocket) Send

func (ws *WebSocket) Send(data string)

Jump to

Keyboard shortcuts

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