filehandler

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

type Source struct{}

Source is the one and only implementation for SourceFormat interface It fully handles the handling to OS R/W operation

func (*Source) GenerateDirectory

func (source *Source) GenerateDirectory(dirname string) error

GenerateDirectory creates a directory with given `dirname` includes the src subfolder in it and generates dummy conf.yaml file

func (*Source) GenerateSrcfile

func (source *Source) GenerateSrcfile(filename string) error

GenerateSrcfile creates skeleton file that user can fill later with `up` and `down` queries

func (*Source) ReadConfigFile

func (source *Source) ReadConfigFile() (*schema.Conf, error)

ReadConfigFile reads conf.yaml file to get the database connection settings

func (*Source) ReadFromSrcDir

func (source *Source) ReadFromSrcDir() ([]string, error)

ReadFromSrcDir returns all sourcefile names in the src directory

func (*Source) ReadSrcfileContent

func (source *Source) ReadSrcfileContent(filename string) (*schema.Srcfile, error)

ReadSrcfileContent reads the yaml file specified by filename umarshal the yaml and returns the Srcfile structs taken from https://stackoverflow.com/questions/30947534/how-to-read-a-yaml-file

type SourceFormat

type SourceFormat interface {
	GenerateDirectory(dirname string) error
	GenerateSrcfile(filename string) error
	ReadSrcfileContent(filename string) (*schema.Srcfile, error)
	ReadFromSrcDir() ([]string, error)
	ReadConfigFile() (*schema.Conf, error)
}

SourceFormat is the main interface for OS R/W operation split into interface mainly for testing purpose

Jump to

Keyboard shortcuts

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