sqlite

package
v0.0.0-...-51d629d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2016 License: BSD-3-Clause, BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Copyright 2014 Charles Gentry. All rights reserved. Please see the license included with this package

Copyright 2014 Charles Gentry. All rights reserved. Please see the license included with this package

Copyright 2014 Charles Gentry. All rights reserved. Please see the license included with this package

Copyright 2014 Charles Gentry. All rights reserved. Please see the license included with this package

Copyright 2014 Charles Gentry. All rights reserved. Please see the license included with this package

Index

Constants

View Source
const (
	// DriverName Specifies the specific identity of this driver within a group
	DriverName      = "sqlite"
	IdentityStorage = "Sqlite"
	HelpShort       = "Simple SQLite3 driver. Only suitable for testing purposes."
	HelpTemplate    = `` /* 476-byte string literal not displayed */

)
View Source
const (
	FieldGUID            = storage.FieldGUID
	FIELD_FULLNAME       = storage.FieldName
	FieldEmail           = storage.FieldEmail
	FIELD_DOMAIN         = `Domain`
	FIELD_LOGINNAME      = storage.FieldLogin
	FIELD_PASSWORD       = `Password`
	FieldToken           = storage.FieldToken
	FIELD_SALT           = `Salt`
	FIELD_ISACTIVE       = `IsActive`
	FIELD_ISLOGGEDIN     = `IsLoggedIn`
	FIELD_ISSYSTEM       = `IsSystem`
	FIELD_FAILCOUNT      = `FailCount`
	FIELD_LOGIN_DT       = `LoginAt`
	FIELD_LOGOUT_DT      = `LogoutAt`
	FIELD_LASTAUTH_DT    = `LastAuthAt`
	FIELD_LASTFAILED_DT  = `LastFailedAt`
	FIELD_MAX_SESSION_DT = `MaxSessionAt`
	FIELD_TIMEOUT_DT     = `TimeoutAt`
	FIELD_CREATED_DT     = `CreatedAt`
	FIELD_UPDATED_DT     = `UpdatedAt`
	FIELD_DELETED_DT     = `DeletedAt`
)

These define all of the fields that are in the database, not in the User record.

View Source
const DRIVER_IDENTITY = "sqlite3"

Variables

This section is empty.

Functions

func Register

func Register()

Register is a simple wrapper to make sure registration occurs properly

func SetDefault

func SetDefault()

Types

type SqliteConn

type SqliteConn struct {
	// contains filtered or unexported fields
}

func (*SqliteConn) Close

func (t *SqliteConn) Close() error

Close the connection to the database (if it is open)

func (*SqliteConn) CreateStore

func (t *SqliteConn) CreateStore() error

CreateStore is a non-destructive storage creation mechanism. It can be called on the cli line with the option -C

func (*SqliteConn) GetRawHandle

func (t *SqliteConn) GetRawHandle() interface{}

Return the raw database handle to the caller. This allows more flexible options

func (*SqliteConn) Release

func (t *SqliteConn) Release() error

Release is used to release any locks/resources that may have been created. In SQLITE we aren't using any locks, so we don't have to do anything.

func (*SqliteConn) UserFetch

func (t *SqliteConn) UserFetch(domain, field, val string) (*tenant.User, error)

func (*SqliteConn) UserInsert

func (t *SqliteConn) UserInsert(user *tenant.User) error

Save most of the user record. This is used to perform general updates, including password. The only fields that will NOT be updated are Domain, Salt, and CreatedAt. UpdatedAt will always be set in this routine from the current time, not from the record. Higher level routines can use this to completely update portions of a record. This is NOT atomic as the read/update routines do not lock records. This shouldn't be a problem for most cases.

func (*SqliteConn) UserUpdate

func (t *SqliteConn) UserUpdate(user *tenant.User) error

Update the database from the user record passed. The only fields that are not updated are the CreatedAt and GUID fields. These are only set on an UserInsert call

type SqliteDriver

type SqliteDriver struct{}

func NewSqliteDriver

func NewSqliteDriver() *SqliteDriver

Fetch a raw database Sqlite driver

func (*SqliteDriver) Open

func (t *SqliteDriver) Open(dsnConnect string, extraDriverOptions string) (storage.Conn, error)

The main driver will call this function to get a connection to the SqlLite db driver. it then 'routes' calls through this connection.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL