common

package
v0.0.0-...-0bfa77c Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

* @Author: magsv * @Date: 2016-02-15 10:20:00 * @Last Modified by: magsv * @Last Modified time: 2018-11-08 12:04:15

Index

Constants

View Source
const NullFloatValue = -999.99
View Source
const Rolldays_default = -999
View Source
const Rollmonths_default = -999

Variables

This section is empty.

Functions

func AppendTimeAndDateToFile

func AppendTimeAndDateToFile(filepath string) string

appends a timestamp to a filename with the given filepath

func CreateAllFolders

func CreateAllFolders(path string) error

func CreateUUID

func CreateUUID() string

func CreateWorkbookFromDataSet

func CreateWorkbookFromDataSet(filepath string, datasets []DataSet, oneFilePerSheet bool, appendTimeInName bool) error

func DatasetToCsv

func DatasetToCsv(dataset DataSet, outputFile string, discriminator string) error

func DatasetsToCsv

func DatasetsToCsv(datasets []DataSet, outputFile string, discriminator string) error

func DatasetsToJson

func DatasetsToJson(datasets []DataSet) ([]byte, error)

Converts a list of datasets to json

func FormatTime2QueryDayString

func FormatTime2QueryDayString(tObj time.Time) string

function used to take a time object and format it to a string format in the form of yyyy-mm-dd

func FormatTime2QueryMonthString

func FormatTime2QueryMonthString(tObj time.Time) string

function used to take a time object and format it to a string format in the form of mm

func FormatTime2QueryYearString

func FormatTime2QueryYearString(tObj time.Time) string

function used to take a time object and format it to a string format in the form of yyyy

func GetFileName

func GetFileName(filePath string) string

func GetFileNameAndExtension

func GetFileNameAndExtension(filePath string) (string, string)

returns filename without extension and extension

func GetFilesWithExtension

func GetFilesWithExtension(folder string, extension string) ([]string, error)

func GetFolderPathForFile

func GetFolderPathForFile(filePath string) string

func GetTimeZone

func GetTimeZone(tObj *time.Time) string

func InitializeFolders

func InitializeFolders(outputFolder string, logFile string) error

func MoveFiles

func MoveFiles(files []string, move2Folder string) error

func ReadFile

func ReadFile(filePath string) ([]byte, error)

func RollDays

func RollDays(days int) (time.Time, time.Time)

function will take the current time and substract the given number of days and return a start and end time

func RollMonths

func RollMonths(months int) (time.Time, time.Time)

function will take the current time and substract the given number of month and return a start and end time

func TimeToString

func TimeToString(tObj time.Time, outputFormat string) string

func Write2File

func Write2File(filePath string, data []byte) error

func XSDDateString2Time

func XSDDateString2Time(dateString string) (time.Time, error)

func XSDDateTimeString2Time

func XSDDateTimeString2Time(dateTimeString string) (time.Time, error)

Types

type ColumnData

type ColumnData struct {
	IntVal        int       `json:",omitempty"`
	FloatVal      float64   `json:",omitempty"`
	StrVal        string    `json:",omitempty"`
	TimeValue     time.Time `json:",omitempty"`
	IsEmptyColumn bool      `json:",omitempty"`
	IsInt         bool      `json:",omitempty"`
	IsFloat       bool      `json:",omitempty"`
	IsStr         bool      `json:",omitempty"`
	IsTime        bool      `json:",omitempty"`
}

type ColumnDataJson

type ColumnDataJson struct {
	Name  string
	Value interface{}
}

type Config

type Config struct {
	ServerUrl       string
	User            string
	Password        string
	OutputFile      string
	SparqlQueryFile string
	Params          []ParamType
}

type DataSet

type DataSet struct {
	Name        string
	HeadersName []string
	Rows        []RowData
}

type DataSetJson

type DataSetJson struct {
	Name        string
	HeadersName []string
	Rows        []RowDataJson
}

type ParamType

type ParamType struct {
	Name  string
	Value string
}

type RowData

type RowData struct {
	Columns []ColumnData
}

func (*RowData) AddEmptyColumn

func (row *RowData) AddEmptyColumn()

func (*RowData) AddFloatValue

func (row *RowData) AddFloatValue(value float64)

func (*RowData) AddIntValue

func (row *RowData) AddIntValue(value int)

func (*RowData) AddStrValue

func (row *RowData) AddStrValue(value string)

func (*RowData) AddTimeValue

func (row *RowData) AddTimeValue(value time.Time)

type RowDataJson

type RowDataJson struct {
	Columns []ColumnDataJson
}

Jump to

Keyboard shortcuts

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