core

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: BSD-3-Clause Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UPLOAD_PREFIX    = "__"
	UPLOAD_SOURCE    = "__src"
	UPLOAD_TIMESTAMP = "__ts"

	UPLOAD_DEFAULT_SOURCE = consts.DEFAULT_SOURCE
)

Variables

This section is empty.

Functions

func CreateSchema

func CreateSchema(db bun.IDB) error

func Seed

func Seed(db *bun.DB) error

Types

type CableService

type CableService struct {
	cores.UnimplementedCableServiceServer
	// contains filtered or unexported fields
}

func (*CableService) Clone

func (*CableService) Create

func (s *CableService) Create(ctx context.Context, in *pb.Cable) (*pb.Cable, error)

func (*CableService) Delete

func (s *CableService) Delete(ctx context.Context, in *pb.Id) (*pb.MyBool, error)

func (*CableService) List

func (*CableService) Pull

func (*CableService) Update

func (s *CableService) Update(ctx context.Context, in *pb.Cable) (*pb.Cable, error)

func (*CableService) View

func (s *CableService) View(ctx context.Context, in *pb.Id) (*pb.Cable, error)

func (*CableService) ViewByName

func (s *CableService) ViewByName(ctx context.Context, in *cores.ViewCableByNameRequest) (*pb.Cable, error)

func (*CableService) ViewByNameFull

func (s *CableService) ViewByNameFull(ctx context.Context, in *pb.Name) (*pb.Cable, error)

func (*CableService) ViewWithDeleted

func (s *CableService) ViewWithDeleted(ctx context.Context, in *pb.Id) (*pb.Cable, error)

type ControlService

type ControlService struct {
	cores.UnimplementedControlServiceServer
	// contains filtered or unexported fields
}

func (*ControlService) AddClient

func (s *ControlService) AddClient(deviceID string, client edges.ControlServiceClient)

func (*ControlService) GetClient

func (s *ControlService) GetClient(deviceID string) types.Option[edges.ControlServiceClient]

func (*ControlService) GetTagValue

func (s *ControlService) GetTagValue(ctx context.Context, in *pb.Id) (*pb.TagValue, error)

func (*ControlService) RemoveClient

func (s *ControlService) RemoveClient(deviceID string, client edges.ControlServiceClient)

func (*ControlService) SetTagValue

func (s *ControlService) SetTagValue(ctx context.Context, in *pb.TagValue) (*pb.TagValue, error)

type CoreOption

type CoreOption interface {
	// contains filtered or unexported methods
}

func WithInfluxDB

func WithInfluxDB(influxdb *db.InfluxDB) CoreOption

func WithLinkStatusTTL

func WithLinkStatusTTL(d time.Duration) CoreOption

func WithLogger

func WithLogger(logger *zap.Logger) CoreOption

func WithValueCacheTTL

func WithValueCacheTTL(d time.Duration) CoreOption

type CoreService

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

func Core

func Core(db *bun.DB, opts ...CoreOption) (*CoreService, error)

func CoreContext

func CoreContext(ctx context.Context, db *bun.DB, opts ...CoreOption) (*CoreService, error)

func (*CoreService) Context

func (cs *CoreService) Context() context.Context

func (*CoreService) GetCable

func (cs *CoreService) GetCable() *CableService

func (*CoreService) GetControl

func (cs *CoreService) GetControl() *ControlService

func (*CoreService) GetDB

func (cs *CoreService) GetDB() *bun.DB

func (*CoreService) GetData

func (cs *CoreService) GetData() *DataService

func (*CoreService) GetDevice

func (cs *CoreService) GetDevice() *DeviceService

func (*CoreService) GetInfluxDB

func (cs *CoreService) GetInfluxDB() types.Option[*db.InfluxDB]

func (*CoreService) GetJumper

func (cs *CoreService) GetJumper() *JumperService

func (*CoreService) GetOption

