types

package
v1.0.61 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MemberStatusRejected  = 0
	MemberStatusApproved  = 1
	MemberStatusInvited   = 2
	MemberStatusRequested = 3
)
View Source
const (
	DashboardSystemId = 1
	DashboardDemoId   = 2
)
View Source
const (
	RoleAdmin  = 1
	RoleUser   = 2
	RoleViewer = 3
	RoleDemo   = 4
)
View Source
const (
	UserLogrId = 1
	UserDemoId = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	Id                int    `json:"id"`
	Role              int    `json:"role"`
	GihubId           int64  `json:"github_id"`
	Username          string `json:"username"`
	AccessToken       string `json:"access_token,omitempty"`
	AccessTokenCipher string `json:"access_token_cipher"`
	jwt.RegisteredClaims
}

func (*Claims) DecryptAccessToken

func (claims *Claims) DecryptAccessToken(secret string) error

func (*Claims) EncryptAccessToken

func (claims *Claims) EncryptAccessToken(secret string) error

func (*Claims) ParseWithClaims added in v1.0.24

func (claims *Claims) ParseWithClaims(token string, secret string) (*jwt.Token, error)

type CountVector added in v1.0.9

type CountVector _types.Count

func (*CountVector) AsVector added in v1.0.9

func (c *CountVector) AsVector() []interface{}

type Counts

type Counts []*_types.Count

func (Counts) Format

func (cs Counts) Format() Series

type DashKey

type DashKey struct {
	Id         int    `db:"id"          json:"id"`
	DashId     int    `db:"dash_id"     json:"dash_id"`
	Name       string `db:"name"        json:"name"`
	PublicKey  string `db:"public_key"  json:"public_key"`
	PrivateKey string `db:"private_key" json:"private_key"`
}

type DashKeys

type DashKeys []*DashKey

type DashMember

type DashMember struct {
	Id     int   `db:"id"      json:"id"`
	DashId int   `db:"dash_id" json:"dash_id"`
	UserId int   `db:"user_id" json:"user_id"`
	Status int   `db:"status"  json:"status"`
	User   *User `json:"user"`
}

type DashMembers

type DashMembers []*DashMember

func (DashMembers) ApprovedOnly

func (dm DashMembers) ApprovedOnly() DashMembers

func (DashMembers) ByDashId

func (ds DashMembers) ByDashId() map[int]*DashMember

func (DashMembers) ByUserId

func (ds DashMembers) ByUserId() map[int]*DashMember

func (DashMembers) DashIds

func (dm DashMembers) DashIds() []int

func (DashMembers) HasDash

func (ds DashMembers) HasDash(dashId int) *DashMember

func (DashMembers) HasUser

func (ds DashMembers) HasUser(userId int) *DashMember

type DashStatRow

type DashStatRow struct {
	DashId   int    `db:"dash_id"  json:"dash_id,omitempty"`
	Hostname string `db:"hostname" json:"hostname,omitempty"`
	Logname  string `db:"logname"  json:"logname"`
	Level    string `db:"level"    json:"level,omitempty"`
	Version  string `db:"version"  json:"version,omitempty"`
	Cnt      int    `db:"cnt"      json:"cnt"`
	Updated  int64  `db:"updated"  json:"updated,omitempty"`
	Message  string `db:"message"  json:"message,omitempty"`
}

type DashStatRows

type DashStatRows []*DashStatRow

type Dashboard

type Dashboard struct {
	Id      int         `db:"id"          json:"id"`
	OwnerId int         `db:"owner_id"    json:"owner_id"`
	Name    string      `db:"name"        json:"name"`
	Keys    DashKeys    `json:"keys"`
	Members DashMembers `json:"members"`
	Owner   *User       `json:"owner"`
}

type Dashboards

type Dashboards []*Dashboard

func (Dashboards) ByPrimary

func (ds Dashboards) ByPrimary() map[int]*Dashboard

func (Dashboards) Ids

func (ds Dashboards) Ids() []int

type Filter

type Filter struct {
	DashId    int      `json:"dash_id"`
	Hostname  string   `json:"hostname"`
	Logname   string   `json:"logname"`
	Level     string   `json:"level"`
	Pid       int      `json:"pid"`
	Version   string   `json:"version"`
	Message   string   `json:"message"`
	Timestamp [2]int64 `json:"timestamp"`
	Pattern   string   `json:"pattern"`
	Offset    int64    `json:"offset"`
	Limit     int      `json:"limit"`
	Keyname   string   `json:"keyname"`
}

func (*Filter) Match

