diffstore

package module
v0.0.0-...-4023fd9 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2019 License: MIT Imports: 5 Imported by: 4

README

GoDoc Go Report Card License MIT License

DiffStore

GoLang struct for storing text changes

Documentation

https://godoc.org/github.com/sjsafranek/DiffStore

ToDo

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiffStore

type DiffStore struct {
	CurrentValue string   `json:"value"`
	Diffs        []string `json:"diffs"`

	CreateAt time.Time `json:"create_at"`
	UpdateAt time.Time `json:"update_at"`
	// contains filtered or unexported fields
}

DiffStore struct for storing diff data

func New

func New() DiffStore

NewDiffStore creates and returns DiffStore struct

func (*DiffStore) Decode

func (self *DiffStore) Decode(data []byte) error

Decode unmarshals struct from json.

func (*DiffStore) Encode

func (self *DiffStore) Encode() ([]byte, error)

Encode marshals struct into json.

func (*DiffStore) GetCurrent

func (self *DiffStore) GetCurrent() string

GetCurrent returns current text value.

func (*DiffStore) GetPreviousByIndex

func (self *DiffStore) GetPreviousByIndex(idx int) (string, error)

GetPreviousByIndex builds and returns previous text value by update index

func (*DiffStore) Length

func (self *DiffStore) Length() int

Length returns length of text updates

func (*DiffStore) Update

func (self *DiffStore) Update(newText string)

Update adds new text change.

Jump to

Keyboard shortcuts

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