util

package
v0.0.0-...-87675f5 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FdatDir friends file directory
	FdatDir string = "fdat"
	// ImgDir avatar images directory
	ImgDir string = "img"
	// DatExt Init files extension
	DatExt string = ".dat"
	// FdatExt Fetch files extension
	FdatExt string = ".f"
	// QueryExt custom list or query result extension
	QueryExt string = ".qry" // previously .twt
	// GmlExt network graph extension
	GmlExt string = ".gml"
)

Variables

This section is empty.

Functions

func CSVReader

func CSVReader(handle string, ext string, data interface{}) error

CSVReader dynamic data loader Expect first row to contain struct field names preceded by comment hash '#'

func CSVWriter

func CSVWriter(handle string, ext string, appendFlag bool, data interface{}) (string, error)

CSVWriter dynamic data writer

func DaysSince

func DaysSince(d string) time.Duration

DaysSince returns elapsed time since date as string

func DigitsOnly

func DigitsOnly(s string) bool

DigitsOnly checks if sitrng s is a number

func DotNucollPath

func DotNucollPath() (string, error)

DotNucollPath returns the location of the configuration file with CGO_ENABLED=0 golang throws user: Current not implemented on linux/amd64 so we look for alternatives including $HOME and current directory

func DownloadImage

func DownloadImage(id uint64, url string) (string, error)

DownloadImage save avatar for user id

func Exists

func Exists(x string, a []string) bool

Exists checks if string x can be found in array a

func FdatExists

func FdatExists(handle string) bool

FdatExists if friends file found

func FdatWriter

func FdatWriter(handle string, ids []string) (string, error)

FdatWriter spills list of friends to disk

func GMLWriter

func GMLWriter(handles []string, data interface{}, includeMissingIDs bool, cols []string, label string) (string, error)

GMLWriter generates GML file for given array of handles using cols as node properties and sets label to given attribute spec from http://www.fim.uni-passau.de/fileadmin/files/lehrstuhl/brandenburg/projekte/gml/gml-technical-report.pdf

func GraphMLWriter

func GraphMLWriter(handles []string, data []types.UserObject, includeMissingIDs bool) (string, error)

GraphMLWriter save with GraphML

func QueryReader

func QueryReader(handle string, firstHandleOnly bool) ([]string, error)

QueryReader extracts twitter handles from query file

func WriteConfig

func WriteConfig(config *NucollConfig) error

WriteConfig to .nucoll file in home directory

Types

type NucollConfig

type NucollConfig struct {
	TwitterConfig
}

NucollConfig holds access details to all supported SNSes

func ReadConfig

func ReadConfig() (*NucollConfig, error)

ReadConfig from .nucoll in home directory

type TwitterConfig

type TwitterConfig struct {
	TokenType   string `json:"token_type"`
	AccessToken string `json:"access_token"`
}

TwitterConfig stores oauth2 client credential grants

Jump to

Keyboard shortcuts

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