func (f *Filter) Match(log *_types.Log) bool

func (*Filter) ToSql

func (f *Filter) ToSql() (string, []interface{}, error)

type LogPackageJoiner added in v1.0.6

type LogPackageJoiner struct {
	sync.RWMutex
	Data map[string]LogPackageRow
}

func (*LogPackageJoiner) Add added in v1.0.6

func (m *LogPackageJoiner) Add(lp *_types.LogPackage, tries int) (complete bool, joined *_types.LogPackage)

func (*LogPackageJoiner) Drop added in v1.0.6

func (m *LogPackageJoiner) Drop(uid string)

type LogPackageRow added in v1.0.6

type LogPackageRow []*_types.LogPackage

func (LogPackageRow) Joined added in v1.0.6

func (row LogPackageRow) Joined() (complete bool, joined *_types.LogPackage)

type Serie

type Serie struct {
	Hostname string           `json:"hostname"`
	Keyname  string           `json:"keyname"`
	Kind     string           `json:"kind"`
	Data     [][2]interface{} `json:"data"`
}

type Series

type Series []*Serie

type Sock

type Sock struct {
	sync.RWMutex
	SockId          string         `json:"sock_id"`
	Listeners       map[string]int `json:"listeners"`
	Paused          bool           `json:"paused"`
	*User           `json:"user"`
	*Filter         `json:"filter"`
	*Claims         `json:"claims"`
	*websocket.Conn `json:"conn"` // TODO interface
}

func (*Sock) AddListener

func (s *Sock) AddListener(path string)

func (*Sock) GetFilter added in v1.0.24

func (s *Sock) GetFilter() *Filter

func (*Sock) HasListener added in v1.0.24

func (s *Sock) HasListener(path string) bool

func (*Sock) IsExpired added in v1.0.24

func (s *Sock) IsExpired() bool

func (*Sock) IsPaused added in v1.0.24

func (s *Sock) IsPaused() bool

func (*Sock) RemoveListener

func (s *Sock) RemoveListener(path string)

func (*Sock) SendLog

func (s *Sock) SendLog(lg *_types.Log) error

func (*Sock) SetFilter

func (s *Sock) SetFilter(f *Filter)

func (*Sock) SetPaused

func (s *Sock) SetPaused(state bool)

type SockCMap added in v1.0.23

type SockCMap struct {
	// contains filtered or unexported fields
}

func (*SockCMap) Add added in v1.0.23

func (sm *SockCMap) Add(s *Sock)

func (*SockCMap) Delete added in v1.0.23

func (sm *SockCMap) Delete(userId int, sockId string) bool

func (*SockCMap) GetSock added in v1.0.23

func (sm *SockCMap) GetSock(userId int, sockId string) *Sock

func (*SockCMap) GetSocks added in v1.0.23

func (sm *SockCMap) GetSocks(userId int) *cmap.ConcurrentMap[string, *Sock]

func (SockCMap) Init added in v1.0.23

func (sm SockCMap) Init() *SockCMap

func (*SockCMap) PushLog added in v1.0.23

func (sm *SockCMap) PushLog(lg *_types.Log) int

func (*SockCMap) SetFilter added in v1.0.23

func (sm *SockCMap) SetFilter(userId int, sockId string, filter *Filter) bool

func (*SockCMap) SetPaused added in v1.0.23

func (sm *SockCMap) SetPaused(userId int, sockId string, state bool) bool

func (*SockCMap) String added in v1.0.23

func (sm *SockCMap) String() string

type SockMessage

type SockMessage struct {
	Action  string      `json:"action,omitempty"`
	Path    string      `json:"path"`
	Payload interface{} `json:"payload"`
}

type States

type States struct {
	// contains filtered or unexported fields
}

func (States) Init added in v1.0.24

func (s States) Init() *States

func (*States) Pop added in v1.0.24

func (s *States) Pop(state string) (string, bool)

func (*States) Push added in v1.0.24

func (s *States) Push(v string) string

func (*States) Set

func (s *States) Set(k string, v string)

type UID added in v1.0.23

type UID int

func (UID) String added in v1.0.23

func (id UID) String() string

type User

type User struct {
	Id        int        `db:"id"         json:"id"`
	GithubId  int64      `db:"github_id"  json:"github_id"`
	Username  string     `db:"username"   json:"username"`
	Role      int        `db:"role"       json:"role"`
	LoginAt   *time.Time `db:"login_at"   json:"login_at"`
	CreatedAt *time.Time `db:"created_at" json:"created_at"`
}

type Users

type Users []*User

Jump to

Keyboard shortcuts

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