Documentation ¶
Index ¶
- Constants
- Variables
- func ChangeDatabase(db string) error
- func Compare(oldsign, newsign string) int
- func Connect(server, port, password, protocol string, idleMax, idleTimeput int)
- func CreateDatabase(dbname string) error
- func GetDatabases() ([]string, float64, error)
- func GetDbInfo() (int, string)
- func GetTableInfo(tablename string) ([][]string, float64, error)
- func GetTables() ([]string, float64, error)
- func Selectdb(db int)
- func ToArray(reply interface{}) [][]string
- type Inner
- type Insert
- type Left
- type QueryRes
- type RedisConnect
- type Right
- type Select
- type SltField
- type SltTable
- type Table
Constants ¶
View Source
const ( REDISQL_USE = iota //use databasename; REDISQL_SHOW_DATABASES //show databases; REDISQL_SHOW_TABLES //show tables; REDISQL_SHOW_INDEX //show index from tablename; REDISQL_DESC //desc tablename; REDISQL_CREATE_DATABASE //create database databasename; REDISQL_CREATE_TABLE //create table tbname(field1,type1...); REDISQL_CREATE_INDEX //create index indexname on tablename(fieldname); REDISQL_INSERT //insert into tablename(field1...) values(value1...); REDISQL_SELECT //select field1... from table1... where case1... limit start end REDISQL_UPDATE //update tablename set field1=value1 where case1... REDISQL_DELETE //delete from tablename where case1... REDISQL_DROP_DATABASE //drop database databasename REDISQL_DROP_TABLE //drop table tablename REDISQL_EXIT //exit REDISQL_HELP //help REDISQL_EMPTY )
View Source
const ( QUERY_OK_0 = "Query OK, 0 rows affected" QUERY_OK_1 = "Query OK, 1 row affected" )
View Source
const ( REDISQL_TYPE_NUMBER = "NUMBER" REDISQL_TYPE_STRING = "STRING" REDISQL_TYPE_DATE = "DATE" )
data type design number include INT FLOAT DOUBLE string include CHAR、VARCHAR、BINARY、VARBINARY、BLOB、TEXT、ENUM date include DATA DATATIME ignore enum or set number and date will support range query string will support fuzzy search
View Source
const ( REDISQL_PRIORITY_GREATER = 1 REDISQL_PRIORITY_EQUAL = 0 REDISQL_PRIORITY_LESS = -1 REDISQL_PRIORITY_ERROR = -2 )
View Source
const ( REDISQL_DATABASES = "databases" //hset databases lnkgift 1 REDISQL_CONDITION_SN = "%s.condition.sn" //query condition sn REDISQL_TABLES = "%s.tables" //hset lnkgift.tables user 1 REDISQL_COUNT = "%s.tables.count" //hset lnkgift.tables.count user 1 REDISQL_FIELDS = "%s.%s.fields" //hset lnkgift.user.fields name string REDISQL_UNIQUE = "%s.%s.unique" //sadd lnkgift.user.unique name REDISQL_INDEXS = "%s.%s.indexs" //hset lnkgift.user.indexs index_name [name] REDISQL_DATAS = "%s.%s.data.%s" //hset lnkgift.user.data.1 name qianno REDISQL_INDEX_DATAS = "%s.%s.index.%s" //string: sadd lnkgift.user.index.name.qianno 1 or number,date: zadd lnkgift.user.index.age 26 1 REDISQL_TMP_CONDITION = "%s.%s.tmp.condition.%s" //sadd lnkgift.user.tmp.condition.1 1 2 3 4 REDISQL_TMP_CARTESIAN = "%s.tmp.condition.cartesian.%s" //hset lnkgift.tmp.condition.descartes.1 a_1_b_2_c_1_ )
redis store key design
Variables ¶
View Source
var ( CompareSign = []string{"=", "!=", ">", ">=", "<", "<=", "LIKE"} Opertion = []string{"(", ")", "AND", "OR", "#"} )
Functions ¶
func ChangeDatabase ¶
func CreateDatabase ¶
func GetDatabases ¶
Types ¶
type Inner ¶
how to use eg: FIELDS("a.name, a.age, a.city, b.userid, b.operate, b.detail, b.data")
.FROM("user, log").ALIAS("a, b") .WHERE(a.id = b.userid AND a.age = 24) OR (b.operate = "login").SELECT()
type RedisConnect ¶
type RedisConnect struct {
// contains filtered or unexported fields
}
var (
DB RedisConnect
)
type Select ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.