adapter

package
v0.0.0-...-c5e0fe0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdapterFile

type AdapterFile interface {
	FilePath() string
}

type File

type File struct {
	Parse   Parser   //ex json.Marshall
	Unparse Unparser //ex json.Unmarshall
}

func (*File) ParseAndSave

func (fa *File) ParseAndSave(f AdapterFile) error

It utilizes os.Create and file.Write methods. Any occuring error will be returned directly. Same goes for Parser errors.

func (*File) ReadAndParse

func (fa *File) ReadAndParse(f AdapterFile) error

It utilizes os.ReadFile method. Any error occurs will be returned untouched.

type FileAdapter

type FileAdapter interface {
	ParseAndSave(f AdapterFile) error
	ReadAndParse(f AdapterFile) error
}

type Parser

type Parser = func(v any) ([]byte, error)

type Unparser

type Unparser = func(data []byte, v any) error

Jump to

Keyboard shortcuts

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