request

package module
v0.0.0-...-76af178 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: GPL-3.0 Imports: 5 Imported by: 6

Documentation

Overview

tie-common project tie-common.go

Index

Constants

View Source
const (
	RequestTypeAdd = iota
	RequestTypeGet
	RequestTypeDelete
	RequestTypeUpdate
	RequestTypeBatch
	ReplyTypeEmpty
	ReplyTypeStatus
	ReplyTypeGet
	ReplyTypeBatch
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Add

type Add struct {
	Key    string
	Value1 string
	Value2 string
	// contains filtered or unexported fields
}

func NewAddRequest

func NewAddRequest(key, value1, value2 string) *Add

func (*Add) Reply

func (r *Add) Reply(db *tiedb.Tree, key tiedb.CollectionKey) (Reply, error)

func (*Add) RequestType

func (a *Add) RequestType() uint

type Batch

type Batch struct {
	Add    []*Add
	Get    []*Get
	Delete []*Delete
	Update []*Update
	// contains filtered or unexported fields
}

func NewBatchRequest

func NewBatchRequest() *Batch

func (*Batch) Reply

func (r *Batch) Reply(db *tiedb.Tree, key tiedb.CollectionKey) (Reply, error)

func (*Batch) RequestType

func (b *Batch) RequestType() uint

type Delete

type Delete struct {
	Key    string
	Value1 string
	Value2 string
	// contains filtered or unexported fields
}

func NewDeleteRequest

func NewDeleteRequest(key, value1, value2 string) *Delete

func (*Delete) Reply

func (r *Delete) Reply(db *tiedb.Tree, key tiedb.CollectionKey) (Reply, error)

func (*Delete) RequestType

func (d *Delete) RequestType() uint

type Get

type Get struct {
	Values          []string
	NextLevelValues []string
	Filter          string
	MaxAssociations int
	// contains filtered or unexported fields
}

func NewGetRequest

func NewGetRequest(keys []string) *Get

func (*Get) Reply

func (r *Get) Reply(db *tiedb.Tree, key tiedb.CollectionKey) (Reply, error)

func (*Get) RequestType

func (g *Get) RequestType() uint

type Reply

type Reply struct {
	RequestString    string
	ReplyType        uint
	ReplyStruct      interface{}
	ReplyRawResponse json.RawMessage
}

func CreateReply

func CreateReply(requestType uint) Reply

func (*Reply) DataBatch

func (r *Reply) DataBatch() *ReplyBatch

func (*Reply) DataGet

func (r *Reply) DataGet() *[]ReplyGet

func (*Reply) DataStatus

func (r *Reply) DataStatus() *ReplyStatus

type ReplyBatch

type ReplyBatch struct {
	Add    []ReplyStatus
	Get    [][]*tiedb.StringSliceSet
	Delete []ReplyStatus
	Update []ReplyStatus
}

type ReplyGet

type ReplyGet struct {
	Item   string
	Key    []string
	Value1 []string
	Value2 []string
}

type ReplyGetSlice

type ReplyGetSlice []struct {
	Result []ReplyGet
}

type ReplyStatus

type ReplyStatus struct {
	Success    bool
	Message    string
	OrigKey    string
	OrigValue1 string
	OrigValue2 string
}

type Request

type Request interface {
	Reply(*tiedb.Tree, tiedb.CollectionKey) (Reply, error)
	RequestType() uint
}

type Update

type Update struct {
	Key          string
	Value1       string
	Value2       string
	NewValue2    string
	AddOnFailure bool
	// contains filtered or unexported fields
}

func NewUpdateRequest

func NewUpdateRequest() *Update

func (*Update) Reply

func (r *Update) Reply(db *tiedb.Tree, key tiedb.CollectionKey) (Reply, error)

func (*Update) RequestType

func (u *Update) RequestType() uint

Jump to

Keyboard shortcuts

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