dbdiff

package
v0.0.0-...-10f18be Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadOp = errors.New("unrecognised operation")

ErrBadOp is an error returned when the operation is not recognised

View Source
var ErrShortInput = errors.New("input too short")

ErrShortInput is an error returned when the input data is too short

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Op      Op                  // the operation
	Bytes   []byte              // argument of the operation - accessible via Arg() or Bytes()
	Records []dnsdata.MapRecord // vector of map records
}

func (*Entry) Arg

func (d *Entry) Arg() string

Arg returns the operation argument (the line without the leading "+" or "-")

func (*Entry) Convert

func (d *Entry) Convert(codec *dnsdata.Codec) error

func (*Entry) Parse

func (d *Entry) Parse(s string) error

Parse analyzes the provided input which must be a single entry (line) of a diff, and populates Op and Bytes fields accordingly. It may return ErrShortInput or ErrBadOp if the input is incomplete or isn't recognised.

func (*Entry) ParseBytes

func (d *Entry) ParseBytes(b []byte) error

ParseBytes does the same as Parse() but takes in the []byte type.

func (*Entry) SetArg

func (d *Entry) SetArg(s string)

SetArg replaces the operation argument

func (*Entry) String

func (d *Entry) String() string

String is a reverse of Parse()

type Op

type Op string

Op represents one of the available diff operations, "+" and "-".

const (
	// AddOp is the operator to add
	AddOp Op = "+"
	// DelOp is the operator to delete
	DelOp Op = "-"
)

func (Op) Valid

func (op Op) Valid() bool

Valid returns whether the op is one of the permitted operations

Jump to

Keyboard shortcuts

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