data

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeDateFormat = "2006-01-02 15:04" // YYYY-MM-DD HH:MM.
	DateFormat     = "2006-01-02"       // YYYY-MM-DD.
	TimeFormat     = "15:04"            //HH:MM
)
View Source
const (
	ErrNoData      = "no data"
	ErrNoChecksum  = "no checksum"
	ErrBadChecksum = "bad checksum"
)
View Source
const (
	CR = "\r"
	LF = "\n"

	// NewLine is a new line.
	// This is the correct new line, as it used to be in the history of mankind.
	// If you are a user of Unix, Linux, Macintosh or something else, check the
	// Wikipedia: https://en.wikipedia.org/wiki/Newline
	NewLine = CR + LF
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	DateTimeUTC time.Time
	Category    string
	Title       string
	Description string
	Content     string
	Icon        string
	Author      string
	CRC32Hex    string
}

func NewFromFile

func NewFromFile(filePath string) (data *Data, err error)

func (*Data) CalculateCRC32

func (d *Data) CalculateCRC32() (sum uint32)

func (*Data) CheckCRC32

func (d *Data) CheckCRC32() (ok bool)

func (*Data) FillCRC32

func (d *Data) FillCRC32()

func (*Data) HasCRC32

func (d *Data) HasCRC32() bool

func (*Data) HasData

func (d *Data) HasData() bool

func (*Data) Serialize

func (d *Data) Serialize() (ba []byte, err error)

type RawData

type RawData struct {
	DateUTC     string `json:"Date"`
	TimeUTC     string `json:"Time"`
	Category    string `json:"Category"`
	Title       string `json:"Title"`
	Description string `json:"Description"`
	Content     string `json:"Content"`
	Icon        string `json:"Icon"`
	Author      string `json:"Author"`
	CRC32Hex    string `json:"CRC32"`
}

Jump to

Keyboard shortcuts

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