json

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Overview

Package json provides the JSON document implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	*crdt.Array
	// contains filtered or unexported fields
}

Array represents an array in the document. As a proxy for the CRDT array, it is used when the user manipulate the array from the outside.

func NewArray

func NewArray(ctx *change.Context, array *crdt.Array) *Array

NewArray creates a new instance of Array.

func (*Array) AddBool added in v0.2.16

func (p *Array) AddBool(values ...bool) *Array

AddBool adds the given boolean at the last.

func (*Array) AddBytes added in v0.2.16

func (p *Array) AddBytes(values ...[]byte) *Array

AddBytes adds the given bytes at the last.

func (*Array) AddDate added in v0.2.16

func (p *Array) AddDate(values ...gotime.Time) *Array

AddDate adds the given date at the last.

func (*Array) AddDouble added in v0.2.16

func (p *Array) AddDouble(values ...float64) *Array

AddDouble adds the given double at the last.

func (*Array) AddInteger added in v0.2.16

func (p *Array) AddInteger(values ...int) *Array

AddInteger adds the given integer at the last.

func (*Array) AddLong added in v0.2.16

func (p *Array) AddLong(values ...int64) *Array

AddLong adds the given long at the last.

func (*Array) AddNewArray added in v0.2.16

func (p *Array) AddNewArray() *Array

AddNewArray adds a new array at the last.

func (*Array) AddNull added in v0.2.16

func (p *Array) AddNull() *Array

AddNull adds the null at the last.

func (*Array) AddString added in v0.2.16

func (p *Array) AddString(values ...string) *Array

AddString adds the given string at the last.

func (*Array) Delete

func (p *Array) Delete(idx int) crdt.Element

Delete deletes the element of the given index.

func (*Array) InsertIntegerAfter added in v0.2.16

func (p *Array) InsertIntegerAfter(index int, v int) *Array

InsertIntegerAfter inserts the given integer after the given previous element.

func (*Array) Len

func (p *Array) Len() int

Len returns length of this Array.

func (*Array) MoveBefore added in v0.2.16

func (p *Array) MoveBefore(nextCreatedAt, createdAt *time.Ticket)

MoveBefore moves the given element to its new position before the given next element.

type Counter

type Counter struct {
	*crdt.Counter
	// contains filtered or unexported fields
}

Counter represents a counter in the document. As a proxy for the CRDT counter, it is used when the user manipulates the counter from the outside.

func NewCounter

func NewCounter(ctx *change.Context, counter *crdt.Counter) *Counter

NewCounter create Counter instance.

func (*Counter) Increase

func (p *Counter) Increase(v interface{}) *Counter

Increase adds an increase operations. Only numeric types are allowed as operand values, excluding uint64 and uintptr.

type Object

type Object struct {
	*crdt.Object
	// contains filtered or unexported fields
}

Object represents an object in the document. As a proxy for the CRDT object, it is used when the user manipulates the object from the outside.

func NewObject

func NewObject(ctx *change.Context, root *crdt.Object) *Object

NewObject creates a new instance of Object.

func (*Object) Delete

func (p *Object) Delete(k string) crdt.Element

Delete deletes the value of the given key.

func (*Object) GetArray added in v0.2.16

func (p *Object) GetArray(k string) *Array

GetArray returns Array of the given key.

func (*Object) GetCounter added in v0.2.16

func (p *Object) GetCounter(k string) *Counter

GetCounter returns Counter of the given key.

func (*Object) GetObject added in v0.2.16

func (p *Object) GetObject(k string) *Object

GetObject returns Object of the given key.

func (*Object) GetText added in v0.2.16

func (p *Object) GetText(k string) *Text

GetText returns Text of the given key.

func (*Object) SetBool added in v0.2.16

func (p *Object) SetBool(k string, v bool) *Object

SetBool sets the given boolean for the given key.

func (*Object) SetBytes added in v0.2.16

func (p *Object) SetBytes(k string, v []byte) *Object

SetBytes sets the given bytes for the given key.

func (*Object) SetDate added in v0.2.16

func (p *Object) SetDate(k string, v gotime.Time) *Object

SetDate sets the given date for the given key.

func (*Object) SetDouble added in v0.2.16

func (p *Object) SetDouble(k string, v float64) *Object

SetDouble sets the given double for the given key.

func (*Object) SetInteger added in v0.2.16

func (p *Object) SetInteger(k string, v int) *Object

SetInteger sets the given integer for the given key.

func (*Object) SetLong added in v0.2.16

func (p *Object) SetLong(k string, v int64) *Object

SetLong sets the given long for the given key.

func (*Object) SetNewArray added in v0.2.16

func (p *Object) SetNewArray(k string) *Array

SetNewArray sets a new Array for the given key.

func (*Object) SetNewCounter added in v0.2.16

func (p *Object) SetNewCounter(k string, t crdt.CounterType, n interface{}) *Counter

SetNewCounter sets a new NewCounter for the given key.

func (*Object) SetNewObject added in v0.2.16

func (p *Object) SetNewObject(k string) *Object

SetNewObject sets a new Object for the given key.

func (*Object) SetNewText added in v0.2.16

func (p *Object) SetNewText(k string) *Text

SetNewText sets a new Text for the given key.

func (*Object) SetNull added in v0.2.16

func (p *Object) SetNull(k string) *Object

SetNull sets the null for the given key.

func (*Object) SetString added in v0.2.16

func (p *Object) SetString(k, v string) *Object

SetString sets the given string for the given key.

type Text

type Text struct {
	*crdt.Text
	// contains filtered or unexported fields
}

Text represents a text in the document. As a proxy for the CRDT text, it is used when the user manipulates the rich text from the outside.

func NewText

func NewText(ctx *change.Context, text *crdt.Text) *Text

NewText creates a new instance of Text.

func (*Text) Edit

func (p *Text) Edit(from, to int, content string, attributes ...map[string]string) *Text

Edit edits the given range with the given content and attributes.

func (*Text) Select

func (p *Text) Select(from, to int) *Text

Select stores that the given range has been selected.

func (*Text) Style added in v0.3.0

func (p *Text) Style(from, to int, attributes map[string]string) *Text

Style applies the style of the given range.

Jump to

Keyboard shortcuts

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