file

package
v0.0.0-...-2892b5e Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package file GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CanTruncate

type CanTruncate interface {
	Truncate(size int64) error
}

type Ensure

type Ensure struct {
	task.Task
	// current workdir
	Cwd wd.WorkDir `json:"cwd"`
	// path to file
	Path string `json:"path"`
	// the existed file
	File File `json:"-" output:"file"`
}

Ensure to check path exists

func (*Ensure) Do

func (t *Ensure) Do(ctx context.Context) error

func (Ensure) RuntimeDoc

func (v Ensure) RuntimeDoc(names ...string) ([]string, bool)

type Exists

type Exists struct {
	task.Task

	// current workdir
	Cwd wd.WorkDir `json:"cwd"`
	// path
	Path string `json:"path"`

	Info Info `json:"-" output:"info"`
}

Exists to check path exists

func (*Exists) Do

func (t *Exists) Do(ctx context.Context) error

func (Exists) RuntimeDoc

func (v Exists) RuntimeDoc(names ...string) ([]string, bool)

type File

type File struct {
	// current work dir
	WorkDir wd.WorkDir `json:"wd"`
	// filename related from current work dir
	Filename string `json:"filename"`
}

func (File) RuntimeDoc

func (v File) RuntimeDoc(names ...string) ([]string, bool)

func (*File) Sync

func (f *File) Sync(ctx context.Context, wd pkgwd.WorkDir, filename string) error

func (*File) SyncWith

func (f *File) SyncWith(ctx context.Context, file File) error

type Info

type Info struct {
	IsDir bool   `json:"isDir,omitempty"`
	Mode  uint32 `json:"mode,omitempty"`
	Size  int64  `json:"size,omitempty"`
}

func (Info) RuntimeDoc

func (v Info) RuntimeDoc(names ...string) ([]string, bool)

type ReadAsString

type ReadAsString struct {
	task.Task
	// file
	File File `json:"file"`
	// text contents
	Contents string `json:"-" output:"contents"`
}

ReadAsString read file as string

func (*ReadAsString) Do

func (t *ReadAsString) Do(ctx context.Context) error

func (ReadAsString) RuntimeDoc

func (v ReadAsString) RuntimeDoc(names ...string) ([]string, bool)

type ReadAsTable

type ReadAsTable struct {
	task.Task
	// file
	File File `json:"file"`
	// options
	With ReadAsTableOption `json:"with,omitempty"`
	// file contents
	Data [][]string `json:"-" output:"data"`
}

ReadAsTable file read as table

func (*ReadAsTable) Do

func (t *ReadAsTable) Do(ctx context.Context) error

func (ReadAsTable) RuntimeDoc

func (v ReadAsTable) RuntimeDoc(names ...string) ([]string, bool)

type ReadAsTableOption

type ReadAsTableOption struct {
	// strict column num
	StrictColNum int `json:"strictColNum,omitempty"`
}

func (ReadAsTableOption) RuntimeDoc

func (v ReadAsTableOption) RuntimeDoc(names ...string) ([]string, bool)

type ReadFromJSON

type ReadFromJSON struct {
	task.Task

	// file
	File File `json:"file"`
	// data
	Data client.Any `json:"-" output:"data"`
}

ReadFromJSON read and parse json

func (*ReadFromJSON) Do

func (t *ReadFromJSON) Do(ctx context.Context) error

func (ReadFromJSON) RuntimeDoc

func (v ReadFromJSON) RuntimeDoc(names ...string) ([]string, bool)

type ReadFromTOML

type ReadFromTOML struct {
	task.Task

	// file
	File File `json:"file"`
	// options
	With ReadFromTOMLOption `json:"with"`
	// data
	Data client.Any `json:"-" output:"data"`
}

ReadFromTOML read and parse yaml

func (*ReadFromTOML) Do

func (t *ReadFromTOML) Do(ctx context.Context) error

func (ReadFromTOML) RuntimeDoc

func (v ReadFromTOML) RuntimeDoc(names ...string) ([]string, bool)

type ReadFromTOMLOption

type ReadFromTOMLOption struct {
	// read as list
	AsList bool `json:"asList,omitempty"`
}

func (ReadFromTOMLOption) RuntimeDoc

func (v ReadFromTOMLOption) RuntimeDoc(names ...string) ([]string, bool)

type ReadFromYAML

type ReadFromYAML struct {
	task.Task

	// file
	File File `json:"file"`
	// options
	With ReadFromYAMLOption `json:"with,omitempty"`
	// data
	Data client.Any `json:"-" output:"data"`
}

ReadFromYAML read and parse yaml

func (*ReadFromYAML) Do

func (t *ReadFromYAML) Do(ctx context.Context) error

func (ReadFromYAML) RuntimeDoc

func (v ReadFromYAML) RuntimeDoc(names ...string) ([]string, bool)

