Commit 1200556e by mushishixian

初始化项目

parents
/go.sum
/.idea/
xian_protoc.bat
\ No newline at end of file
package Boot
import (
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/mysql"
)
//mysql相关
var mysql_db *gorm.DB
func init(){
InitMysql()
}
func InitMysql() error {
var err error
mysql_db, err = gorm.Open("mysql", "root:root@tcp(192.168.2.239:3306)/test?charset=utf8&parseTime=True&loc=Local")
if err != nil {
mysql_db=nil
return NewFatalError(err.Error()) //这里返回致命异常
}
mysql_db.SingularTable(true)
mysql_db.DB().SetMaxIdleConns( 10)
mysql_db.DB().SetMaxOpenConns( 100)
mysql_db.LogMode(true)
return nil
}
func GetDB() *gorm.DB {
return mysql_db
}
\ No newline at end of file
package Boot
type FatalError struct {
ErrMsg string
}
func (err *FatalError) Error() string {
return err.ErrMsg
}
func NewFatalError( msg string) *FatalError {
return &FatalError{ ErrMsg: msg}
}
func IsFatalError(err error) bool {
if _,ok:=err.(*FatalError);ok{
return true
}
return false
}
\ No newline at end of file
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.24.0
// protoc v3.12.1
// source: Common.proto
package Course
import (
proto "github.com/golang/protobuf/proto"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type Timestamp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timestamp *timestamp.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Timestr string `protobuf:"bytes,2,opt,name=timestr,proto3" json:"timestr,omitempty"`
}
func (x *Timestamp) Reset() {
*x = Timestamp{}
if protoimpl.UnsafeEnabled {
mi := &file_Common_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Timestamp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Timestamp) ProtoMessage() {}
func (x *Timestamp) ProtoReflect() protoreflect.Message {
mi := &file_Common_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Timestamp.ProtoReflect.Descriptor instead.
func (*Timestamp) Descriptor() ([]byte, []int) {
return file_Common_proto_rawDescGZIP(), []int{0}
}
func (x *Timestamp) GetTimestamp() *timestamp.Timestamp {
if x != nil {
return x.Timestamp
}
return nil
}
func (x *Timestamp) GetTimestr() string {
if x != nil {
return x.Timestr
}
return ""
}
var File_Common_proto protoreflect.FileDescriptor
var file_Common_proto_rawDesc = []byte{
0x0a, 0x0c, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06,
0x43, 0x6f, 0x75, 0x72, 0x73, 0x65, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5f, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73,
0x74, 0x61, 0x6d, 0x70, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74,
0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x18,
0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_Common_proto_rawDescOnce sync.Once
file_Common_proto_rawDescData = file_Common_proto_rawDesc
)
func file_Common_proto_rawDescGZIP() []byte {
file_Common_proto_rawDescOnce.Do(func() {
file_Common_proto_rawDescData = protoimpl.X.CompressGZIP(file_Common_proto_rawDescData)
})
return file_Common_proto_rawDescData
}
var file_Common_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_Common_proto_goTypes = []interface{}{
(*Timestamp)(nil), // 0: Course.Timestamp
(*timestamp.Timestamp)(nil), // 1: google.protobuf.Timestamp
}
var file_Common_proto_depIdxs = []int32{
1, // 0: Course.Timestamp.timestamp:type_name -> google.protobuf.Timestamp
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_Common_proto_init() }
func file_Common_proto_init() {
if File_Common_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_Common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Timestamp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_Common_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_Common_proto_goTypes,
DependencyIndexes: file_Common_proto_depIdxs,
MessageInfos: file_Common_proto_msgTypes,
}.Build()
File_Common_proto = out.File
file_Common_proto_rawDesc = nil
file_Common_proto_goTypes = nil
file_Common_proto_depIdxs = nil
}
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: Common.proto
package Course
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
_ "github.com/golang/protobuf/ptypes/timestamp"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: Course.proto
package Course
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
api "github.com/micro/go-micro/v2/api"
client "github.com/micro/go-micro/v2/client"
server "github.com/micro/go-micro/v2/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for CourseService service
func NewCourseServiceEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for CourseService service
type CourseService interface {
ListForTop(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
GetDetail(ctx context.Context, in *DetailRequest, opts ...client.CallOption) (*DetailResponse, error)
}
type courseService struct {
c client.Client
name string
}
func NewCourseService(name string, c client.Client) CourseService {
return &courseService{
c: c,
name: name,
}
}
func (c *courseService) ListForTop(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
req := c.c.NewRequest(c.name, "CourseService.ListForTop", in)
out := new(ListResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *courseService) GetDetail(ctx context.Context, in *DetailRequest, opts ...client.CallOption) (*DetailResponse, error) {
req := c.c.NewRequest(c.name, "CourseService.GetDetail", in)
out := new(DetailResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for CourseService service
type CourseServiceHandler interface {
ListForTop(context.Context, *ListRequest, *ListResponse) error
GetDetail(context.Context, *DetailRequest, *DetailResponse) error
}
func RegisterCourseServiceHandler(s server.Server, hdlr CourseServiceHandler, opts ...server.HandlerOption) error {
type courseService interface {
ListForTop(ctx context.Context, in *ListRequest, out *ListResponse) error
GetDetail(ctx context.Context, in *DetailRequest, out *DetailResponse) error
}
type CourseService struct {
courseService
}
h := &courseServiceHandler{hdlr}
return s.Handle(s.NewHandler(&CourseService{h}, opts...))
}
type courseServiceHandler struct {
CourseServiceHandler
}
func (h *courseServiceHandler) ListForTop(ctx context.Context, in *ListRequest, out *ListResponse) error {
return h.CourseServiceHandler.ListForTop(ctx, in, out)
}
func (h *courseServiceHandler) GetDetail(ctx context.Context, in *DetailRequest, out *DetailResponse) error {
return h.CourseServiceHandler.GetDetail(ctx, in, out)
}
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: CourseTopic.proto
package Course
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
api "github.com/micro/go-micro/v2/api"
client "github.com/micro/go-micro/v2/client"
server "github.com/micro/go-micro/v2/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for CourseTopicService service
func NewCourseTopicServiceEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for CourseTopicService service
type CourseTopicService interface {
GetTopic(ctx context.Context, in *TopicRequest, opts ...client.CallOption) (*TopicResponse, error)
}
type courseTopicService struct {
c client.Client
name string
}
func NewCourseTopicService(name string, c client.Client) CourseTopicService {
return &courseTopicService{
c: c,
name: name,
}
}
func (c *courseTopicService) GetTopic(ctx context.Context, in *TopicRequest, opts ...client.CallOption) (*TopicResponse, error) {
req := c.c.NewRequest(c.name, "CourseTopicService.GetTopic", in)
out := new(TopicResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for CourseTopicService service
type CourseTopicServiceHandler interface {
GetTopic(context.Context, *TopicRequest, *TopicResponse) error
}
func RegisterCourseTopicServiceHandler(s server.Server, hdlr CourseTopicServiceHandler, opts ...server.HandlerOption) error {
type courseTopicService interface {
GetTopic(ctx context.Context, in *TopicRequest, out *TopicResponse) error
}
type CourseTopicService struct {
courseTopicService
}
h := &courseTopicServiceHandler{hdlr}
return s.Handle(s.NewHandler(&CourseTopicService{h}, opts...))
}
type courseTopicServiceHandler struct {
CourseTopicServiceHandler
}
func (h *courseTopicServiceHandler) GetTopic(ctx context.Context, in *TopicRequest, out *TopicResponse) error {
return h.CourseTopicServiceHandler.GetTopic(ctx, in, out)
}
package Course
import (
"database/sql/driver"
"fmt"
"github.com/golang/protobuf/ptypes"
"time"
)
//db 数据 =>go类型
func (this *Timestamp) Scan(value interface{}) error {
switch t := value.(type) {
case time.Time:
var err error
this.Timestamp, err = ptypes.TimestampProto(t)
if err != nil {
return err
}
default:
return fmt.Errorf("timestamp error")
}
return nil
}
// insert update 把go数据类型 =>db类型
func (this Timestamp) Value() (driver.Value, error) {
return ptypes.Timestamp(this.Timestamp)
}
package Mapper
import (
"github.com/jinzhu/gorm"
"jtthink/src/Boot"
"jtthink/src/Vars"
)
func GetCourseList() *gorm.DB {
return Boot.GetDB().Table(Vars.Table_CourseMain).
Order("course_id desc").Limit(3)
}
const course_list="select * from course_main order by course_id desc limit ?"
func GetCourseListBySql(args ...interface{}) *gorm.DB{
return Boot.GetDB().Raw(course_list,args...)
}
func GetCourseDetail(course_id int ) *gorm.DB{
return Boot.GetDB().Table(Vars.Table_CourseMain).Where("course_id=?",course_id)
}
//取计数表
func GetCourseCounts(course_id int ) *gorm.DB{
return Boot.GetDB().Table(Vars.Table_CourseCounts).Where("course_id=?",course_id)
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.23.0
// protoc v3.10.1
// source: Users.proto
package Users
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type UserRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (x *UserRequest) Reset() {
*x = UserRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_Users_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserRequest) ProtoMessage() {}
func (x *UserRequest) ProtoReflect() protoreflect.Message {
mi := &file_Users_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UserRequest.ProtoReflect.Descriptor instead.
func (*UserRequest) Descriptor() ([]byte, []int) {
return file_Users_proto_rawDescGZIP(), []int{0}
}
func (x *UserRequest) GetId() string {
if x != nil {
return x.Id
}
return ""
}
type UserResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Ret string `protobuf:"bytes,2,opt,name=ret,proto3" json:"ret,omitempty"`
}
func (x *UserResponse) Reset() {
*x = UserResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_Users_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserResponse) ProtoMessage() {}
func (x *UserResponse) ProtoReflect() protoreflect.Message {
mi := &file_Users_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UserResponse.ProtoReflect.Descriptor instead.
func (*UserResponse) Descriptor() ([]byte, []int) {
return file_Users_proto_rawDescGZIP(), []int{1}
}
func (x *UserResponse) GetRet() string {
if x != nil {
return x.Ret
}
return ""
}
var File_Users_proto protoreflect.FileDescriptor
var file_Users_proto_rawDesc = []byte{
0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x55,
0x73, 0x65, 0x72, 0x73, 0x22, 0x1d, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x02, 0x69, 0x64, 0x22, 0x20, 0x0a, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x72, 0x65, 0x74, 0x32, 0x40, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x12, 0x31, 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x12, 0x2e, 0x55,
0x73, 0x65, 0x72, 0x73, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x13, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x73, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_Users_proto_rawDescOnce sync.Once
file_Users_proto_rawDescData = file_Users_proto_rawDesc
)
func file_Users_proto_rawDescGZIP() []byte {
file_Users_proto_rawDescOnce.Do(func() {
file_Users_proto_rawDescData = protoimpl.X.CompressGZIP(file_Users_proto_rawDescData)
})
return file_Users_proto_rawDescData
}
var file_Users_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_Users_proto_goTypes = []interface{}{
(*UserRequest)(nil), // 0: Users.UserRequest
(*UserResponse)(nil), // 1: Users.UserResponse
}
var file_Users_proto_depIdxs = []int32{
0, // 0: Users.UserService.Test:input_type -> Users.UserRequest
1, // 1: Users.UserService.Test:output_type -> Users.UserResponse
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_Users_proto_init() }
func file_Users_proto_init() {
if File_Users_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_Users_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_Users_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_Users_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_Users_proto_goTypes,
DependencyIndexes: file_Users_proto_depIdxs,
MessageInfos: file_Users_proto_msgTypes,
}.Build()
File_Users_proto = out.File
file_Users_proto_rawDesc = nil
file_Users_proto_goTypes = nil
file_Users_proto_depIdxs = nil
}
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: Users.proto
package Users
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
api "github.com/micro/go-micro/v2/api"
client "github.com/micro/go-micro/v2/client"
server "github.com/micro/go-micro/v2/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for UserService service
func NewUserServiceEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for UserService service
type UserService interface {
Test(ctx context.Context, in *UserRequest, opts ...client.CallOption) (*UserResponse, error)
}
type userService struct {
c client.Client
name string
}
func NewUserService(name string, c client.Client) UserService {
return &userService{
c: c,
name: name,
}
}
func (c *userService) Test(ctx context.Context, in *UserRequest, opts ...client.CallOption) (*UserResponse, error) {
req := c.c.NewRequest(c.name, "UserService.Test", in)
out := new(UserResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for UserService service
type UserServiceHandler interface {
Test(context.Context, *UserRequest, *UserResponse) error
}
func RegisterUserServiceHandler(s server.Server, hdlr UserServiceHandler, opts ...server.HandlerOption) error {
type userService interface {
Test(ctx context.Context, in *UserRequest, out *UserResponse) error
}
type UserService struct {
userService
}
h := &userServiceHandler{hdlr}
return s.Handle(s.NewHandler(&UserService{h}, opts...))
}
type userServiceHandler struct {
UserServiceHandler
}
func (h *userServiceHandler) Test(ctx context.Context, in *UserRequest, out *UserResponse) error {
return h.UserServiceHandler.Test(ctx, in, out)
}
package Vars
const (
Table_CourseMain="course_main"
Table_CourseCounts="course_counts"
)
package main
import (
"github.com/gin-gonic/gin"
"github.com/micro/go-micro/v2/web"
"jtthink/framework/gin_"
_ "jtthink/src/lib"
"log"
)
func main() {
r:=gin.New()
gin_.BootStrap(r)
//web改成micro 就是grpc,并直接注册到etcd里面
service:=web.NewService(
web.Name("go.micro.api.http.course"),
web.Handler(r),
)
service.Init()
if err:= service.Run(); err != nil {
log.Println(err)
}
}
\ No newline at end of file
package main
import (
"context"
"github.com/micro/go-micro/v2/client/grpc"
"github.com/micro/go-micro/v2/web"
"jtthink/src/Course"
"log"
"net/http"
)
func main() {
service:=web.NewService(
web.Name("api.jtthink.com.http.course"))
c:=grpc.NewClient()
service.HandleFunc("/test", func(writer http.ResponseWriter, request *http.Request) {
c:=Course.NewCourseService("go.micro.api.jtthink.course",c)
course_rsp,_:=c.ListForTop(context.Background(),&Course.ListRequest{Size:10})
log.Println(course_rsp.Result)
writer.Write([]byte("http api test"))
})
service.Init()
if err:= service.Run(); err != nil {
log.Println(err)
}
}
\ No newline at end of file
package main
import (
"github.com/micro/go-micro/v2"
"jtthink/src/Course"
"jtthink/src/service"
"log"
)
func main() {
cService:=micro.NewService(
micro.Name("go.micro.api.jtthink.course"))
cService.Init()
err:=Course.RegisterCourseServiceHandler(cService.Server(),service.NewCourseServiceImpl())
if err!=nil{
log.Fatal(err)
}
if err = cService.Run(); err != nil {
log.Println(err)
}
}
\ No newline at end of file
package main
import (
"context"
"github.com/micro/go-micro/v2/client"
"jtthink/src/Course"
"github.com/micro/go-micro/v2"
"jtthink/src/Users"
"log"
)
type UserService struct{
client client.Client
}
func (this *UserService) Test(ctx context.Context, req *Users.UserRequest, rsp *Users.UserResponse) error {
rsp.Ret="users"+req.Id
c:=Course.NewCourseService("go.micro.api.jtthink.course",this.client)
course_rsp,_:=c.ListForTop(ctx,&Course.ListRequest{Size:10})
log.Println(course_rsp.Result)
return nil
}
func NewUserService(c client.Client) *UserService {
return &UserService{client:c}
}
func main() {
service:=micro.NewService(
micro.Name("go.micro.api.jtthink.user"))
service.Init()
err:=Users.RegisterUserServiceHandler(service.Server(),NewUserService(service.Client()))
if err!=nil{
log.Fatal(err)
}
if err = service.Run(); err != nil {
log.Println(err)
}
}
set MICRO_REGISTRY=etcd
set MICRO_REGISTRY_ADDRESS=localhost:2379
go run src/cmd/course_server.go --server_address :9091
\ No newline at end of file
/*
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;
set MICRO_REGISTRY=etcd
set MICRO_REGISTRY_ADDRESS=192.168.2.232:2379
go run src/cmd/course_http_server.go --server_address :9000
\ No newline at end of file
package gin_
type ServiceBuilder struct {
service interface{}
endPoint Endpoint
requestFunc EncodeRequestFunc
responseFunc DecodeResponseFunc
methods string
middlewares []Middleware
}
func NewBuilder() *ServiceBuilder {
return &ServiceBuilder{middlewares:make([]Middleware,0)}
}
func(this *ServiceBuilder) WithService(obj interface{}) *ServiceBuilder {
this.service=obj
return this
}
func(this *ServiceBuilder) WithMiddleware(obj Middleware) *ServiceBuilder {
this.middlewares=append(this.middlewares,obj)
return this
}
func(this *ServiceBuilder) WithEndpoint(obj Endpoint) *ServiceBuilder {
this.endPoint=obj
return this
}
func(this *ServiceBuilder) WithRequest(obj EncodeRequestFunc) *ServiceBuilder {
this.requestFunc=obj
return this
}
func(this *ServiceBuilder) WithResponse(obj DecodeResponseFunc) *ServiceBuilder {
this.responseFunc=obj
return this
}
func(this *ServiceBuilder) WithMethods(methods string) *ServiceBuilder {
this.methods=methods
return this
}
func(this *ServiceBuilder) Build(path string,methods string) *ServiceBuilder{
finalEndpoint:=this.endPoint
for _,m:=range this.middlewares{ //遍历中间件
finalEndpoint=m(finalEndpoint)
}
handler:=RegisterHandler(finalEndpoint,this.requestFunc,this.responseFunc)
SetHandler(methods,path,handler)
return this
}
package gin_
import (
"fmt"
"github.com/gin-gonic/gin"
)
type Middleware func(next Endpoint) Endpoint
//业务最终函数原型
type Endpoint func(ctx *gin.Context,request interface{}) (response interface{}, err error)
//怎么取参数
type EncodeRequestFunc func(*gin.Context) (interface{}, error)
//怎么处理业务结果
type DecodeResponseFunc func(*gin.Context, interface{}) error
func RegisterHandler(endpoint Endpoint,encodeFunc EncodeRequestFunc, decodeFunc DecodeResponseFunc) func(context *gin.Context){
return func(ctx *gin.Context) {
defer func() {
if r:=recover();r!=nil{
ctx.JSON(500,gin.H{"error":fmt.Sprintf("fatal error:%s",r)})
return
}
}()
//参数:=怎么取参数(context)
//业务结果,error:=业务最终函数(context,参数)
//
//
//怎么处理业务结果(业务结果)
req,err:=encodeFunc(ctx) //获取参数
if err!=nil{
ctx.JSON(400,gin.H{"error":"param error:"+err.Error()})
return
}
rsp,err:=endpoint(ctx,req) //执行业务过程
if err!=nil{
ctx.JSON(400,gin.H{"error":"response error:"+err.Error()})
return
}
err=decodeFunc(ctx,rsp) //处理 业务执行 结果
if err!=nil{
ctx.JSON(500,gin.H{"error":"server error:"+err.Error()})
return
}
}
}
package gin_
import "github.com/gin-gonic/gin"
var HandlerMap map[string]map[string]gin.HandlerFunc
func init() {
HandlerMap=make( map[string]map[string]gin.HandlerFunc)
}
func SetHandler(methods string,path string,handler gin.HandlerFunc) {
if _,ok:=HandlerMap[path];ok{
HandlerMap[path][methods]=handler
}else{
HandlerMap[path]=make(map[string]gin.HandlerFunc)
}
HandlerMap[path][methods]=handler
}
func BootStrap(router *gin.Engine) {
for path,hmap:=range HandlerMap{
for method,handler:=range hmap{
router.Handle(method,path,handler)
}
}
}
\ No newline at end of file
module jtthink
go 1.14
require (
github.com/favadi/protoc-go-inject-tag v1.0.0 // indirect
github.com/gin-gonic/gin v1.6.3
github.com/golang/protobuf v1.4.2
github.com/jinzhu/gorm v1.9.12
github.com/micro/go-micro v1.18.0
github.com/micro/go-micro/v2 v2.5.0
github.com/micro/micro v1.18.0 // indirect
github.com/micro/micro/v2 v2.5.0 // indirect
github.com/micro/protoc-gen-micro/v2 v2.0.0 // indirect
github.com/shopspring/decimal v1.2.0
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 // indirect
golang.org/x/sys v0.0.0-20200523222454-059865788121 // indirect
google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece // indirect
google.golang.org/grpc v1.29.1 // indirect
google.golang.org/protobuf v1.24.0
)
replace google.golang.org/grpc => google.golang.org/grpc v1.26.0
\ No newline at end of file
set MICRO_REGISTRY=etcd
set MICRO_REGISTRY_ADDRESS=localhost:2379
micro api
set MICRO_REGISTRY=etcd
set MICRO_REGISTRY_ADDRESS=localhost:2379
micro api
package lib
import (
"github.com/gin-gonic/gin"
"jtthink/framework/gin_"
"jtthink/src/Course"
"jtthink/src/service"
)
func init() {
courseService:=service.NewCourseServiceImpl()
gin_.NewBuilder().WithService(courseService).
WithMiddleware(Check_Middleware()).
WithMiddleware(Cors_Middleware()).
WithEndpoint(Courselist_Endpoint(courseService)).
WithRequest(Courselist_Request()).
WithResponse(Course_Response()).Build("/course","GET")
gin_.NewBuilder().WithService(courseService).
WithMiddleware(Check_Middleware()).
WithEndpoint(Coursedetail_Endpoint(courseService)).
WithRequest(Coursedetail_Request()).
WithResponse(Course_Response()).Build("/detail/:course_id","GET")
}
//详细相关
func Coursedetail_Endpoint(c *service.CourseServiceImpl) gin_.Endpoint {
return func(context *gin.Context, request interface{}) (response interface{}, err error) {
rsp:=&Course.DetailResponse{Course:new(Course.CourseModel),Counts:make([]*Course.CourseCounts,0)}
err=c.GetDetail(context,request.(*Course.DetailRequest),rsp)
return rsp,err
}
}
//这个函数的作用是怎么处理请求
func Coursedetail_Request() gin_.EncodeRequestFunc{
return func(context *gin.Context) (i interface{}, e error) {
bReq:=&Course.DetailRequest{}
err:=context.BindUri(bReq)
if err!=nil{
return nil,err
}
err=context.BindHeader(bReq)
if err!=nil{
return nil,err
}
return bReq,nil
}
}
//获取列表相关
func Courselist_Endpoint(c *service.CourseServiceImpl) gin_.Endpoint {
return func(context *gin.Context, request interface{}) (response interface{}, err error) {
rsp:=&Course.ListResponse{}
err=c.ListForTop(context,request.(*Course.ListRequest),rsp)
return rsp,err
}
}
//这个函数的作用是怎么处理请求
func Courselist_Request() gin_.EncodeRequestFunc{
return func(context *gin.Context) (i interface{}, e error) {
bReq:=&Course.ListRequest{}
err:=context.BindQuery(bReq) //使用的是query 参数
if err!=nil{
return nil,err
}
return bReq,nil
}
}
//这个函数作用是:怎么处理响应结果
func Course_Response() gin_.DecodeResponseFunc {
return func(context *gin.Context, res interface{}) error {
context.JSON(200,res)
return nil
}
}
\ No newline at end of file
package lib
import (
"github.com/gin-gonic/gin"
"jtthink/framework/gin_"
"jtthink/src/Course"
"jtthink/src/service"
)
func init() {
courseService:=service.NewCourseTopicServiceImpl()
gin_.NewBuilder().WithService(courseService).
WithMiddleware(Check_Middleware()).
WithEndpoint(CourseTopicList_Endpoint(courseService)).
WithRequest(CourseTopicList_Request()).
WithResponse(Course_Response()).Build("/topic/:cid","GET")
}
func CourseTopicList_Endpoint(c *service.CourseTopicServiceImpl) gin_.Endpoint {
return func(context *gin.Context, request interface{}) (response interface{}, err error) {
rsp:=&Course.TopicResponse{Result:make([]*Course.CourseTopic,0)}
err=c.GetTopic(context,request.(*Course.TopicRequest),rsp)
return rsp,err
}
}
//这个函数的作用是怎么处理请求
func CourseTopicList_Request() gin_.EncodeRequestFunc{
return func(context *gin.Context) (i interface{}, e error) {
bReq:=&Course.TopicRequest{}
err:=context.BindUri(bReq) //使用的是query 参数
if err!=nil{
return nil,err
}
return bReq,nil
}
}
\ No newline at end of file
package lib
import (
"fmt"
"github.com/gin-gonic/gin"
"jtthink/framework/gin_"
"net/http"
)
//放 通用中间件
//检查服务是否可用
func Check_Middleware() gin_.Middleware {
return func(next gin_.Endpoint) gin_.Endpoint {
return func(context *gin.Context, request interface{}) (response interface{}, err error) {
fmt.Println("我是中间件.....")
return next(context,request)
}
}
}
func Cors_Middleware() gin_.Middleware {
return func(next gin_.Endpoint) gin_.Endpoint {
return func(c *gin.Context, request interface{}) (response interface{}, err error) {
method := c.Request.Method
c.Header("Access-Control-Allow-Origin", "*")
c.Header("Access-Control-Allow-Headers", "Content-Type,AccessToken,X-CSRF-Token, Authorization, Token")
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS")
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type")
c.Header("Access-Control-Allow-Credentials", "true")
//放行所有OPTIONS方法
if method == "OPTIONS" {
c.AbortWithStatus(http.StatusNoContent)
}
// 处理请求
return next(c,request)
}
}
}
\ No newline at end of file
::protoc --proto_path=src/protos --micro_out=src/Users --go_out=src/Users Users.proto
protoc --proto_path=src/protos --micro_out=src/Course --go_out=src/Course Course.proto
protoc-go-inject-tag -input=src/Course/Course.pb.go
protoc --proto_path=src/protos --micro_out=src/Course --go_out=src/Course Common.proto
protoc --proto_path=src/protos --micro_out=src/Course --go_out=src/Course CourseTopic.proto
protoc-go-inject-tag -input=src/Course/CourseTopic.pb.go
\ No newline at end of file
syntax = "proto3";
import "google/protobuf/timestamp.proto";
package Course;
message Timestamp {
google.protobuf.Timestamp timestamp = 1;
string timestr=2;
}
\ No newline at end of file
syntax = "proto3";
import "Common.proto";
package Course;
service CourseService {
rpc ListForTop(ListRequest) returns (ListResponse);
rpc GetDetail(DetailRequest) returns(DetailResponse);
}
message CourseModel{
int32 course_id=1;
string course_name=2;
string course_disp_name=3;
string course_intr=4;
float course_price=5;
float course_price2=6;
// @inject_tag: gorm:"type:timestamp"
Timestamp addtime=7;
}
message ListRequest {
// @inject_tag: form:"size"
int32 size = 1;
}
message DetailRequest{
// @inject_tag: uri:"course_id"
int32 course_id=1;
// @inject_tag: header:"fetch_type"
int32 fetch_type=2;
}
//计数
message CourseCounts{
// @inject_tag: json:"-"
int32 count_id=1;
// @inject_tag: json:"-"
int32 course_id=2;
string count_key=3;
int32 count_value=4;
}
message ListResponse {
repeated CourseModel result = 1;
}
message DetailResponse{
CourseModel course=1;
repeated CourseCounts counts=2;
}
syntax = "proto3";
import "Common.proto";
package Course;
message CourseTopic{
int32 Id=1;
int32 CourseId=2;
int32 CourseDid=3;
int32 Likes=4;
int32 Unlikes=5;
string Title=6;
string Content=7;
int32 UserId=8;
Timestamp Addtime=9;
Timestamp Updatetime=10;
}
message CourseTopicReply{
int32 Id=1;
int32 TopicId=2;
string Content=3;
int32 UserId=4;
int32 Likes=5;
int32 Unlikes=6;
Timestamp Addtime=7;
}
message TopicRequest{
int32 CourseId=1;
}
message TopicResponse{
repeated CourseTopic result=1;
}
service CourseTopicService {
rpc GetTopic(TopicRequest) returns (TopicResponse);
}
\ No newline at end of file
syntax = "proto3";
package Users;
service UserService {
rpc Test(UserRequest) returns (UserResponse) {}
}
message UserRequest {
string id = 1;
}
message UserResponse {
string ret = 2;
}
package service
import (
"context"
. "jtthink/src/Course"
"jtthink/src/Mapper"
)
func NewCourseModel(id int32,name string) *CourseModel {
return &CourseModel{CourseId:id,CourseName:name}
}
type CourseServiceImpl struct{}
func(this *CourseServiceImpl) ListForTop(ctx context.Context, req *ListRequest, rsp *ListResponse) error{
course:=make([]*CourseModel,0)
err:=Mapper.GetCourseListBySql(req.Size).Find(&course).Error
if err!=nil{
return err
}
rsp.Result=course
return nil
}
func(this *CourseServiceImpl) GetDetail(ctx context.Context,req *DetailRequest, rsp *DetailResponse) error{
//只取课程详细
if req.FetchType==0 || req.FetchType==1 || req.FetchType==3{
if err:=Mapper.GetCourseDetail(int(req.CourseId)).Find(rsp.Course).Error;err!=nil{
return err
}
}
//只取计数表详细
if req.FetchType==2 || req.FetchType==3{
if err:=Mapper.GetCourseCounts(int(req.CourseId)).Find(&rsp.Counts).Error;err!=nil{
return err
}
}
return nil
}
func NewCourseServiceImpl() *CourseServiceImpl {
return &CourseServiceImpl{}
}
\ No newline at end of file
package service
import (
"context"
"jtthink/src/Boot"
. "jtthink/src/Course"
)
type CourseTopicServiceImpl struct {}
func(this *CourseTopicServiceImpl) GetTopic(ctx context.Context, in *TopicRequest, out *TopicResponse) error{
if err:=Boot.GetDB().Table("course_topic").Find(&out.Result).Error;err!=nil {
return err
}
return nil
}
func NewCourseTopicServiceImpl() *CourseTopicServiceImpl {
return &CourseTopicServiceImpl{}
}
\ No newline at end of file
/*
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 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
-- ----------------------------
set MICRO_REGISTRY=etcd
set MICRO_REGISTRY_ADDRESS=localhost:2379
go run src/cmd/user_server.go --server_address :9090
\ No newline at end of file
set MICRO_REGISTRY=etcd
set MICRO_REGISTRY_ADDRESS=192.168.2.232:2379
micro web
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