Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrSubsequenceNotFound is returned by Check on a failure. ErrSubsequenceNotFound = errors.New("subsequence doesn't appear in the DNA sequence") // ErrBadAuth is returned if a user validation check fails. ErrBadAuth = errors.New("bad auth") // ErrInvalidSequence is returned if an invalid sequence is added. ErrInvalidSequence = errors.New("invalid DNA sequence") )
View Source
var ErrInvalidUser = errors.New("invalid user")
ErrInvalidUser is returned when an invalid user is passed to Select.
Functions ¶
This section is empty.
Types ¶
type DefaultService ¶
type DefaultService struct {
// contains filtered or unexported fields
}
DefaultService provides our DNA sequence business logic.
func NewDefaultService ¶
func NewDefaultService(r Repository, v Validator) *DefaultService
NewDefaultService returns a usable service, wrapping a repository.
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer wraps a Service and implements http.Handler.
func NewHTTPServer ¶
func NewHTTPServer(service Service) *HTTPServer
NewHTTPServer returns an HTTPServer wrapping the Service.
func (*HTTPServer) ServeHTTP ¶
func (s *HTTPServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler.
type Repository ¶
type Repository interface { Insert(ctx context.Context, user, sequence string) error Select(ctx context.Context, user string) (sequence string, err error) }
Repository is a client-side interface, which models the concrete e.g. SQLiteRepository.
type SQLiteRepository ¶
type SQLiteRepository struct {
// contains filtered or unexported fields
}
SQLiteRepository for persistence of the DNA sequences.
func NewSQLiteRepository ¶
func NewSQLiteRepository(urn string) (*SQLiteRepository, error)
NewSQLiteRepository connects to the DB represented by URN.
Click to show internal directories.
Click to hide internal directories.