func (cs *CoreService) GetOption() *OptionService

func (*CoreService) GetPort

func (cs *CoreService) GetPort() *PortService

func (*CoreService) GetProxy

func (cs *CoreService) GetProxy() *ProxyService

func (*CoreService) GetSlot

func (cs *CoreService) GetSlot() *SlotService

func (*CoreService) GetSource

func (cs *CoreService) GetSource() *SourceService

func (*CoreService) GetStatus

func (cs *CoreService) GetStatus() *StatusService

func (*CoreService) GetSync

func (cs *CoreService) GetSync() *SyncService

func (*CoreService) GetSyncGlobal

func (cs *CoreService) GetSyncGlobal() *SyncGlobalService

func (*CoreService) GetTag

func (cs *CoreService) GetTag() *TagService

func (*CoreService) GetVar

func (cs *CoreService) GetVar() *VarService

func (*CoreService) GetWire

func (cs *CoreService) GetWire() *WireService

func (*CoreService) Logger

func (cs *CoreService) Logger() *zap.Logger

func (*CoreService) Register

func (cs *CoreService) Register(server *grpc.Server)

func (*CoreService) Start

func (cs *CoreService) Start()

func (*CoreService) Stop

func (cs *CoreService) Stop()

type DataService

type DataService struct {
	cores.UnimplementedDataServiceServer
	// contains filtered or unexported fields
}

func (*DataService) CacheTagValue

func (s *DataService) CacheTagValue(tag *model.Tag, value nson.Value)

func (*DataService) Compile

func (s *DataService) Compile(ctx context.Context, in *cores.DataQueryRequest) (*pb.Message, error)

func (*DataService) Query

func (*DataService) QueryTag

func (*DataService) Upload

type DeviceService

type DeviceService struct {
	cores.UnimplementedDeviceServiceServer
	// contains filtered or unexported fields
}

func (*DeviceService) Clone

func (s *DeviceService) Clone(ctx context.Context, in *pb.Id) (*pb.MyBool, error)

func (*DeviceService) Create

func (s *DeviceService) Create(ctx context.Context, in *pb.Device) (*pb.Device, error)

func (*DeviceService) Delete

func (s *DeviceService) Delete(ctx context.Context, in *pb.Id) (*pb.MyBool, error)

func (*DeviceService) Destory

func (s *DeviceService) Destory(ctx context.Context, in *pb.Id) (*pb.MyBool, error)

func (*DeviceService) List

func (*DeviceService) Update

func (s *DeviceService) Update(ctx context.Context, in *pb.Device) (*pb.Device, error)

func (*DeviceService) View

func (s *DeviceService) View(ctx context.Context, in *pb.Id) (*pb.Device, error)

func (*DeviceService) ViewByName

func (s *DeviceService) ViewByName(ctx context.Context, in *pb.Name) (*pb.Device, error)

type JumperService

type JumperService struct {
	cores.UnimplementedJumperServiceServer
	// contains filtered or unexported fields
}

func (*JumperService) Create

func (s *JumperService) Create(ctx context.Context, in *cores.Jumper) (*cores.Jumper, error)

func (*JumperService) Delete

func (s *JumperService) Delete(ctx context.Context, in *pb.Id) (*pb.MyBool, error)

func (*JumperService) List

func (*JumperService) Update

func (s *JumperService) Update(ctx context.Context, in *cores.Jumper) (*cores.Jumper, error)

func (*JumperService) View

func (s *JumperService) View(ctx context.Context, in *pb.Id) (*cores.Jumper, error)

func (*JumperService) ViewByName

func (s *JumperService) ViewByName(ctx context.Context, in *pb.Name) (*cores.Jumper, error)

type OptionService

type OptionService struct {
	cores.UnimplementedOptionServiceServer
	// contains filtered or unexported fields
}

func (*OptionService) Clone

func (*OptionService) Create

func (s *OptionService) Create(ctx context.Context, in *pb.Option) (*pb.Option, error)

func (*OptionService) Delete

func (s *OptionService) Delete(ctx context.Context, in *pb.Id) (*pb.MyBool, error)

func (*OptionService) List

func (*OptionService) Pull

func (*OptionService) Update

func (s *OptionService) Update(ctx context.Context, in *pb.Option) (*pb.Option, error)

func (*OptionService) View

func (s *OptionService) View(ctx context.Context, in *pb.Id) (*pb.Option, error)

func (*OptionService) ViewByName

func (*OptionService) ViewByNameFull

func (s *OptionService) ViewByNameFull(ctx context.Context, in *pb.Name) (*pb.Option, error)

func (*OptionService) ViewWithDeleted

func (s *OptionService) ViewWithDeleted(ctx context.Context, in *pb.Id) (*pb.Option, error)

type PortService

type PortService struct {
	cores.UnimplementedPortServiceServer
	// contains filtered or unexported fields
}

func (*PortService) Clone

func (*PortService) Create

func (s *PortService) Create(ctx context.Context, in *pb.Port) (*pb.Port, error)

func (*PortService) Delete

func (s *PortService) Delete(ctx context.Context, in *pb.Id) (*pb.MyBool, error)

func (*PortService) List

func (*PortService) Pull

func (*PortService) Update

func (s *PortService) Update(ctx context.Context, in *pb.Port) (*pb.Port, error)

func (*PortService) View

func (s *PortService) View(ctx context.Context, in *pb.Id) (*pb.Port, error)

func (*PortService) ViewByName

func (s *PortService) ViewByName(ctx context.Context, in *cores.ViewPortByNameRequest) (*pb.Port, error)

func (*PortService) ViewByNameFull

func (s *PortService) ViewByNameFull(ctx context.Context, in *pb.Name) (*pb.Port, error)

func (*PortService) ViewWithDeleted

func (s *PortService) ViewWithDeleted(ctx context.Context, in *pb.Id) (*pb.Port, error)

type ProxyService

type ProxyService struct {
	cores.UnimplementedProxyServiceServer
	// contains filtered or unexported fields
}

func (*ProxyService) Clone

func (*ProxyService) Create

func (s *ProxyService) Create(ctx context.Context, in *pb.Proxy) (*pb.Proxy, error)

func (*ProxyService) Delete

func (s *ProxyService) Delete(ctx context.Context, in *pb.Id) (*pb.MyBool, error)

func (*ProxyService) List

func (*ProxyService) Pull

func (*ProxyService) Update

func (s *ProxyService) Update(ctx context.Context, in *pb.Proxy) (*pb.Proxy, error)

func (*ProxyService) View

func (s *ProxyService) View(ctx context.Context, in *pb.Id) (*pb.Proxy, error)

func (*ProxyService) ViewByName

func (s *ProxyService) ViewByName(ctx context.Context, in *cores.ViewProxyByNameRequest) (*pb.Proxy, error)

func (*ProxyService) ViewByNameFull

func (s *ProxyService) ViewByNameFull(ctx context.Context, in *pb.Name) (*pb.Proxy, error)

func (*ProxyService) ViewWithDeleted

func (s *ProxyService) ViewWithDeleted(ctx context.Context, in *pb.Id) (*pb.Proxy, error)

type SlotService

type SlotService struct {
	cores.UnimplementedSlotServiceServer
	// contains filtered or unexported fields
}

func (*SlotService) Clone

func (*SlotService) Create

func (s *SlotService) Create(ctx context.Context, in *pb.Slot) (*pb.Slot, error)

func (*SlotService) Delete

func (s *SlotService) Delete(ctx context.Context, in *pb.Id) (*pb.MyBool, error)

func (*SlotService) List

func (*SlotService) Pull

func (*SlotService) Update

func (s *SlotService) Update(ctx context.Context, in *pb.Slot) (*pb.Slot, error)

func (*SlotService) View

func (s *SlotService) View(ctx context.Context, in *pb.Id) (*pb.Slot, error)

func (*SlotService) ViewByName

func (s *SlotService) ViewByName(ctx context.Context, in *cores.ViewSlotByNameRequest) (*pb.Slot, error)

func (*SlotService) ViewByNameFull

func (s *SlotService) ViewByNameFull(ctx context.Context, in *pb.Name) (*pb.Slot, error)

func (*SlotService) ViewWithDeleted

func (s *SlotService) ViewWithDeleted(ctx context.Context, in *pb.Id) (*pb.Slot, error)

type SourceService

type SourceService struct {
	cores.UnimplementedSourceServiceServer
	// contains filtered or unexported fields
}

func (*SourceService) Clone

func (*SourceService) Create

func (s *SourceService) Create(ctx context.Context, in *pb.Source) (*pb.Source, error)

func (*SourceService) Delete

func (s *SourceService) Delete(ctx context.Context, in *pb.Id) (*pb.MyBool, error)

func (*SourceService) List

func (*SourceService) Pull

func (*SourceService) Update

func (s *SourceService) Update(ctx context.Context, in *pb.Source) (*pb.Source, error)

func (*SourceService) View

func (s *SourceService) View(ctx context.Context, in *pb.Id) (*pb.Source, error)

func (*SourceService) ViewByName

func (*SourceService) ViewByNameFull

func (s *SourceService) ViewByNameFull(ctx context.Context, in *pb.Name) (*pb.Source, error)

func (*SourceService) ViewWithDeleted

func (s *SourceService) ViewWithDeleted(ctx context.Context, in *pb.Id) (*pb.Source, error)

type StatusService

type StatusService struct {
	// contains filtered or unexported fields
}
func (s *StatusService) GetLink(key string) int32

func (*StatusService) GetLinkValue

func (s *StatusService) GetLinkValue(key string) types.Option[cache.Value[int32]]
func (s *StatusService) SetLink(key string, status int32)

type SyncGlobalService

type SyncGlobalService struct {
	cores.UnimplementedSyncGlobalServiceServer
	// contains filtered or unexported fields
}

type SyncService

type SyncService struct {
	cores.UnimplementedSyncServiceServer
	// contains filtered or unexported fields
}

func (*SyncService) GetDeviceUpdated

func (s *SyncService) GetDeviceUpdated(ctx context.Context, in *pb.Id) (*cores.SyncUpdated, error)

func (*SyncService) GetTagValueUpdated

func (s *SyncService) GetTagValueUpdated(ctx context.Context, in *pb.Id) (*cores.SyncUpdated, error)

func (*SyncService) GetWireValueUpdated

func (s *SyncService) GetWireValueUpdated(ctx context.Context, in *pb.Id) (*cores.SyncUpdated, error)

func (*SyncService) SetDeviceUpdated

func (s *SyncService) SetDeviceUpdated(ctx context.Context, in *cores.SyncUpdated) (*pb.MyBool, error)

func (*SyncService) SetTagValueUpdated

func (s *SyncService) SetTagValueUpdated(ctx context.Context, in *cores.SyncUpdated) (*pb.MyBool, error)

func (*SyncService) SetWireValueUpdated

func (s *SyncService) SetWireValueUpdated(ctx context.Context, in *cores.SyncUpdated) (*pb.MyBool, error)

func (*SyncService) WaitDeviceUpdated

func (s *SyncService) WaitDeviceUpdated(in *pb.Id,
	stream cores.SyncService_WaitDeviceUpdatedServer) error

func (*SyncService) WaitDeviceUpdated2

func (s *SyncService) WaitDeviceUpdated2(ctx context.Context, id string) chan bool

func (*SyncService) WaitTagValueUpdated

func (s *SyncService) WaitTagValueUpdated(in *pb.Id,
	stream cores.SyncService_WaitTagValueUpdatedServer) error

