连接客户端 config = clientv3.Config{ Endpoints: []string{"127.0.0.1:2379"}, // 集群列表 DialTimeout: 5 * time.Second, } // 建立一个客户端 if client, err = clientv3.New(config); err != nil { fmt.Println(err) return } put //PUT if putResp, err = kv.Put(context.TODO(), "/prefix/keys/k1", "v1", …
GORM 模型定义 模型实现了Scanner和Valuer接口 模型约定: GORM 使用ID作为主键 如果不默认使用ID作为主键,应该使用标签primaryKey 指定 // 将 `UUID` 设为主键 type Animal struct { ID int64 UUID string `gorm:"primaryKey"` Name string Age int64 } 复合主键 type Product struct { ID string `gorm:"primaryKey"` LanguageCode string `gorm:"primaryKey"` Code …
1.安装flower: pip install flower 1 2. 启动flower 例如启动项目工程下面celery_tasks目录的main.py 异步任务启动函数 flower -A celery_tasks.main --port=5555 1.安装Celery pip install celery 2.编写task from celery import Celery app = Celery('tasks', broker='amqp://guest@localhost//') @app.task def add(x, y): return x + y 3.运行 $ celery -A …
C++ 小记 CMAKE 工程构建工具 简单的使用 文件名大小写敏感 语法 cmake_minimum_required(VERSION 2.8)#设置cmake的版本 set(CMAKE_BUILD_TYPE Debug )#设置为debug模式 #项目名 PROJECT(HELLO) #设置某文件夹为头文件 include_directories("include") #设置一个头文件,把hello.cpp编译为libfile add_library(libfile src/hello.cpp) SET(SRC_LIST “fu nc.c”) # …