master

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const NodeStatusActive = 1
View Source
const NodeStatusError = 4
View Source
const NodeStatusIdle = 0
View Source
const NodeStatusSync = 3
View Source
const NodeStatusWorking = 2

Variables

This section is empty.

Functions

func DeleteNodeById

func DeleteNodeById(id string) (Item, error)

func GetNodeById

func GetNodeById(id string) (Item, error)

* * Mode * Handler for CRUD data

func InitMaster

func InitMaster() error

func InitNodes

func InitNodes() error

func InitSecret

func InitSecret() error

Types

type Master

type Master struct {
	InitNodes  bool
	InitSecret bool
	Nodes      []Node
}

func (*Master) GetNodeByID

func (c *Master) GetNodeByID(id string) *Node

func (*Master) GetSyncById

func (c *Master) GetSyncById(idT string) (Item, error)

func (*Master) LoadNode

func (c *Master) LoadNode(params Json) error

func (*Master) LoadNodeById

func (c *Master) LoadNodeById(id string) error

func (*Master) LoadNodes

func (c *Master) LoadNodes() error

func (*Master) SetSync

func (c *Master) SetSync(query, action, node, idT string) (int, error)

func (*Master) UnloadNodeById

func (c *Master) UnloadNodeById(id string) error

type Node

type Node struct {
	Db          int
	URL         string
	Date_make   time.Time `json:"date_make"`
	Date_update time.Time `json:"date_update"`
	Id          string    `json:"_id"`
	Mode        int       `json:"mode"`
	Data        Json      `json:"_data"`
	Status      int       `json:"status"`
	Index       int       `json:"index"`
	Synced      *Collection
}

func NewNode

func NewNode(params *Json) (*Node, error)

func (*Node) GetSyncByIdT

func (c *Node) GetSyncByIdT(idT string) (Item, error)

func (*Node) InsertValues

func (c *Node) InsertValues(data Json) (fields, values string)

func (*Node) LatIndex

func (c *Node) LatIndex() int

func (*Node) Scan

func (n *Node) Scan(data *Json) error

func (*Node) SqlField added in v0.0.8

func (c *Node) SqlField(schema, table string, data Json) string

func (*Node) SyncBatch

func (c *Node) SyncBatch(query string, index int) error

func (*Node) SyncIdT

func (c *Node) SyncIdT(idT string) error

func (*Node) SyncNode

func (c *Node) SyncNode() error

func (*Node) SyncRecord

func (c *Node) SyncRecord(query string, index int) error

func (*Node) ToSql added in v0.0.8

func (c *Node) ToSql(schema, table, idT string, data Json, action string) (string, bool)

func (*Node) UpsertValues added in v0.0.8

func (c *Node) UpsertValues(data Json) (fields, values, fieldValue string)

Jump to

Keyboard shortcuts

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