func (*SyncService) WaitTagValueUpdated2

func (s *SyncService) WaitTagValueUpdated2(ctx context.Context, id string) chan bool

func (*SyncService) WaitWireValueUpdated

func (s *SyncService) WaitWireValueUpdated(in *pb.Id,
	stream cores.SyncService_WaitWireValueUpdatedServer) error

func (*SyncService) WaitWireValueUpdated2

func (s *SyncService) WaitWireValueUpdated2(ctx context.Context, id string) chan bool

type TagService

type TagService struct {
	cores.UnimplementedTagServiceServer
	// contains filtered or unexported fields
}

func (*TagService) Clone

func (s *TagService) Clone(ctx context.Context, in *cores.CloneTagRequest) (*pb.MyBool, error)

func (*TagService) Create

func (s *TagService) Create(ctx context.Context, in *pb.Tag) (*pb.Tag, error)

func (*TagService) Delete

func (s *TagService) Delete(ctx context.Context, in *pb.Id) (*pb.MyBool, error)

func (*TagService) DeleteValue

func (s *TagService) DeleteValue(ctx context.Context, in *pb.Id) (*pb.MyBool, error)

func (*TagService) GetTagValue

func (s *TagService) GetTagValue(id string) nson.Value

func (*TagService) GetTagValueValue

func (s *TagService) GetTagValueValue(id string) types.Option[cache.Value[nson.Value]]

func (*TagService) GetValue

func (s *TagService) GetValue(ctx context.Context, in *pb.Id) (*pb.TagValue, error)

func (*TagService) GetValueByName

func (*TagService) List

func (*TagService) Pull

func (*TagService) PullValue

func (*TagService) SetTagValue

func (s *TagService) SetTagValue(id string, value nson.Value)

func (*TagService) SetValue

func (s *TagService) SetValue(ctx context.Context, in *pb.TagValue) (*pb.MyBool, error)

func (*TagService) SetValueByName

func (s *TagService) SetValueByName(ctx context.Context, in *cores.TagNameValue) (*pb.MyBool, error)

func (*TagService) SetValueByNameUnchecked

func (s *TagService) SetValueByNameUnchecked(ctx context.Context, in *cores.TagNameValue) (*pb.MyBool, error)

func (*TagService) SetValueUnchecked

func (s *TagService) SetValueUnchecked(ctx context.Context, in *pb.TagValue) (*pb.MyBool, error)

func (*TagService) Update

func (s *TagService) Update(ctx context.Context, in *pb.Tag) (*pb.Tag, error)

func (*TagService) View

func (s *TagService) View(ctx context.Context, in *pb.Id) (*pb.Tag, error)

func (*TagService) ViewByName

func (s *TagService) ViewByName(ctx context.Context, in *cores.ViewTagByNameRequest) (*pb.Tag, error)

func (*TagService) ViewByNameFull

func (s *TagService) ViewByNameFull(ctx context.Context, in *pb.Name) (*pb.Tag, error)

func (*TagService) ViewValue

func (s *TagService) ViewValue(ctx context.Context, in *pb.Id) (*pb.TagValueUpdated, error)

func (*TagService) ViewWithDeleted

func (s *TagService) ViewWithDeleted(ctx context.Context, in *pb.Id) (*pb.Tag, error)

type VarService

type VarService struct {
	cores.UnimplementedVarServiceServer
	// contains filtered or unexported fields
}

func (*VarService) Clone

func (s *VarService) Clone(ctx context.Context, in *cores.CloneVarRequest) (*pb.MyBool, error)

func (*VarService) Create

func (s *VarService) Create(ctx context.Context, in *pb.Var) (*pb.Var, error)

func (*VarService) Delete

func (s *VarService) Delete(ctx context.Context, in *pb.Id) (*pb.MyBool, error)

func (*VarService) GetValue

func (s *VarService) GetValue(ctx context.Context, in *pb.Id) (*pb.VarValue, error)

func (*VarService) GetValueByName

func (*VarService) List

func (*VarService) Pull

func (*VarService) SetValue

func (s *VarService) SetValue(ctx context.Context, in *pb.VarValue) (*pb.MyBool, error)

func (*VarService) SetValueByName

func (s *VarService) SetValueByName(ctx context.Context, in *cores.VarNameValue) (*pb.MyBool, error)

func (*VarService) SetValueByNameUnchecked

func (s *VarService) SetValueByNameUnchecked(ctx context.Context, in *cores.VarNameValue) (*pb.MyBool, error)

func (*VarService) SetValueUnchecked

func (s *VarService) SetValueUnchecked(ctx context.Context, in *pb.VarValue) (*pb.MyBool, error)

func (*VarService) Update

func (s *VarService) Update(ctx context.Context, in *pb.Var) (*pb.Var, error)

func (*VarService) View

func (s *VarService) View(ctx context.Context, in *pb.Id) (*pb.Var, error)

func (*VarService) ViewByName

func (s *VarService) ViewByName(ctx context.Context, in *cores.ViewVarByNameRequest) (*pb.Var, error)

func (*VarService) ViewByNameFull

func (s *VarService) ViewByNameFull(ctx context.Context, in *pb.Name) (*pb.Var, error)

func (*VarService) ViewWithDeleted

func (s *VarService) ViewWithDeleted(ctx context.Context, in *pb.Id) (*pb.Var, error)

type WireService

type WireService struct {
	cores.UnimplementedWireServiceServer
	// contains filtered or unexported fields
}

func (*WireService) Clone

func (*WireService) Create

func (s *WireService) Create(ctx context.Context, in *pb.Wire) (*pb.Wire, error)

func (*WireService) Delete

func (s *WireService) Delete(ctx context.Context, in *pb.Id) (*pb.MyBool, error)

func (*WireService) DeleteValue

func (s *WireService) DeleteValue(ctx context.Context, in *pb.Id) (*pb.MyBool, error)

func (*WireService) GetValue

func (s *WireService) GetValue(ctx context.Context, in *pb.Id) (*pb.WireValue, error)

func (*WireService) GetValueByName

func (*WireService) List

func (*WireService) Pull

func (*WireService) PullValue

func (*WireService) SetValue

func (s *WireService) SetValue(ctx context.Context, in *pb.WireValue) (*pb.MyBool, error)

func (*WireService) SetValueByName

func (s *WireService) SetValueByName(ctx context.Context, in *cores.WireNameValue) (*pb.MyBool, error)

func (*WireService) SetValueByNameUnchecked

func (s *WireService) SetValueByNameUnchecked(ctx context.Context, in *cores.WireNameValue) (*pb.MyBool, error)

func (*WireService) SetValueUnchecked

func (s *WireService) SetValueUnchecked(ctx context.Context, in *pb.WireValue) (*pb.MyBool, error)

func (*WireService) Update

func (s *WireService) Update(ctx context.Context, in *pb.Wire) (*pb.Wire, error)

func (*WireService) View

func (s *WireService) View(ctx context.Context, in *pb.Id) (*pb.Wire, error)

func (*WireService) ViewByName

func (s *WireService) ViewByName(ctx context.Context, in *cores.ViewWireByNameRequest) (*pb.Wire, error)

func (*WireService) ViewByNameFull

func (s *WireService) ViewByNameFull(ctx context.Context, in *pb.Name) (*pb.Wire, error)

func (*WireService) ViewValue

func (s *WireService) ViewValue(ctx context.Context, in *pb.Id) (*pb.WireValueUpdated, error)

func (*WireService) ViewWithDeleted

func (s *WireService) ViewWithDeleted(ctx context.Context, in *pb.Id) (*pb.Wire, error)

Jump to

Keyboard shortcuts

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