Documentation ¶
Index ¶
- Variables
- func AutoMigrate(values ...interface{})
- func AutoUpgrade(name string, grade func(*gorm.DB) error)
- func Commands(getContext func() context.Context, getClient func() DBAdminClient) (commands []*cobra.Command)
- func Config(v *viper.Viper)
- func DB() *gorm.DB
- func NewOrders(s string, m ...[2]string) (orders []string)
- func Register(server *grpc.Server)
- func RegisterDBAdminServer(s *grpc.Server, srv DBAdminServer)
- func SetDB(db *gorm.DB)
- func Sortby(db *gorm.DB, s string, m ...[2]string) *gorm.DB
- func StartListen()
- func TableNames() (names []string)
- type DBAdminClient
- type DBAdminServer
- type ExecReply
- func (*ExecReply) Descriptor() ([]byte, []int)
- func (m *ExecReply) GetAffected() int64
- func (*ExecReply) ProtoMessage()
- func (m *ExecReply) Reset()
- func (m *ExecReply) String() string
- func (m *ExecReply) XXX_DiscardUnknown()
- func (m *ExecReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ExecReply) XXX_Merge(src proto.Message)
- func (m *ExecReply) XXX_Size() int
- func (m *ExecReply) XXX_Unmarshal(b []byte) error
- type ExecRequest
- func (*ExecRequest) Descriptor() ([]byte, []int)
- func (m *ExecRequest) GetSql() string
- func (*ExecRequest) ProtoMessage()
- func (m *ExecRequest) Reset()
- func (m *ExecRequest) String() string
- func (m *ExecRequest) XXX_DiscardUnknown()
- func (m *ExecRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ExecRequest) XXX_Merge(src proto.Message)
- func (m *ExecRequest) XXX_Size() int
- func (m *ExecRequest) XXX_Unmarshal(b []byte) error
- type QueryReply
- func (*QueryReply) Descriptor() ([]byte, []int)
- func (m *QueryReply) GetResult() []*Result
- func (*QueryReply) ProtoMessage()
- func (m *QueryReply) Reset()
- func (m *QueryReply) String() string
- func (m *QueryReply) XXX_DiscardUnknown()
- func (m *QueryReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryReply) XXX_Merge(src proto.Message)
- func (m *QueryReply) XXX_Size() int
- func (m *QueryReply) XXX_Unmarshal(b []byte) error
- type QueryRequest
- func (*QueryRequest) Descriptor() ([]byte, []int)
- func (m *QueryRequest) GetSql() string
- func (*QueryRequest) ProtoMessage()
- func (m *QueryRequest) Reset()
- func (m *QueryRequest) String() string
- func (m *QueryRequest) XXX_DiscardUnknown()
- func (m *QueryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryRequest) XXX_Merge(src proto.Message)
- func (m *QueryRequest) XXX_Size() int
- func (m *QueryRequest) XXX_Unmarshal(b []byte) error
- type Result
- func (*Result) Descriptor() ([]byte, []int)
- func (m *Result) GetValues() []string
- func (*Result) ProtoMessage()
- func (m *Result) Reset()
- func (m *Result) String() string
- func (m *Result) XXX_DiscardUnknown()
- func (m *Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Result) XXX_Merge(src proto.Message)
- func (m *Result) XXX_Size() int
- func (m *Result) XXX_Unmarshal(b []byte) error
- type Stats
- func (*Stats) Descriptor() ([]byte, []int)
- func (m *Stats) GetIdle() int64
- func (m *Stats) GetInUse() int64
- func (m *Stats) GetMaxIdleClosed() int64
- func (m *Stats) GetMaxLifetimeClosed() int64
- func (m *Stats) GetMaxOpenConnections() int64
- func (m *Stats) GetOpenConnections() int64
- func (m *Stats) GetWaitCount() int64
- func (m *Stats) GetWaitDuration() int64
- func (*Stats) ProtoMessage()
- func (m *Stats) Reset()
- func (m *Stats) String() string
- func (m *Stats) XXX_DiscardUnknown()
- func (m *Stats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Stats) XXX_Merge(src proto.Message)
- func (m *Stats) XXX_Size() int
- func (m *Stats) XXX_Unmarshal(b []byte) error
- type StatsReply
- func (*StatsReply) Descriptor() ([]byte, []int)
- func (m *StatsReply) GetStats() *Stats
- func (*StatsReply) ProtoMessage()
- func (m *StatsReply) Reset()
- func (m *StatsReply) String() string
- func (m *StatsReply) XXX_DiscardUnknown()
- func (m *StatsReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *StatsReply) XXX_Merge(src proto.Message)
- func (m *StatsReply) XXX_Size() int
- func (m *StatsReply) XXX_Unmarshal(b []byte) error
- type StatsRequest
- func (*StatsRequest) Descriptor() ([]byte, []int)
- func (*StatsRequest) ProtoMessage()
- func (m *StatsRequest) Reset()
- func (m *StatsRequest) String() string
- func (m *StatsRequest) XXX_DiscardUnknown()
- func (m *StatsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *StatsRequest) XXX_Merge(src proto.Message)
- func (m *StatsRequest) XXX_Size() int
- func (m *StatsRequest) XXX_Unmarshal(b []byte) error
- type Table
- func (*Table) Descriptor() ([]byte, []int)
- func (m *Table) GetDeleted() int64
- func (m *Table) GetError() string
- func (m *Table) GetRows() int64
- func (*Table) ProtoMessage()
- func (m *Table) Reset()
- func (m *Table) String() string
- func (m *Table) XXX_DiscardUnknown()
- func (m *Table) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Table) XXX_Merge(src proto.Message)
- func (m *Table) XXX_Size() int
- func (m *Table) XXX_Unmarshal(b []byte) error
- type TablesReply
- func (*TablesReply) Descriptor() ([]byte, []int)
- func (m *TablesReply) GetTables() map[string]*Table
- func (*TablesReply) ProtoMessage()
- func (m *TablesReply) Reset()
- func (m *TablesReply) String() string
- func (m *TablesReply) XXX_DiscardUnknown()
- func (m *TablesReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TablesReply) XXX_Merge(src proto.Message)
- func (m *TablesReply) XXX_Size() int
- func (m *TablesReply) XXX_Unmarshal(b []byte) error
- type TablesRequest
- func (*TablesRequest) Descriptor() ([]byte, []int)
- func (*TablesRequest) ProtoMessage()
- func (m *TablesRequest) Reset()
- func (m *TablesRequest) String() string
- func (m *TablesRequest) XXX_DiscardUnknown()
- func (m *TablesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TablesRequest) XXX_Merge(src proto.Message)
- func (m *TablesRequest) XXX_Size() int
- func (m *TablesRequest) XXX_Unmarshal(b []byte) error
- type UnimplementedDBAdminServer
- func (*UnimplementedDBAdminServer) Exec(ctx context.Context, req *ExecRequest) (*ExecReply, error)
- func (*UnimplementedDBAdminServer) Query(ctx context.Context, req *QueryRequest) (*QueryReply, error)
- func (*UnimplementedDBAdminServer) Stats(ctx context.Context, req *StatsRequest) (*StatsReply, error)
- func (*UnimplementedDBAdminServer) Tables(ctx context.Context, req *TablesRequest) (*TablesReply, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
OpenDB = openDB
)
Functions ¶
func AutoMigrate ¶
func AutoMigrate(values ...interface{})
func Commands ¶
func Commands(getContext func() context.Context, getClient func() DBAdminClient) (commands []*cobra.Command)
func NewOrders ¶
NewOrders new orders s: sort string defined in api handbook collections sorting m: mappings
func RegisterDBAdminServer ¶
func RegisterDBAdminServer(s *grpc.Server, srv DBAdminServer)
func StartListen ¶
func StartListen()
func TableNames ¶
func TableNames() (names []string)
Types ¶
type DBAdminClient ¶
type DBAdminClient interface { Stats(ctx context.Context, in *StatsRequest, opts ...grpc.CallOption) (*StatsReply, error) Tables(ctx context.Context, in *TablesRequest, opts ...grpc.CallOption) (*TablesReply, error) Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecReply, error) Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryReply, error) }
DBAdminClient is the client API for DBAdmin service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewDBAdminClient ¶
func NewDBAdminClient(cc *grpc.ClientConn) DBAdminClient
type DBAdminServer ¶
type DBAdminServer interface { Stats(context.Context, *StatsRequest) (*StatsReply, error) Tables(context.Context, *TablesRequest) (*TablesReply, error) Exec(context.Context, *ExecRequest) (*ExecReply, error) Query(context.Context, *QueryRequest) (*QueryReply, error) }
DBAdminServer is the server API for DBAdmin service.
type ExecReply ¶
type ExecReply struct { Affected int64 `protobuf:"varint,1,opt,name=affected,proto3" json:"affected,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ExecReply) Descriptor ¶
func (*ExecReply) GetAffected ¶
func (*ExecReply) ProtoMessage ¶
func (*ExecReply) ProtoMessage()
func (*ExecReply) XXX_DiscardUnknown ¶
func (m *ExecReply) XXX_DiscardUnknown()
func (*ExecReply) XXX_Marshal ¶
func (*ExecReply) XXX_Unmarshal ¶
type ExecRequest ¶
type ExecRequest struct { Sql string `protobuf:"bytes,1,opt,name=sql,proto3" json:"sql,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ExecRequest) Descriptor ¶
func (*ExecRequest) Descriptor() ([]byte, []int)
func (*ExecRequest) GetSql ¶
func (m *ExecRequest) GetSql() string
func (*ExecRequest) ProtoMessage ¶
func (*ExecRequest) ProtoMessage()
func (*ExecRequest) Reset ¶
func (m *ExecRequest) Reset()
func (*ExecRequest) String ¶
func (m *ExecRequest) String() string
func (*ExecRequest) XXX_DiscardUnknown ¶
func (m *ExecRequest) XXX_DiscardUnknown()
func (*ExecRequest) XXX_Marshal ¶
func (m *ExecRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ExecRequest) XXX_Merge ¶
func (m *ExecRequest) XXX_Merge(src proto.Message)
func (*ExecRequest) XXX_Size ¶
func (m *ExecRequest) XXX_Size() int
func (*ExecRequest) XXX_Unmarshal ¶
func (m *ExecRequest) XXX_Unmarshal(b []byte) error
type QueryReply ¶
type QueryReply struct { Result []*Result `protobuf:"bytes,1,rep,name=result,proto3" json:"result,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*QueryReply) Descriptor ¶
func (*QueryReply) Descriptor() ([]byte, []int)
func (*QueryReply) GetResult ¶
func (m *QueryReply) GetResult() []*Result
func (*QueryReply) ProtoMessage ¶
func (*QueryReply) ProtoMessage()
func (*QueryReply) Reset ¶
func (m *QueryReply) Reset()
func (*QueryReply) String ¶
func (m *QueryReply) String() string
func (*QueryReply) XXX_DiscardUnknown ¶
func (m *QueryReply) XXX_DiscardUnknown()
func (*QueryReply) XXX_Marshal ¶
func (m *QueryReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryReply) XXX_Merge ¶
func (m *QueryReply) XXX_Merge(src proto.Message)
func (*QueryReply) XXX_Size ¶
func (m *QueryReply) XXX_Size() int
func (*QueryReply) XXX_Unmarshal ¶
func (m *QueryReply) XXX_Unmarshal(b []byte) error
type QueryRequest ¶
type QueryRequest struct { Sql string `protobuf:"bytes,1,opt,name=sql,proto3" json:"sql,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*QueryRequest) Descriptor ¶
func (*QueryRequest) Descriptor() ([]byte, []int)
func (*QueryRequest) GetSql ¶
func (m *QueryRequest) GetSql() string
func (*QueryRequest) ProtoMessage ¶
func (*QueryRequest) ProtoMessage()
func (*QueryRequest) Reset ¶
func (m *QueryRequest) Reset()
func (*QueryRequest) String ¶
func (m *QueryRequest) String() string
func (*QueryRequest) XXX_DiscardUnknown ¶
func (m *QueryRequest) XXX_DiscardUnknown()
func (*QueryRequest) XXX_Marshal ¶
func (m *QueryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryRequest) XXX_Merge ¶
func (m *QueryRequest) XXX_Merge(src proto.Message)
func (*QueryRequest) XXX_Size ¶
func (m *QueryRequest) XXX_Size() int
func (*QueryRequest) XXX_Unmarshal ¶
func (m *QueryRequest) XXX_Unmarshal(b []byte) error
type Result ¶
type Result struct { Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Result) Descriptor ¶
func (*Result) ProtoMessage ¶
func (*Result) ProtoMessage()
func (*Result) XXX_DiscardUnknown ¶
func (m *Result) XXX_DiscardUnknown()
func (*Result) XXX_Marshal ¶
func (*Result) XXX_Unmarshal ¶
type Stats ¶
type Stats struct { MaxOpenConnections int64 `protobuf:"varint,1,opt,name=max_open_connections,json=maxOpenConnections,proto3" json:"max_open_connections,omitempty"` OpenConnections int64 `protobuf:"varint,2,opt,name=open_connections,json=openConnections,proto3" json:"open_connections,omitempty"` InUse int64 `protobuf:"varint,3,opt,name=in_use,json=inUse,proto3" json:"in_use,omitempty"` Idle int64 `protobuf:"varint,4,opt,name=idle,proto3" json:"idle,omitempty"` WaitCount int64 `protobuf:"varint,5,opt,name=wait_count,json=waitCount,proto3" json:"wait_count,omitempty"` WaitDuration int64 `protobuf:"varint,6,opt,name=wait_duration,json=waitDuration,proto3" json:"wait_duration,omitempty"` MaxIdleClosed int64 `protobuf:"varint,7,opt,name=max_idle_closed,json=maxIdleClosed,proto3" json:"max_idle_closed,omitempty"` MaxLifetimeClosed int64 `protobuf:"varint,8,opt,name=max_lifetime_closed,json=maxLifetimeClosed,proto3" json:"max_lifetime_closed,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Stats) Descriptor ¶
func (*Stats) GetMaxIdleClosed ¶
func (*Stats) GetMaxLifetimeClosed ¶
func (*Stats) GetMaxOpenConnections ¶
func (*Stats) GetOpenConnections ¶
func (*Stats) GetWaitCount ¶
func (*Stats) GetWaitDuration ¶
func (*Stats) ProtoMessage ¶
func (*Stats) ProtoMessage()
func (*Stats) XXX_DiscardUnknown ¶
func (m *Stats) XXX_DiscardUnknown()
func (*Stats) XXX_Marshal ¶
func (*Stats) XXX_Unmarshal ¶
type StatsReply ¶
type StatsReply struct { Stats *Stats `protobuf:"bytes,1,opt,name=stats,proto3" json:"stats,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*StatsReply) Descriptor ¶
func (*StatsReply) Descriptor() ([]byte, []int)
func (*StatsReply) GetStats ¶
func (m *StatsReply) GetStats() *Stats
func (*StatsReply) ProtoMessage ¶
func (*StatsReply) ProtoMessage()
func (*StatsReply) Reset ¶
func (m *StatsReply) Reset()
func (*StatsReply) String ¶
func (m *StatsReply) String() string
func (*StatsReply) XXX_DiscardUnknown ¶
func (m *StatsReply) XXX_DiscardUnknown()
func (*StatsReply) XXX_Marshal ¶
func (m *StatsReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*StatsReply) XXX_Merge ¶
func (m *StatsReply) XXX_Merge(src proto.Message)
func (*StatsReply) XXX_Size ¶
func (m *StatsReply) XXX_Size() int
func (*StatsReply) XXX_Unmarshal ¶
func (m *StatsReply) XXX_Unmarshal(b []byte) error
type StatsRequest ¶
type StatsRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*StatsRequest) Descriptor ¶
func (*StatsRequest) Descriptor() ([]byte, []int)
func (*StatsRequest) ProtoMessage ¶
func (*StatsRequest) ProtoMessage()
func (*StatsRequest) Reset ¶
func (m *StatsRequest) Reset()
func (*StatsRequest) String ¶
func (m *StatsRequest) String() string
func (*StatsRequest) XXX_DiscardUnknown ¶
func (m *StatsRequest) XXX_DiscardUnknown()
func (*StatsRequest) XXX_Marshal ¶
func (m *StatsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*StatsRequest) XXX_Merge ¶
func (m *StatsRequest) XXX_Merge(src proto.Message)
func (*StatsRequest) XXX_Size ¶
func (m *StatsRequest) XXX_Size() int
func (*StatsRequest) XXX_Unmarshal ¶
func (m *StatsRequest) XXX_Unmarshal(b []byte) error
type Table ¶
type Table struct { Rows int64 `protobuf:"varint,2,opt,name=rows,proto3" json:"rows,omitempty"` Deleted int64 `protobuf:"varint,3,opt,name=deleted,proto3" json:"deleted,omitempty"` Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Table) Descriptor ¶
func (*Table) GetDeleted ¶
func (*Table) ProtoMessage ¶
func (*Table) ProtoMessage()
func (*Table) XXX_DiscardUnknown ¶
func (m *Table) XXX_DiscardUnknown()
func (*Table) XXX_Marshal ¶
func (*Table) XXX_Unmarshal ¶
type TablesReply ¶
type TablesReply struct { Tables map[string]*Table `` /* 153-byte string literal not displayed */ XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*TablesReply) Descriptor ¶
func (*TablesReply) Descriptor() ([]byte, []int)
func (*TablesReply) GetTables ¶
func (m *TablesReply) GetTables() map[string]*Table
func (*TablesReply) ProtoMessage ¶
func (*TablesReply) ProtoMessage()
func (*TablesReply) Reset ¶
func (m *TablesReply) Reset()
func (*TablesReply) String ¶
func (m *TablesReply) String() string
func (*TablesReply) XXX_DiscardUnknown ¶
func (m *TablesReply) XXX_DiscardUnknown()
func (*TablesReply) XXX_Marshal ¶
func (m *TablesReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*TablesReply) XXX_Merge ¶
func (m *TablesReply) XXX_Merge(src proto.Message)
func (*TablesReply) XXX_Size ¶
func (m *TablesReply) XXX_Size() int
func (*TablesReply) XXX_Unmarshal ¶
func (m *TablesReply) XXX_Unmarshal(b []byte) error
type TablesRequest ¶
type TablesRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*TablesRequest) Descriptor ¶
func (*TablesRequest) Descriptor() ([]byte, []int)
func (*TablesRequest) ProtoMessage ¶
func (*TablesRequest) ProtoMessage()
func (*TablesRequest) Reset ¶
func (m *TablesRequest) Reset()
func (*TablesRequest) String ¶
func (m *TablesRequest) String() string
func (*TablesRequest) XXX_DiscardUnknown ¶
func (m *TablesRequest) XXX_DiscardUnknown()
func (*TablesRequest) XXX_Marshal ¶
func (m *TablesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*TablesRequest) XXX_Merge ¶
func (m *TablesRequest) XXX_Merge(src proto.Message)
func (*TablesRequest) XXX_Size ¶
func (m *TablesRequest) XXX_Size() int
func (*TablesRequest) XXX_Unmarshal ¶
func (m *TablesRequest) XXX_Unmarshal(b []byte) error
type UnimplementedDBAdminServer ¶
type UnimplementedDBAdminServer struct { }
UnimplementedDBAdminServer can be embedded to have forward compatible implementations.
func (*UnimplementedDBAdminServer) Exec ¶
func (*UnimplementedDBAdminServer) Exec(ctx context.Context, req *ExecRequest) (*ExecReply, error)
func (*UnimplementedDBAdminServer) Query ¶
func (*UnimplementedDBAdminServer) Query(ctx context.Context, req *QueryRequest) (*QueryReply, error)
func (*UnimplementedDBAdminServer) Stats ¶
func (*UnimplementedDBAdminServer) Stats(ctx context.Context, req *StatsRequest) (*StatsReply, error)
func (*UnimplementedDBAdminServer) Tables ¶
func (*UnimplementedDBAdminServer) Tables(ctx context.Context, req *TablesRequest) (*TablesReply, error)
Click to show internal directories.
Click to hide internal directories.