model

package
v0.0.0-...-769d54b Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColID                = "Id"
	ColNextExecutionTime = "NextExecutionTime"
	ColLastExecutedAt    = "LastExecutedAt"
	ColDeletedAt         = "DeletedAt"
	ColCreatedAt         = "CreatedAt"
	ColCircleID          = "CircleId"
	ColName              = "Name"
	ColExecutionInterval = "ExecutionInterval"
	ColIsLocked          = "IsLocked"
)
View Source
const (
	TableJobs         = "Jobs"
	TableExecutedJobs = "ExecutedJobs"
	TableCircles      = "Circles"
	TableCircleData   = "CircleData"
)

Variables

View Source
var InitialJobs = []Job{
	{
		ID:   "1",
		Name: "Circle_Single",
		ExecutionInterval: Period{
			Count:    1,
			Timeunit: Hour,
		}.ToString(),
		NextExecutionTime: time.Now().Add(time.Hour),
		CreatedAt:         spanner.CommitTimestamp,
	},
}

Functions

This section is empty.

Types

type Circle

type Circle struct {
	CircleId  string           `spanner:"CircleId"`
	CreatedAt time.Time        `spanner:"CreatedAt"`
	DeletedAt spanner.NullTime `spanner:"DeletedAt"`
}

type CircleCountData

type CircleCountData struct {
	Count int64
	Time  time.Time
}

type CircleCountDataList

type CircleCountDataList []CircleCountData

func (CircleCountDataList) ToCircleCountDataProto

type CircleData

type CircleData struct {
	ID           string    `spanner:"Id"`
	CircleID     string    `spanner:"CircleId"`
	MembersCount int64     `spanner:"MembersCount"`
	ViewsCount   int64     `spanner:"ViewsCount"`
	PostsCount   int64     `spanner:"PostsCount"`
	CreatedAt    time.Time `spanner:"CreatedAt"`
}

func (CircleData) ToProto

func (c CircleData) ToProto() *analyticsV1.CircleData

type CircleDataSlice

type CircleDataSlice []CircleData

func (CircleDataSlice) ToProto

func (cds CircleDataSlice) ToProto() []*analyticsV1.CircleData

type Circles

type Circles []Circle

func (Circles) GetStringArray

func (c Circles) GetStringArray() []string

type CountData

type CountData struct {
	Count int64
	Time  time.Time
}

type CountDataArray

type CountDataArray []CountData

func (CountDataArray) SortByTimeAscending

func (c CountDataArray) SortByTimeAscending()

func (CountDataArray) ToCountDataHolderPB

func (c CountDataArray) ToCountDataHolderPB() []*analyticsV1.CountDataHolder

type ExecutedJob

type ExecutedJob struct {
	ExecutionID string    `spanner:"ExecutionId"`
	JobID       string    `spanner:"JobId"`
	ExecutedAt  time.Time `spanner:"ExecutedAt"`
}

type Job

type Job struct {
	ID                string           `spanner:"Id"`
	Name              string           `spanner:"Name"`
	ExecutionInterval string           `spanner:"ExecutionInterval"`
	LastExecutedAt    spanner.NullTime `spanner:"LastExecutedAt"`
	NextExecutionTime time.Time        `spanner:"NextExecutionTime"`
	IsLocked          bool             `spanner:"IsLocked"`
	CreatedAt         time.Time        `spanner:"CreatedAt"`
}

func (Job) GetColumNames

func (j Job) GetColumNames() []string

func (Job) GetNextExecutionTime

func (j Job) GetNextExecutionTime() (*time.Time, error)

type Name

type Name string
var (
	JobNameCircleSingle Name = "Circle_Single"
	JobNameCircleMany   Name = "Circle_Many"
)

type Period

type Period struct {
	Count    int16
	Timeunit Timeunit
}

func PeriodFromProto

func PeriodFromProto(p analyticsV1.Period) (*Period, error)

func PeriodFromString

func PeriodFromString(period string) (Period, error)

func (Period) GetTimeFromForQuerying

func (p Period) GetTimeFromForQuerying(isSubtract bool) time.Time

func (Period) ToDuration

func (p Period) ToDuration() time.Duration

func (Period) ToString

func (p Period) ToString() string

type Timeunit

type Timeunit string
const (
	Minute Timeunit = "minute"
	Hour   Timeunit = "hour"
	Day    Timeunit = "day"
	Week   Timeunit = "week"
	Month  Timeunit = "month"
)

Jump to

Keyboard shortcuts

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