control

package
v0.0.0-...-7313383 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnmarshalRequired = &ErrorMatch{Code: 100, Message: "Unmarshal", Regexp: regexp.MustCompile(`^Required field '[^']+' is missing!`)}
	ErrUnmarshalBadline  = &ErrorMatch{Code: 101, Message: "Unmarshal", Regexp: regexp.MustCompile(`^Bad line: '`)}

	ErrMarshalUnknown = &ErrorMatch{Code: 200, Message: "Marshal"}

	ErrParseDepend = &ErrorMatch{Code: 300, Message: "Parse depend"}
)

错误匹配处理

Functions

func Marshal

func Marshal(ctl *Control) ([]byte, error)

Marshal 序列化

Types

type Control

type Control struct {
	BinaryParagraph *deb.Control
}

Control 操作文件

func Unmarshal

func Unmarshal(data []byte) (*Control, error)

Unmarshal 反序列化

func (*Control) DependAdd

func (ctl *Control) DependAdd(dependString string) error

DependAdd 添加包依赖

func (*Control) DependDelete

func (ctl *Control) DependDelete(dependString string) error

DependDelete 删除包依赖

type ErrorMatch

type ErrorMatch struct {
	Code    int
	Message string
	Regexp  *regexp.Regexp
}

func (*ErrorMatch) Error

func (em *ErrorMatch) Error() string

func (*ErrorMatch) Match

func (em *ErrorMatch) Match(value string) bool

func (*ErrorMatch) Wrap

func (em *ErrorMatch) Wrap(err error) error

Jump to

Keyboard shortcuts

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