sqlint Yearning MYSQL

Posted by 夏泽民

https://github.com/stripe/safesql



SQL条件!=null查不出数据

Posted by 夏泽民

WHERE ( order_amount != null and order_amount != ‘’ and received_amount != null and received_amount != ‘’ )   查询结果,一条也没有!  在SQL中逻辑表达式的可能值包括TRUE、FALSE和UNKNOWN,它们被称之为三值逻辑。



MySQL 字段类型占用空间

Posted by 夏泽民

TINYINT 1个字节 SMALLINT 2个字节 MEDIUMINT 3个字节 INT, INTEGER 4个字节 BIGINT 8个字节 FLOAT(p) 如果0 <= p <= 24为4个字节, 如果25 <= p <= 53为8个字节 FLOAT 4个字节 DOUBLE [PRECISION], item REAL 4个字节 DECIMAL(M,D), NUMERIC(M,D) 变长(0-4个字节) BIT(M) 大约(M+7)/8个字节 https://blog.csdn.net/free_ant/article/details/52936722



mysql获取表结构

Posted by 夏泽民

//SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES; //SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA=’schema’ AND TABLE_NAME=’table’; //SHOW FULL COLUMNS FROM ‘table’; //show create table ‘table’; sqlingo 就是通过SHOW FULL COLUMNS FROM ‘table’; 来获取表结构生成orm的结构体,来保证代码和数据库的一致性的。



redismock

Posted by 夏泽民

https://github.com/go-redis/redismock db, mock := redismock.NewClientMock() mock.ExpectGet(key).RedisNil()



Search

Popular posts

Anything in here will be replaced on browsers that support the canvas element

Recent posts

This blog is maintained by 夏泽民

Get in touch with me at 465474307@qq.com

Subscribe to our mailing list

* indicates required