Documentation ¶
Index ¶
- Constants
- func Connect(uri, dbName string)
- func HealthCheckRecordCol() *mongo.Collection
- func MonitorCol() *mongo.Collection
- func NewObjectID() primitive.ObjectID
- func ObjectIDFromString(id string) (primitive.ObjectID, error)
- func RunTransaction(ctx *appcontext.AppContext, fn func(sessionContext mongo.SessionContext) error) error
- func UserCol() *mongo.Collection
- type HealthCheckRecord
- type HealthCheckRecordStatus
- type Monitor
- type MonitorMetadata
- type MonitorType
- type User
- type UserPlatform
- type UserSocialProviderInformation
Constants ¶
View Source
const ( MonitorInterval30Seconds = 30 MonitorInterval60Seconds = 60 )
Variables ¶
This section is empty.
Functions ¶
func HealthCheckRecordCol ¶
func HealthCheckRecordCol() *mongo.Collection
func MonitorCol ¶
func MonitorCol() *mongo.Collection
func NewObjectID ¶
func RunTransaction ¶
func RunTransaction(ctx *appcontext.AppContext, fn func(sessionContext mongo.SessionContext) error) error
RunTransaction ...
func UserCol ¶
func UserCol() *mongo.Collection
Types ¶
type HealthCheckRecord ¶
type HealthCheckRecord struct { ID primitive.ObjectID `bson:"_id"` Owner primitive.ObjectID `bson:"owner"` Type MonitorType `bson:"type"` Status HealthCheckRecordStatus `bson:"status"` Code string `bson:"code"` Target string `bson:"target"` Description string `bson:"description"` ResponseTimeInMs int64 `bson:"responseTimeInMs"` CreatedAt time.Time `bson:"createdAt"` }
type HealthCheckRecordStatus ¶
type HealthCheckRecordStatus string
const ( HealthCheckRecordStatusUp HealthCheckRecordStatus = "up" HealthCheckRecordStatusDown HealthCheckRecordStatus = "down" )
type Monitor ¶
type Monitor struct { ID primitive.ObjectID `bson:"_id"` Owner primitive.ObjectID `bson:"owner"` // main factor Code string `bson:"code"` Type MonitorType `bson:"type"` Target string `bson:"target"` Data MonitorMetadata `bson:"data"` Interval int `bson:"interval"` CreatedAt time.Time `bson:"createdAt"` }
type MonitorMetadata ¶
type MonitorMetadata struct {
Scheme string `bson:"scheme,omitempty"`
}
type MonitorType ¶
type MonitorType string
const ( MonitorTypeDomain MonitorType = "domain" MonitorTypeHTTP MonitorType = "http" MonitorTypeTCP MonitorType = "tcp" MonitorTypeICMP MonitorType = "icmp" )
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id"` Name string `bson:"name"` Username string `bson:"username"` Avatar string `bson:"avatar"` Google *UserSocialProviderInformation `bson:"google"` GitHub *UserSocialProviderInformation `bson:"github"` Telegram *UserPlatform `bson:"telegram"` Slack *UserPlatform `bson:"slack"` Discord *UserPlatform `bson:"discord"` CreatedAt time.Time `bson:"createdAt"` }
type UserPlatform ¶
Click to show internal directories.
Click to hide internal directories.