Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Core ¶
type Core struct { Log ILogger DB IDatabase Q IQuery Bind IBind Response IResponse Token IToken Password IPassword }
Core contains all the dependencies for the components.
type CoreMock ¶
type CoreMock struct { Log *testutil.MockLogger DB IDatabase Q IQuery Bind IBind Response IResponse Token *testutil.MockToken Password IPassword }
CoreMock contains all the mocked dependencies.
type IBind ¶
type IBind interface { FormUnmarshal(i interface{}, r *http.Request) (err error) Validate(s interface{}) error }
IBind provides bind and validation for requests.
type IDatabase ¶
type IDatabase interface { Exec(query string, args ...interface{}) (sql.Result, error) Get(dest interface{}, query string, args ...interface{}) error Select(dest interface{}, query string, args ...interface{}) error }
IDatabase provides data query capabilities.
type ILogger ¶
type ILogger interface { Fatalf(format string, v ...interface{}) Printf(format string, v ...interface{}) }
ILogger provides logging capabilities.
type IPassword ¶
type IPassword interface { HashString(password string) (string, error) MatchString(hash, password string) bool }
IPassword provides password hashing.
type IQuery ¶
type IQuery interface { FindOneByID(dest query.IRecord, ID string) (found bool, err error) FindAll(dest query.IRecord) (total int, err error) ExistsByID(db query.IRecord, s string) (found bool, err error) ExistsByField(db query.IRecord, field string, value string) (found bool, ID string, err error) DeleteOneByID(dest query.IRecord, ID string) (affected int, err error) DeleteAll(dest query.IRecord) (affected int, err error) }
IQuery provides default queries.
type IResponse ¶
type IResponse interface { JSON(w http.ResponseWriter, body interface{}) (int, error) Created(w http.ResponseWriter, recordID string) (int, error) OK(w http.ResponseWriter, message string) (int, error) }
IResponse provides outputs for data.
type IRouter ¶
type IRouter interface { Delete(path string, fn router.Handler) Get(path string, fn router.Handler) Head(path string, fn router.Handler) Options(path string, fn router.Handler) Patch(path string, fn router.Handler) Post(path string, fn router.Handler) Put(path string, fn router.Handler) }
IRouter provides routing capabilities.
Click to show internal directories.
Click to hide internal directories.