utils

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinOps

func JoinOps(ops []Op, delim string) string

JoinOps joins the ops with the given delimiter.

func JsonMarshalToBuffer

func JsonMarshalToBuffer(p interface{}) (*bytes.Buffer, error)

Types

type Common

type Common Equiv

Common represents a shared equiv.

func (Common) String

func (op Common) String() string

String returns the pretiffied edit string representation.

type CommonLine

type CommonLine string

CommonLine represents a shared line.

func (CommonLine) String

func (op CommonLine) String() string

String returns the pretiffied edit string representation.

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context represents a diff context.

func NewContext

func NewContext(a, b []rune) *Context

NewContext returns a new Context.

type Delete

type Delete Equiv

Delete represents an delete operation.

func (Delete) String

func (op Delete) String() string

String returns the pretiffied edit string representation.

type DeleteLine

type DeleteLine string

DeleteLine represents a line delete operation.

func (DeleteLine) String

func (op DeleteLine) String() string

String returns the pretiffied edit string representation.

type Equiv

type Equiv = rune

Equiv represents a line equivalence value.

type Insert

type Insert Equiv

Insert represents an insert operation.

func (Insert) String

func (op Insert) String() string

String returns the pretiffied edit string representation.

type InsertLine

type InsertLine string

InsertLine represents a line insert operation.

func (InsertLine) String

func (op InsertLine) String() string

String returns the pretiffied edit string representation.

type Op

type Op interface {
	String() string
}

Op represents an edit operation.

func Diff

func Diff(s, t string) []Op

Diff returns the shortest edit sequence of two strings.

func LineDiff

func LineDiff(s, t string) []Op

LineDiff returns the line diff of the two strings.

func ObjDiff

func ObjDiff(a, b interface{}) []Op

ObjDiff returns the line diff of two objects serialized by YAML.

func ReaderDiff

func ReaderDiff(a, b io.Reader) []Op

ReaderDiff returns the line diff of two io.Reader contents.

type Point

type Point struct {
	X, Y int
}

Point represents a point in the edit graph.

type Route

type Route struct {
	X, Y, R int
}

Route represents a point in the edit graph with an associated route.

Jump to

Keyboard shortcuts

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