mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-09 03:25:59 +08:00
Merge remote-tracking branch 'origin/errcode' into errcode
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"OpenIM/internal/push"
|
||||
"OpenIM/internal/startrpc"
|
||||
"OpenIM/pkg/common/config"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
type PushCmd struct {
|
||||
*AuthCmd
|
||||
}
|
||||
|
||||
func NewPushCmd() *PushCmd {
|
||||
return &PushCmd{NewAuthCmd()}
|
||||
}
|
||||
|
||||
func (r *PushCmd) AddPush() {
|
||||
r.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return startrpc.Start(r.getPortFlag(cmd), config.Config.RpcRegisterName.OpenImPushName, r.getPrometheusPortFlag(cmd), push.Start)
|
||||
}
|
||||
}
|
||||
+2
-14
@@ -23,23 +23,11 @@ func NewRootCmd() (rootCmd *RootCmd) {
|
||||
},
|
||||
}
|
||||
rootCmd.Command = c
|
||||
rootCmd.init()
|
||||
rootCmd.addConfFlag()
|
||||
return rootCmd
|
||||
}
|
||||
|
||||
func (r *RootCmd) AddRunE(f func(cmd RootCmd) error) {
|
||||
r.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return f(*r)
|
||||
}
|
||||
}
|
||||
|
||||
func (r *RootCmd) AddRpc(f func(port, prometheusPort int) error) {
|
||||
r.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return f(r.getPortFlag(cmd), r.getPrometheusPortFlag(cmd))
|
||||
}
|
||||
}
|
||||
|
||||
func (r *RootCmd) init() {
|
||||
func (r *RootCmd) addConfFlag() {
|
||||
r.Command.Flags().StringP(constant.FlagConf, "c", "", "Path to config file folder")
|
||||
}
|
||||
|
||||
|
||||
@@ -7,16 +7,16 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type AuthCmd struct {
|
||||
type RpcCmd struct {
|
||||
*RootCmd
|
||||
}
|
||||
|
||||
func NewAuthCmd() *AuthCmd {
|
||||
authCmd := &AuthCmd{NewRootCmd()}
|
||||
func NewRpcCmd() *RpcCmd {
|
||||
authCmd := &RpcCmd{NewRootCmd()}
|
||||
return authCmd
|
||||
}
|
||||
|
||||
func (a *AuthCmd) Exec() error {
|
||||
func (a *RpcCmd) Exec() error {
|
||||
a.Command.Run = func(cmd *cobra.Command, args []string) {
|
||||
a.port = a.getPortFlag(cmd)
|
||||
a.prometheusPort = a.getPrometheusPortFlag(cmd)
|
||||
@@ -24,6 +24,6 @@ func (a *AuthCmd) Exec() error {
|
||||
return a.Execute()
|
||||
}
|
||||
|
||||
func (a *AuthCmd) StartSvr(name string, rpcFn func(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error) error {
|
||||
func (a *RpcCmd) StartSvr(name string, rpcFn func(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error) error {
|
||||
return startrpc.Start(a.GetPortFlag(), name, a.GetPrometheusPortFlag(), rpcFn)
|
||||
}
|
||||
|
||||
@@ -515,7 +515,6 @@ func (c *config) initConfig(config interface{}, configName, configFolderPath str
|
||||
return err
|
||||
}
|
||||
configPath = filepath.Join(Root, "config", configName)
|
||||
fmt.Println("use", configPath)
|
||||
} else {
|
||||
Root = filepath.Dir(configPath)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package relation
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
|
||||
pbMsg "OpenIM/pkg/proto/msg"
|
||||
@@ -27,7 +26,6 @@ type ChatLogModel struct {
|
||||
SendTime time.Time `gorm:"column:send_time;index:sendTime;index:content_type,priority:1;index:session_type,priority:1;index:recv_id,priority:1;index:send_id,priority:1" json:"sendTime"`
|
||||
CreateTime time.Time `gorm:"column:create_time" json:"createTime"`
|
||||
Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"`
|
||||
DB *gorm.DB
|
||||
}
|
||||
|
||||
func (ChatLogModel) TableName() string {
|
||||
|
||||
Reference in New Issue
Block a user