master

package
v0.0.117 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 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 AllNodes added in v0.0.34

func AllNodes(search string, page, rows int) (et.List, error)

func DefineNodes added in v0.0.34

func DefineNodes() error

func DeleteNodeById

func DeleteNodeById(id string) (et.Item, error)

func GetNodeById

func GetNodeById(id string) (et.Item, error)

* * Mode * Handler for CRUD data

func InitDefine added in v0.0.88

func InitDefine() error

func UpSertNode added in v0.0.85

func UpSertNode(id string, mode int, driver, host string, port int, dbname, user, password string) (et.Item, 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) (et.Item, error)

func (*Master) LoadNode

func (c *Master) LoadNode(params et.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(schema, table, action, node, idT string, data et.Json, query 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        et.Json   `json:"_data"`
	Status      int       `json:"status"`
	Index       int       `json:"index"`
}

func NewNode

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

func (*Node) DelSyncByIndex added in v0.0.34

func (c *Node) DelSyncByIndex(index int) error

func (*Node) GetSyncByIdT

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

func (*Node) InsertValues

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

func (*Node) LatIndex

func (c *Node) LatIndex() int

func (*Node) Scan

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

func (*Node) SqlField added in v0.0.8

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

func (*Node) SyncIdT

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

func (*Node) SyncMasterToNode added in v0.0.34

func (c *Node) SyncMasterToNode() error

func (*Node) SyncNode

func (c *Node) SyncNode() error

func (*Node) SyncNodeToMaster added in v0.0.34

func (c *Node) SyncNodeToMaster() error

func (*Node) SyncQuery added in v0.0.34

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

func (*Node) SyncRecord

func (c *Node) SyncRecord(schema, table, idT string, _data et.Json, action string, _index int) error

func (*Node) ToSql added in v0.0.8

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

func (*Node) UpsertValues added in v0.0.8

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

Jump to

Keyboard shortcuts

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