parser

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultSerializer = "json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type JsonParser added in v1.2.0

type JsonParser struct {
}

func (*JsonParser) Decode added in v1.2.0

func (j *JsonParser) Decode(bytes []byte) (*undo.BranchUndoLog, error)

Decode byte array to branch undo log. param bytes the byte array return the branch undo log

func (*JsonParser) Encode added in v1.2.0

func (j *JsonParser) Encode(branchUndoLog *undo.BranchUndoLog) ([]byte, error)

Encode branch undo log to byte array. param branchUndoLog the branch undo log return the byte array

func (*JsonParser) GetDefaultContent added in v1.2.0

func (j *JsonParser) GetDefaultContent() []byte

Get default context of this parser return the default content if undo log is empty

func (*JsonParser) GetName added in v1.2.0

func (j *JsonParser) GetName() string

Get the name of parser; return the name of parser

type UndoLogParser

type UndoLogParser interface {

	// Get the name of parser;
	// return the name of parser
	GetName() string

	// Get default context of this parser
	// return the default content if undo log is empty
	GetDefaultContent() []byte

	// Encode branch undo log to byte array.
	// param branchUndoLog the branch undo log
	// return the byte array
	Encode(branchUndoLog *undo.BranchUndoLog) ([]byte, error)

	// Decode byte array to branch undo log.
	// param bytes the byte array
	// return the branch undo log
	Decode(bytes []byte) (*undo.BranchUndoLog, error)
}

The interface Undo log parser.

type UndoLogParserCache

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

The type Undo log parser factory.

func GetCache

func GetCache() *UndoLogParserCache

func (*UndoLogParserCache) GetDefault

func (ulpc *UndoLogParserCache) GetDefault() (UndoLogParser, error)

Gets default UndoLogParser instance. return the instance

func (*UndoLogParserCache) Load

func (ulpc *UndoLogParserCache) Load(name string) (UndoLogParser, error)

Gets UndoLogParser by name param name parser name return the UndoLogParser

Jump to

Keyboard shortcuts

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