Documentation
¶
Overview ¶
Package models provides domain entities.
Package models provides domain entities.
Index ¶
- Constants
- type Audit
- type Clone
- type CommandResult
- type IncomingMessage
- type Message
- func (m *Message) AppendText(text string)
- func (m *Message) IsPublished() bool
- func (m *Message) SetMessageType(messageType int)
- func (m *Message) SetNotifyAt(notificationTimeout time.Duration) error
- func (m *Message) SetStatus(status MessageStatus)
- func (m *Message) SetText(text string)
- func (m *Message) SetUserID(userID string)
- type MessageStatus
- type RunRequest
- type RunResponse
- type UserInfo
Constants ¶
const ( MessageTypeDefault = iota MessageTypeThread MessageTypeEphemeral )
Message types of published messages.
const ( StatusRunning = "running" StatusError = "error" StatusOK = "ok" )
Message status.
const ChatAppendSeparator = "\n\n"
ChatAppendSeparator separates appended part of a message.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Audit ¶
type Audit struct { ID string `json:"id"` Name string `json:"name"` RealName string `json:"realName"` Command string `json:"command"` Query string `json:"query"` }
Audit represents audit log actions.
type Clone ¶
type Clone struct { Name string Host string Port string Username string Password string SSLMode string }
Clone contains connection info of a clone.
func (Clone) ConnectionString ¶
type CommandResult ¶
type CommandResult struct { SessionID string `json:"session_id"` Command string `json:"command"` Query string `json:"query"` PlanText string `json:"plan_text"` PlanExecutionText string `json:"plan_execution_text"` Error string `json:"error"` CreatedAt string `json:"created_at"` Response string `json:"response"` PlanJSON string `json:"plan_json"` PlanExecutionJSON string `json:"plan_execution_json"` QueryLocks string `json:"query_locks"` }
CommandResult represents the result of the running command.
type IncomingMessage ¶
type IncomingMessage struct { SubType string Text string SnippetURL string ChannelID string ChannelType string UserID string Timestamp string ThreadID string CommandID string SessionID string Direct bool }
IncomingMessage defines a standard representation of incoming events.
type Message ¶
type Message struct { MessageID string CommandID string SessionID string MessageType int Status MessageStatus ChannelID string ThreadID string UserID string Text string CreatedAt time.Time NotifyAt time.Time }
Message struct defines an output message.
func NewMessage ¶
func NewMessage(incomingMessage IncomingMessage) *Message
NewMessage creates a new message.
func (*Message) AppendText ¶
AppendText appends a new string to the current text throw a chat append separator.
func (*Message) IsPublished ¶
IsPublished checks if the message is already published.
func (*Message) SetMessageType ¶
SetMessageType sets a message type.
func (*Message) SetNotifyAt ¶
SetNotifyAt sets timestamp to notify a user about the finish of a long query.
func (*Message) SetStatus ¶
func (m *Message) SetStatus(status MessageStatus)
SetStatus sets message status.
type RunRequest ¶
type RunRequest struct { DBLabServer string `json:"dblab_server"` Port int `json:"port"` User string `json:"user"` Password string `json:"password"` SSLMode string `json:"ssl_mode"` DBName string `json:"db_name"` Command string `json:"command"` Query string `json:"query"` SessionID string `json:"session_id"` }
RunRequest represents run requests.
type RunResponse ¶
type RunResponse struct { SessionID string `json:"session_id"` CommandID string `json:"command_id"` CommandLink string `json:"command_link"` }
RunResponse represents run response.