types

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 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 (
	ProviderGithub = 1
	ProviderGoogle = 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.StandardClaims
}

func (*Claims) DecryptAccessToken

func (p *Claims) DecryptAccessToken() error

func (*Claims) EncryptAccessToken

func (p *Claims) EncryptAccessToken() error

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"`
}

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 (chunks LogPackageRow) Joined() (complete bool, joined *_types.LogPackage)

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"`
}

func (*Sock) AddListener

func (s *Sock) AddListener(path string)

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 SockMap

type SockMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*SockMap) Delete

func (sm *SockMap) Delete(userId int, uid string) bool

func (*SockMap) Get

func (sm *SockMap) Get(userId int, sockId string) *Sock

func (*SockMap) Info

func (sm *SockMap) Info() string

func (*SockMap) PushLog

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

func (*SockMap) Set

func (sm *SockMap) Set(s *Sock)

func (*SockMap) SetFilter

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

func (*SockMap) SetPaused

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

type SockMessage

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

type States

type States struct {
	Data map[string]string
	sync.Mutex
}

func (States) Get

func (s States) Get(state string) (string, bool)

func (States) Insert

func (s States) Insert(v string) string

func (States) Set

func (s States) Set(k string, v 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