delta

package module
v0.0.0-...-340ed97 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: Apache-2.0 Imports: 1 Imported by: 1

README

go-delta

An implementation of quill-delta in go

License

Copyright © 2019 Todd Kennedy, Apache-2.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeMap

type AttributeMap map[string]interface{}

AttributeMap is for storing attributes about the text

func (AttributeMap) Compose

func (am AttributeMap) Compose(a, b *AttributeMap, keepNil bool) AttributeMap

Compose two attribute maps into a single AttributeMap

func (AttributeMap) Diff

func (am AttributeMap) Diff(a, b *AttributeMap) AttributeMap

Diff two attribute maps, returning a list of items in b that don't match corresponding values in a (or don't exist in a)

func (AttributeMap) Invert

func (am AttributeMap) Invert(attr, base *AttributeMap) AttributeMap

Invert a AttributeMap against a base AttributeMap

func (AttributeMap) Transform

func (am AttributeMap) Transform(a, b *AttributeMap, priority bool) AttributeMap

Transform two attribute maps against each other

type Iterator

type Iterator struct {
	Ops    *[]Op
	Index  int
	Offset int
}

Iterator iterates!

func NewIterator

func NewIterator(ops *[]Op) Iterator

NewIterator creates a new iterator for use

func (*Iterator) HasNext

func (i *Iterator) HasNext() bool

HasNext determines if an iterator has a next operation

func (*Iterator) Peek

func (i *Iterator) Peek() Op

Peek returns the current operation

func (*Iterator) PeekLength

func (i *Iterator) PeekLength() int

PeekLength checks to see how long the current op is

func (*Iterator) PeekType

func (i *Iterator) PeekType() OperationType

PeekType shows you the next operation type

type Op

type Op struct {
	Insert     interface{}
	Retain     int
	Delete     int
	Attributes AttributeMap
}

Op are the currency of the delta format

func (*Op) Len

func (o *Op) Len() (int, error)

Len returns the length of the operation

type OperationType

type OperationType int

OperationType is the type of an operation

const (
	// Insert operation
	Insert OperationType = iota
	// Delete operation
	Delete
	// Retain operation
	Retain
	// NOOP operation
	NOOP
)

Directories

Path Synopsis
iterator module

Jump to

Keyboard shortcuts

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