Documentation ¶
Index ¶
- Variables
- func Marshal(t Marshaler) ([]byte, error)
- func Unmarshal(b []byte, t Unmarshaler) error
- type AppendRequest
- type ConnectionString
- type ErrResponse
- type ListRequest
- type ListResponse
- type Marshaler
- type Message
- type OkResponse
- type QueryRequest
- type QueryResponse
- type Request
- type ResponseWriter
- type StatsRequest
- type StatsResponse
- type Unmarshaler
- type UseRequest
- type VersionRequest
- type VersionResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // CommandVersion sends the version of the fossil protocol supported to the server / client CommandVersion = "VERSION" // CommandList sets the current database context CommandList = "LIST" // CommandUse sets the current database context CommandUse = "USE" // CommandError sends an error code and a message to the client CommandError = "ERR" // CommandOk is used to respond to generic actions CommandOk = "OK" // CommandStats retrieves the current database stats CommandStats = "STATS" // CommandQuery executes a query on the current database CommandQuery = "QUERY" // CommandAppend appends data to the current database CommandAppend = "APPEND" )
View Source
var ( Version = "v1.0.0" MessageOk = NewMessageWithType(CommandOk, OkResponse{Code: 200, Message: "Ok"}) MessageOkDatabaseChanged = NewMessageWithType(CommandOk, OkResponse{Code: 201, Message: "database changed"}) MessageError = NewMessageWithType(CommandError, ErrResponse{Code: 500}) MessageErrorCommandNotFound = NewMessageWithType(CommandError, ErrResponse{Code: 501, Err: fmt.Errorf("command not found")}) MessageErrorMalformedMessage = NewMessageWithType(CommandError, ErrResponse{Code: 502, Err: fmt.Errorf("malformed message")}) MessageErrorUnmarshaling = NewMessageWithType(CommandError, ErrResponse{Code: 506, Err: fmt.Errorf("error unmarshaling")}) MessageErrorUnknownDb = NewMessageWithType(CommandList, ListRequest{}) MessageList = NewMessageWithType(CommandError, ErrResponse{Code: 505}) )
View Source
var Protocol = "fossil"
Functions ¶
func Unmarshal ¶
func Unmarshal(b []byte, t Unmarshaler) error
Types ¶
type AppendRequest ¶
type ConnectionString ¶
func ParseConnectionString ¶
func ParseConnectionString(connStr string) ConnectionString
ParseConnectionString takes a connection string and parses it into the parts the application needs to make a connection. This function will always parse, even horribly malformed connection strings. It will only panic if a protocol is specified and it is != 'fossil'. Format:
[fossil://]<host:port|local>[/<db_name>]
type ErrResponse ¶
type ListRequest ¶
type ListRequest struct { }
type ListResponse ¶
type ListResponse struct {
DatabaseList []string
}
type OkResponse ¶
type QueryRequest ¶
type QueryRequest struct {
Query string
}
type QueryResponse ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func NewRequest ¶
NewRequest creates a new request from the line message and the current client state
type ResponseWriter ¶
func (ResponseWriter) WriteMessage ¶
func (rw ResponseWriter) WriteMessage(t Marshaler) (int, error)
type StatsRequest ¶
type StatsRequest struct {
Database string
}
type StatsResponse ¶
type Unmarshaler ¶
type UseRequest ¶
type UseRequest struct {
DbName string
}
type VersionRequest ¶
type VersionRequest struct {
Version string
}
func (VersionRequest) Marshal ¶
func (v VersionRequest) Marshal() ([]byte, error)
Marshal a VersionRequest. We don't actually use the specified version, and instead rely on the Version variable above
type VersionResponse ¶
func (VersionResponse) Marshal ¶
func (v VersionResponse) Marshal() ([]byte, error)
Marshal a VersionResponse. As with VersionRequest, we override the version specified in the supplied VersionResponse.
func (*VersionResponse) Unmarshal ¶
func (v *VersionResponse) Unmarshal(b []byte) error
Unmarshal ...
Click to show internal directories.
Click to hide internal directories.