Documentation ¶
Index ¶
- Constants
- Variables
- type Entry
- type SQLiteRepository
- func (r *SQLiteRepository) All() (all []*Entry, err error)
- func (r *SQLiteRepository) ClearTable() error
- func (r *SQLiteRepository) CurrentTable() string
- func (r *SQLiteRepository) Delete(username string) error
- func (r *SQLiteRepository) DeleteTable(tableName string) error
- func (r *SQLiteRepository) GetByUsername(username string) (*Entry, error)
- func (r *SQLiteRepository) Initialize() error
- func (r *SQLiteRepository) Insert(e Entry) (*Entry, error)
- func (r *SQLiteRepository) ListTables() (tables []string)
- func (r *SQLiteRepository) NewTable(tableName string) error
- func (r *SQLiteRepository) SwitchTable(tableName string) error
- func (r *SQLiteRepository) TableExists(tableName string) (bool, error)
- func (r *SQLiteRepository) Update(username string, u *Entry) (*Entry, error)
Constants ¶
View Source
const DEFAULT_TABLE = "default_table"
Variables ¶
View Source
var ( ErrDuplicate = errors.New("record already exists") ErrNotFound = errors.New("record does not exist") ErrUpdateFailed = errors.New("record could not be updated") ErrDeleteFailed = errors.New("record could not be deleted") ErrInvalidID = errors.New("record ID is invalid") ErrInvalidEmail = errors.New("email is not valid") ErrInvalidName = errors.New("name is not valid") ErrInvalidUsername = errors.New("username is not valid") ErrInvalidTableName = errors.New("tablename is not valid") ErrTableExists = errors.New("table already exists") ErrTableDoesNotExist = errors.New("table does not exist") ErrTableCannotBeDeleted = errors.New("table cannot be deleted") )
Functions ¶
This section is empty.
Types ¶
type SQLiteRepository ¶
type SQLiteRepository struct {
// contains filtered or unexported fields
}
func NewSQLiteRepository ¶
func NewSQLiteRepository(db *sql.DB) (*SQLiteRepository, error)
func SetupWithInserts ¶
func SetupWithInserts(t *testing.T) (*SQLiteRepository, func())
func (*SQLiteRepository) All ¶
func (r *SQLiteRepository) All() (all []*Entry, err error)
func (*SQLiteRepository) ClearTable ¶
func (r *SQLiteRepository) ClearTable() error
Wipes the current table.
Logs to console and terminates execution if there is an issue with SQL
func (*SQLiteRepository) CurrentTable ¶
func (r *SQLiteRepository) CurrentTable() string
func (*SQLiteRepository) Delete ¶
func (r *SQLiteRepository) Delete(username string) error
func (*SQLiteRepository) DeleteTable ¶
func (r *SQLiteRepository) DeleteTable(tableName string) error
func (*SQLiteRepository) GetByUsername ¶
func (r *SQLiteRepository) GetByUsername(username string) (*Entry, error)
func (*SQLiteRepository) Initialize ¶
func (r *SQLiteRepository) Initialize() error
func (*SQLiteRepository) ListTables ¶
func (r *SQLiteRepository) ListTables() (tables []string)
func (*SQLiteRepository) NewTable ¶
func (r *SQLiteRepository) NewTable(tableName string) error
func (*SQLiteRepository) SwitchTable ¶
func (r *SQLiteRepository) SwitchTable(tableName string) error
func (*SQLiteRepository) TableExists ¶
func (r *SQLiteRepository) TableExists(tableName string) (bool, error)
Click to show internal directories.
Click to hide internal directories.