sqliteLib

package module
v0.0.0-...-fd057f4 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: GPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TokenLength int = 64

Functions

func AddDataSet

func AddDataSet(did int64, valueType int, value string) (int64, error)

func AddDataSource

func AddDataSource(uid int64, valtype int) (int64, error)

func AddUser

func AddUser(username, password string) (int64, error)

func AuthUser

func AuthUser(username, password string) bool

func CheckDataSetPermission

func CheckDataSetPermission(uid, did int64) bool

func DelDataSetViaDid

func DelDataSetViaDid(did int64) error

func DelDataSource

func DelDataSource(did int64) error

func DelUser

func DelUser(uid int64) error

func ExistDataSet

func ExistDataSet(dsid int64) bool

func ExistDataSource

func ExistDataSource(did int64) bool

func ExistUser

func ExistUser(username string) bool

func GetDSIdViaDid

func GetDSIdViaDid(did int64) (int64, error)

func GetDataSourcesViaUid

func GetDataSourcesViaUid(uid int64) (*[]DataSource, error)

func GetUidViaToken

func GetUidViaToken(token string) (int64, error)

func Init

func Init()

func InitTable

func InitTable() int64

func UpdateDataSetValue

func UpdateDataSetValue(dsid int64, value string) error

func UpdatePassword

func UpdatePassword(username, password string) error

func UpdateToken

func UpdateToken(username, token string) error

func UpdateUpdatedTimestamp

func UpdateUpdatedTimestamp(did int64) error

Types

type DataSet

type DataSet struct {
	DSId      int64  `json:"dsid"`
	Did       int64  `json:"did"`
	ValueType int    `json:"valtype"`
	Value     string `json:"value"`
}

func GetDataSet

func GetDataSet(dsid int64) (*DataSet, error)

type DataSource

type DataSource struct {
	Did              int64 `json:"did"`
	Uid              int64 `json:"uid"`
	ValueType        int   `json:"valtype"`
	CreatedTimestamp int64 `json:"createdTimestamp"`
	UpdatedTimestamp int64 `json:"updatedTimestamp"`
}

func GetDataSource

func GetDataSource(did int64) (*DataSource, error)

type SqliteDB

type SqliteDB struct {
	DBPath string
	DB     *sql.DB
}

func OpenDataBase

func OpenDataBase(DBPath string) (*SqliteDB, error)

func (*SqliteDB) Close

func (sdb *SqliteDB) Close()

func (*SqliteDB) Exec

func (sdb *SqliteDB) Exec(sql string) (sql.Result, error)

func (*SqliteDB) GetCount

func (sdb *SqliteDB) GetCount(rows *sql.Rows) (int, error)

func (*SqliteDB) PrepareExec

func (sdb *SqliteDB) PrepareExec(prepareSql string, args ...interface{}) (sql.Result, error)

func (*SqliteDB) PrepareQuery

func (sdb *SqliteDB) PrepareQuery(prepareSql string, args ...interface{}) (*sql.Rows, error)

func (*SqliteDB) Query

func (sdb *SqliteDB) Query(sql string) (*sql.Rows, error)

func (*SqliteDB) Remove

func (sdb *SqliteDB) Remove()

type UserInfo

type UserInfo struct {
	Uid      int64  `json:"uid"`
	UserName string `json:"username"`
	PassWord string `json:"password"`
	Total    int    `json:"total"`
	Token    string `json:"token"`
}

func GetUserInfo

func GetUserInfo(uid int64) (*UserInfo, error)

func GetUserInfoViaUsername

func GetUserInfoViaUsername(username string) (*UserInfo, error)

Jump to

Keyboard shortcuts

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