142 lines
5.6 KiB
Go
142 lines
5.6 KiB
Go
package database
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
)
|
|
|
|
var errNotImplemented = errors.New("mysql database: not implemented")
|
|
|
|
// stubDatabase provides a not-implemented default for every Database method.
|
|
// MysqlDatabase embeds it so the interface is satisfied without hand-writing
|
|
// each method; individual methods can be overridden on MysqlDatabase later.
|
|
type stubDatabase struct{}
|
|
|
|
func (stubDatabase) Init(username, password string) error { return errNotImplemented }
|
|
func (stubDatabase) Close() error { return errNotImplemented }
|
|
|
|
func (stubDatabase) CommonSalt(ctx context.Context, username string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CommonLogin(ctx context.Context, username, password, clientUa, clientIp string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CommonWebLogin(ctx context.Context, username, password, clientUa, clientIp string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CommonLogout(ctx context.Context, token string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CommonTokenValid(ctx context.Context, token string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
|
|
func (stubDatabase) CalendarGetFull(ctx context.Context, token string, startDateTime, endDateTime int64) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CalendarGetList(ctx context.Context, token string, startDateTime, endDateTime int64) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CalendarGetDetail(ctx context.Context, token, uuid string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CalendarUpdate(ctx context.Context, token, uuid, lastChange string, opts CalendarUpdateOptions) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CalendarAdd(ctx context.Context, token, belongTo, title, description string, eventDateTimeStart, eventDateTimeEnd int64, loopRules string, timezoneOffset int64) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CalendarDelete(ctx context.Context, token, uuid, lastChange string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
|
|
func (stubDatabase) CollectionGetFullOwn(ctx context.Context, token string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CollectionGetListOwn(ctx context.Context, token string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CollectionGetDetailOwn(ctx context.Context, token, uuid string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CollectionAddOwn(ctx context.Context, token, name string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CollectionUpdateOwn(ctx context.Context, token, uuid, name, lastChange string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CollectionDeleteOwn(ctx context.Context, token, uuid, lastChange string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CollectionGetSharing(ctx context.Context, token, uuid string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CollectionDeleteSharing(ctx context.Context, token, uuid, target, lastChange string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CollectionAddSharing(ctx context.Context, token, uuid, target, lastChange string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) CollectionGetShared(ctx context.Context, token string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
|
|
func (stubDatabase) TodoGetFull(ctx context.Context, token string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) TodoGetList(ctx context.Context, token string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) TodoGetDetail(ctx context.Context, token, uuid string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) TodoAdd(ctx context.Context, token string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) TodoUpdate(ctx context.Context, token, uuid, data, lastChange string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) TodoDelete(ctx context.Context, token, uuid, lastChange string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
|
|
func (stubDatabase) AdminGet(ctx context.Context, token string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) AdminAdd(ctx context.Context, token, username string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) AdminUpdate(ctx context.Context, token, username string, opts AdminUpdateOptions) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) AdminDelete(ctx context.Context, token, username string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
|
|
func (stubDatabase) ProfileIsAdmin(ctx context.Context, token string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) ProfileChangePassword(ctx context.Context, token, password string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) ProfileGetToken(ctx context.Context, token string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
func (stubDatabase) ProfileDeleteToken(ctx context.Context, token, deleteToken string) (any, error) {
|
|
return nil, errNotImplemented
|
|
}
|
|
|
|
// MysqlDatabase implements Database as a fully not-implemented stub by
|
|
// embedding stubDatabase. Real MySQL support can be filled in later by
|
|
// overriding individual methods.
|
|
type MysqlDatabase struct {
|
|
stubDatabase
|
|
deps Deps
|
|
}
|
|
|
|
// NewMysqlDatabase returns a not-implemented MysqlDatabase. The deps are stored
|
|
// for symmetry with NewSqlite3Database but not yet used.
|
|
func NewMysqlDatabase(deps Deps) (*MysqlDatabase, error) {
|
|
return &MysqlDatabase{deps: deps}, nil
|
|
}
|