Documentation ¶
Index ¶
- func Handle(server *Server, conn net.Conn)
- func WriteCode(session *Session, code int, message string)
- func WriteTextBlock(session *Session, stream string)
- type Command
- type Database
- type Definition
- type Server
- func (this *Server) Define(database string, query string) ([]*Definition, error)
- func (this *Server) GetDatabase(name string) Database
- func (this *Server) GetHandler(command *Command) func(*Session, Command)
- func (this *Server) Match(database string, query string, strat string) ([]*Definition, error)
- func (this *Server) RegisterDatabase(database Database, name string, all bool)
- func (this *Server) RegisterHandler(name string, handler func(*Session, Command))
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handle ¶
Given a `dict.Server` and a `net.Conn`, do a bringup, and run the * `ReadLine` loop, dispatching commands to the correct internals.
func WriteTextBlock ¶
Helper for commands to write out a text block
Types ¶
type Database ¶
type Database interface { /* Method to handle incoming `MATCH` commands. */ Match(name string, query string, strat string) []*Definition /* Method to handle incoming `DEFINE` commands. */ Define(name string, query string) []*Definition /* Method to handle incoming `SHOW INFO` commands. */ Info(name string) string /* Method to return a one-line Description of the Database. */ Description(name string) string /* Get a list of valid Match Strategies. */ Strategies(name string) map[string]string }
Database is an interface for external Database "Backends" to implement.
type Definition ¶
type Definition struct { Word string Definition string DictDatabase Database DictDatabaseName string }
Definition is the encapsulation of a response for a given Entry.
type Server ¶
Server encapsulation. * * This contains a bundle of useful helpers, as well as a few data structures * to handle registered Databases and Commands.
func (*Server) Define ¶
func (this *Server) Define( database string, query string, ) ([]*Definition, error)
Define a word against the server, according to fun rules!
func (*Server) GetDatabase ¶
Get dict.Database that has been registered under `name`.
func (*Server) GetHandler ¶
Get a Command handler for the given dict.Command `command`
func (*Server) RegisterDatabase ¶
Register dict.Database `database` under `name`.