util

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SiteStackOverflow = "stackoverflow"
	PerPageMax        = uint32(100)
)

Variables

This section is empty.

Functions

func APIErrorBody

func APIErrorBody(err error) []byte

func GetQuestionsAll

func GetQuestionsAll(apiClient *stackoverflow.APIClient, site string, opts *stackoverflow.GetQuestionsOpts) ([]stackoverflow.Question, error)

func QuestionsDedupe

func QuestionsDedupe(questions []stackoverflow.Question) []stackoverflow.Question

func QuestionsToDataSeries

func QuestionsToDataSeries(dataseriesName string, questions []stackoverflow.Question) timeseries.TimeSeries

func QuestionsToDataSeriesSet added in v0.1.1

func QuestionsToDataSeriesSet(dss timeseries.TimeSeriesSet, dataseriesName string, questions []stackoverflow.Question) timeseries.TimeSeriesSet

func ReadFileQuestions added in v0.1.1

func ReadFileQuestions(file string) ([]stackoverflow.Question, error)

func ReadFileQuestionsResponse added in v0.1.1

func ReadFileQuestionsResponse(file string) (stackoverflow.QuestionsResponse, error)

func UsersResponseFromFile

func UsersResponseFromFile(file string) (stackoverflow.UsersResponse, error)

UsersResponseFromFile reads afile into a `stackoverflow.UsersResponse` struct.

Types

type DayReputation

type DayReputation struct {
	Day             string
	DayReputation   int32
	TotalReputation int32
}

type History

type History struct {
	Items []stackexchange.ReputationHistory
}

func GetReputationHistoryAll

func GetReputationHistoryAll(apiClient *stackexchange.APIClient, site, userIds string) (History, error)

func (*History) DateForReputation

func (history *History) DateForReputation(rep int32) (DayReputation, error)

func (*History) ReputationChangeByDayMap

func (history *History) ReputationChangeByDayMap() map[string]int32

func (*History) ReputationChangeByDaySlice

func (history *History) ReputationChangeByDaySlice() []DayReputation

type UsersSet

type UsersSet struct {
	UsersMap map[string]stackoverflow.User `json:"users"`
}

func GetUsersMore

func GetUsersMore(apiClient *stackoverflow.APIClient, site string, opts *stackoverflow.GetUsersOpts, perPage, numPages uint32) (UsersSet, error)

func NewUsersSet

func NewUsersSet() UsersSet

func UsersResponseToUsersSet

func UsersResponseToUsersSet(ur *stackoverflow.UsersResponse) *UsersSet

func (*UsersSet) AddUser

func (us *UsersSet) AddUser(user stackoverflow.User)

func (*UsersSet) AddUsers

func (us *UsersSet) AddUsers(users []stackoverflow.User)

func (*UsersSet) AddUsersResponse

func (us *UsersSet) AddUsersResponse(ur *stackoverflow.UsersResponse)

func (*UsersSet) AddUsersResponseFile

func (us *UsersSet) AddUsersResponseFile(file string) error

func (*UsersSet) AddUsersResponseFiles

func (us *UsersSet) AddUsersResponseFiles(dir string, rx *regexp.Regexp) error

func (*UsersSet) Slice

func (us *UsersSet) Slice() []stackoverflow.User

func (*UsersSet) Table

func (us *UsersSet) Table(cols []string) *table.Table

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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