type ReadFromYAMLOption

type ReadFromYAMLOption struct {
	// read as list
	AsList bool `json:"asList,omitempty"`
}

func (ReadFromYAMLOption) RuntimeDoc

func (v ReadFromYAMLOption) RuntimeDoc(names ...string) ([]string, bool)

type Rel

type Rel struct {
	task.Task
	// current workdir
	BaseDir wd.WorkDir `json:"baseDir"`
	// src file
	TargetFile File `json:"targetFile"`
	// the converted file
	File File `json:"-" output:"file"`
}

Rel to check path exists

func (*Rel) Do

func (t *Rel) Do(ctx context.Context) error

func (Rel) RuntimeDoc

func (v Rel) RuntimeDoc(names ...string) ([]string, bool)

type StringOrFile

type StringOrFile struct {
	File   *File
	String string
}

func (StringOrFile) MarshalJSON

func (s StringOrFile) MarshalJSON() ([]byte, error)

func (StringOrFile) OneOf

func (StringOrFile) OneOf() []any

func (*StringOrFile) Open

func (s *StringOrFile) Open(ctx context.Context) (io.ReadCloser, error)

func (StringOrFile) RuntimeDoc

func (v StringOrFile) RuntimeDoc(names ...string) ([]string, bool)

func (*StringOrFile) Size

func (s *StringOrFile) Size(ctx context.Context) (int64, error)

func (*StringOrFile) UnmarshalJSON

func (s *StringOrFile) UnmarshalJSON(data []byte) error

type Sync

type Sync struct {
	task.Task
	// source file
	SrcFile File `json:"srcFile"`
	// sync option
	With SyncOption `json:"with,omitempty"`
	// dest fie
	OutFile File `json:"outFile"`
	// synced file same as dest
	File File `json:"-" output:"file"`
}

Sync file to contents

func (*Sync) Do

func (t *Sync) Do(ctx context.Context) error

func (Sync) RuntimeDoc

func (v Sync) RuntimeDoc(names ...string) ([]string, bool)

type SyncOption

type SyncOption struct {
	// once maxConcurrent larger than 1,
	// file will split to chunk for partially read and write when syncing
	MaxConcurrent int `json:"maxConcurrent" default:"16"`
}

func (SyncOption) RuntimeDoc

func (v SyncOption) RuntimeDoc(names ...string) ([]string, bool)

type Write

type Write struct {
	task.Task

	// output file
	OutFile File `json:"outFile"`
	// file contents
	Contents client.StringOrBytes `json:"contents"`
	// writen file
	File File `json:"-" output:"file"`
}

Write file with contents

func (*Write) Do

func (t *Write) Do(ctx context.Context) error

func (Write) RuntimeDoc

func (v Write) RuntimeDoc(names ...string) ([]string, bool)

type WriteAsJSON

type WriteAsJSON struct {
	task.Task
	// output file
	OutFile File `json:"outFile"`
	// data could convert to json
	Data client.Any `json:"data"`
	// writen file
	File File `json:"-" output:"file"`
}

WriteAsJSON read and parse json

func (*WriteAsJSON) Do

func (t *WriteAsJSON) Do(ctx context.Context) error

func (WriteAsJSON) RuntimeDoc

func (v WriteAsJSON) RuntimeDoc(names ...string) ([]string, bool)

type WriteAsTOML

type WriteAsTOML struct {
	task.Task

	// filename
	OutFile File `json:"outFile"`
	// data could convert to yaml
	Data client.Any `json:"data"`
	// writen file
	File File `json:"-" output:"file"`
}

WriteAsYAML read and parse yaml

func (*WriteAsTOML) Do

func (t *WriteAsTOML) Do(ctx context.Context) error

func (WriteAsTOML) RuntimeDoc

func (v WriteAsTOML) RuntimeDoc(names ...string) ([]string, bool)

type WriteAsYAML

type WriteAsYAML struct {
	task.Task

	// output file
	OutFile File `json:"outFile"`
	// options
	With WriteAsYAMLOption `json:"with,omitempty"`
	// data could convert to yaml
	Data client.Any `json:"data"`
	// writen file
	File File `json:"-" output:"file"`
}

WriteAsYAML read and parse yaml

func (*WriteAsYAML) Do

func (t *WriteAsYAML) Do(ctx context.Context) error

func (WriteAsYAML) RuntimeDoc

func (v WriteAsYAML) RuntimeDoc(names ...string) ([]string, bool)

type WriteAsYAMLOption

type WriteAsYAMLOption struct {
	// write as stream
	AsStream bool `json:"asStream,omitempty"`
}

func (WriteAsYAMLOption) RuntimeDoc

func (v WriteAsYAMLOption) RuntimeDoc(names ...string) ([]string, bool)

Jump to

Keyboard shortcuts

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