Commit 9a24f6fb by mushishixian

优化目录结构

parent 5339e1d8
## 搜索服务
#### 目录结构
├── bat //运行脚本或者protoc生成脚本
├── boot //启动文件,比如配置加载,数据库加载等等
├── cmd //服务的主入口,可直接go run执行
├── conf //配置文件目录
├── framework //gin框架接入
├── lib
├── mapper
├── model //模型目录
├── pkg //公用包目录,比如配置读取,获取数据库实例,通用函数或者变量等都可以从这里获取
├── protopb //生成的protos.pb.go文件
├── protos //原始的protos文件
├── service //业务逻辑操作所在目录
/*
Navicat MySQL Data Transfer
Source Server : 192.168.1.100
Source Server Version : 50553
Source Host : 192.168.1.101:3306
Source Database : test
Target Server Type : MYSQL
Target Server Version : 50553
File Encoding : 65001
Date: 2020-06-03 22:33:06
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for course_counts
-- ----------------------------
DROP TABLE IF EXISTS `course_counts`;
CREATE TABLE `course_counts` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`count_id` int(11) NOT NULL DEFAULT '0',
`course_id` int(11) unsigned NOT NULL DEFAULT '0',
`count_key` varchar(50) NOT NULL DEFAULT '',
`count_value` int(11) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of course_counts
-- ----------------------------
INSERT INTO `course_counts` VALUES ('1', '1', '2', 'click', '3');
INSERT INTO `course_counts` VALUES ('2', '2', '2', 'fav', '2');
This diff could not be displayed because it is too large.
/*
Navicat Premium Data Transfer
Source Server : mysql57
Source Server Type : MySQL
Source Server Version : 50721
Source Host : localhost:3307
Source Schema : jt
Target Server Type : MySQL
Target Server Version : 50721
File Encoding : 65001
Date: 04/05/2020 16:55:36
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for course_main
-- ----------------------------
DROP TABLE IF EXISTS `course_main`;
CREATE TABLE `course_main` (
`course_id` int(11) NOT NULL AUTO_INCREMENT,
`course_name` varchar(50) COLLATE utf8mb4_bin NOT NULL DEFAULT '',
`course_disp_name` varchar(200) COLLATE utf8mb4_bin NOT NULL DEFAULT '',
`course_price` decimal(10,2) NOT NULL DEFAULT '0.00',
`course_price2` decimal(10,0) NOT NULL DEFAULT '0',
`addtime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`course_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
-- ----------------------------
-- Records of course_main
-- ----------------------------
INSERT INTO `course_main` VALUES (1, '4个月成为架构师', '4个月成为架构师,不辛苦、无需流汗', 9.90, 0, '2020-05-04 00:36:45');
INSERT INTO `course_main` VALUES (2, '60天精通python全栈', '60天精通python全栈', 10.00, 0, '2020-05-04 00:36:48');
SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat MySQL Data Transfer
Source Server : 192.168.1.100
Source Server Version : 50553
Source Host : 192.168.1.101:3306
Source Database : test
Target Server Type : MYSQL
Target Server Version : 50553
File Encoding : 65001
Date: 2020-06-03 22:33:22
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for course_topic
-- ----------------------------
DROP TABLE IF EXISTS `course_topic`;
CREATE TABLE `course_topic` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`course_id` int(11) NOT NULL DEFAULT '0' COMMENT '课程ID',
`course_did` int(11) NOT NULL DEFAULT '0' COMMENT '课时ID',
`likes` int(11) DEFAULT NULL COMMENT '点赞数',
`unlikes` int(11) DEFAULT NULL COMMENT '不认同数',
`title` varchar(500) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '标题',
`content` text COLLATE utf8mb4_bin COMMENT '评论内容',
`user_id` int(11) DEFAULT NULL COMMENT '发表者ID',
`addtime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '发布时间',
`updatetime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '最后修改时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
-- ----------------------------
-- Records of course_topic
-- ----------------------------
/*
Navicat MySQL Data Transfer
Source Server : 192.168.1.100
Source Server Version : 50553
Source Host : 192.168.1.101:3306
Source Database : test
Target Server Type : MYSQL
Target Server Version : 50553
File Encoding : 65001
Date: 2020-06-03 22:33:30
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for course_topic_reply
-- ----------------------------
DROP TABLE IF EXISTS `course_topic_reply`;
CREATE TABLE `course_topic_reply` (
`id` int(11) NOT NULL,
`topic_id` int(11) NOT NULL COMMENT '短评ID',
`content` text COLLATE utf8mb4_bin COMMENT '回复内容',
`user_id` int(11) DEFAULT NULL COMMENT '回复用户ID',
`likes` int(11) DEFAULT NULL COMMENT '认同',
`unlikes` int(11) DEFAULT NULL COMMENT '不认同',
`addtime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '入库时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
-- ----------------------------
-- Records of course_topic_reply
-- ----------------------------
package main
import (
"fmt"
"github.com/gomodule/redigo/redis"
"search_server/boot"
"search_server/pkg/gredis"
)
func main() {
boot.Boot()
gredis.Delete("testKey")
//gredis.HDelete("testHKey", 1)
fmt.Println(redis.String(gredis.Get("testKey")))
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment