Documentation ¶
Index ¶
- Variables
- func GetProtoDBType(fieldType protoreflect.Kind) string
- type DMLResult
- type FieldDbType
- func (FieldDbType) Descriptor() protoreflect.EnumDescriptor
- func (x FieldDbType) Enum() *FieldDbType
- func (FieldDbType) EnumDescriptor() ([]byte, []int)deprecated
- func (x FieldDbType) Number() protoreflect.EnumNumber
- func (x FieldDbType) String() string
- func (FieldDbType) Type() protoreflect.EnumType
- type PDBField
- func (*PDBField) Descriptor() ([]byte, []int)deprecated
- func (x *PDBField) GetComment() []string
- func (x *PDBField) GetDbType() FieldDbType
- func (x *PDBField) GetDbTypeStr() string
- func (x *PDBField) GetDefaultValue() string
- func (x *PDBField) GetNoInsert() bool
- func (x *PDBField) GetNoUpdate() bool
- func (x *PDBField) GetNotDB() bool
- func (x *PDBField) GetNotNull() bool
- func (x *PDBField) GetPrimary() bool
- func (x *PDBField) GetReference() string
- func (x *PDBField) GetSQLAppend() []string
- func (x *PDBField) GetSQLAppendsEnd() []string
- func (x *PDBField) GetSerialType() int32
- func (x *PDBField) GetUnique() bool
- func (x *PDBField) GetUniqueName() string
- func (x *PDBField) GetZeroAsNull() bool
- func (x *PDBField) IsAutoIncrement() bool
- func (x *PDBField) IsNoUpdate() bool
- func (x *PDBField) IsNotDB() bool
- func (x *PDBField) IsNotNull() bool
- func (x *PDBField) IsPrimary() bool
- func (x *PDBField) IsReference() bool
- func (x *PDBField) IsSerial() bool
- func (x *PDBField) IsUnique() bool
- func (x *PDBField) IsZeroAsNull() bool
- func (x *PDBField) NeedInInsert() bool
- func (x *PDBField) NeedInUpdate() bool
- func (x *PDBField) PdbDbTypeStr(fieldMsg protoreflect.FieldDescriptor) string
- func (*PDBField) ProtoMessage()
- func (x *PDBField) ProtoReflect() protoreflect.Message
- func (x *PDBField) Reset()
- func (x *PDBField) String() string
- type PDBFile
- type PDBMsg
- func (*PDBMsg) Descriptor() ([]byte, []int)deprecated
- func (x *PDBMsg) GetComment() []string
- func (x *PDBMsg) GetMsgList() int32
- func (x *PDBMsg) GetSQLAppend() []string
- func (x *PDBMsg) GetSQLAppendsAfter() []string
- func (x *PDBMsg) GetSQLAppendsEnd() []string
- func (x *PDBMsg) GetSQLPrepend() []string
- func (*PDBMsg) ProtoMessage()
- func (x *PDBMsg) ProtoReflect() protoreflect.Message
- func (x *PDBMsg) Reset()
- func (x *PDBMsg) String() string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( FieldDbType_name = map[int32]string{ 0: "AutoMatch", 1: "BOOL", 2: "INT32", 3: "INT64", 4: "FLOAT", 5: "DOUBLE", 6: "TEXT", 7: "JSONB", 8: "UUID", 9: "TIMESTAMP", 10: "DATE", 11: "BYTEA", 12: "INET", 13: "UINT32", } FieldDbType_value = map[string]int32{ "AutoMatch": 0, "BOOL": 1, "INT32": 2, "INT64": 3, "FLOAT": 4, "DOUBLE": 5, "TEXT": 6, "JSONB": 7, "UUID": 8, "TIMESTAMP": 9, "DATE": 10, "BYTEA": 11, "INET": 12, "UINT32": 13, } )
Enum value maps for FieldDbType.
View Source
var (
// optional protodb.PDBField pdb = 1888;
E_Pdb = &file_protodb_proto_extTypes[2]
)
Extension fields to descriptorpb.FieldOptions.
View Source
var (
// optional protodb.PDBFile pdbf = 1888;
E_Pdbf = &file_protodb_proto_extTypes[0]
)
Extension fields to descriptorpb.FileOptions.
View Source
var (
// optional protodb.PDBMsg pdbm = 1888;
E_Pdbm = &file_protodb_proto_extTypes[1]
)
Extension fields to descriptorpb.MessageOptions.
View Source
var File_protodb_proto protoreflect.FileDescriptor
Functions ¶
func GetProtoDBType ¶ added in v0.1.5
func GetProtoDBType(fieldType protoreflect.Kind) string
Types ¶
type DMLResult ¶ added in v0.1.5
type DMLResult struct { // RowsAffected in dml operation RowsAffected int64 `protobuf:"varint,1,opt,name=RowsAffected,proto3" json:"RowsAffected,omitempty"` // err info when error happened ErrInfo string `protobuf:"bytes,2,opt,name=ErrInfo,proto3" json:"ErrInfo,omitempty"` // contains filtered or unexported fields }
CRUD DML Result
func (*DMLResult) Descriptor
deprecated
added in
v0.1.5
func (*DMLResult) GetErrInfo ¶ added in v0.1.5
func (*DMLResult) GetRowsAffected ¶ added in v0.1.5
func (*DMLResult) ProtoMessage ¶ added in v0.1.5
func (*DMLResult) ProtoMessage()
func (*DMLResult) ProtoReflect ¶ added in v0.1.5
func (x *DMLResult) ProtoReflect() protoreflect.Message
type FieldDbType ¶ added in v0.1.3
type FieldDbType int32
const ( // auto match db type if DbTypeStr not set // pb type -> db type // bool -> bool // string -> text // int32 -> int // int64,uint32 -> bigint // float -> float // double -> double precision // bytes -> bytea FieldDbType_AutoMatch FieldDbType = 0 FieldDbType_BOOL FieldDbType = 1 FieldDbType_INT32 FieldDbType = 2 FieldDbType_INT64 FieldDbType = 3 FieldDbType_FLOAT FieldDbType = 4 FieldDbType_DOUBLE FieldDbType = 5 FieldDbType_TEXT FieldDbType = 6 FieldDbType_JSONB FieldDbType = 7 FieldDbType_UUID FieldDbType = 8 FieldDbType_TIMESTAMP FieldDbType = 9 FieldDbType_DATE FieldDbType = 10 FieldDbType_BYTEA FieldDbType = 11 // ipv4 or ipv6 address FieldDbType_INET FieldDbType = 12 FieldDbType_UINT32 FieldDbType = 13 )
func (FieldDbType) Descriptor ¶ added in v0.1.3
func (FieldDbType) Descriptor() protoreflect.EnumDescriptor
func (FieldDbType) Enum ¶ added in v0.1.3
func (x FieldDbType) Enum() *FieldDbType
func (FieldDbType) EnumDescriptor
deprecated
added in
v0.1.3
func (FieldDbType) EnumDescriptor() ([]byte, []int)
Deprecated: Use FieldDbType.Descriptor instead.
func (FieldDbType) Number ¶ added in v0.1.3
func (x FieldDbType) Number() protoreflect.EnumNumber
func (FieldDbType) String ¶ added in v0.1.3
func (x FieldDbType) String() string
func (FieldDbType) Type ¶ added in v0.1.3
func (FieldDbType) Type() protoreflect.EnumType
type PDBField ¶
type PDBField struct { // do not generate db field in create table // when in update, do not update this field NotDB bool `protobuf:"varint,1,opt,name=NotDB,proto3" json:"NotDB,omitempty"` // is primary key Primary bool `protobuf:"varint,2,opt,name=Primary,proto3" json:"Primary,omitempty"` // is unique key, if the unique include multiple columns, specify the UniqueName Unique bool `protobuf:"varint,3,opt,name=Unique,proto3" json:"Unique,omitempty"` // is not null NotNull bool `protobuf:"varint,4,opt,name=NotNull,proto3" json:"NotNull,omitempty"` // reference to other table, sql like: REFERENCES other_table(other_field) Reference string `protobuf:"bytes,5,opt,name=Reference,proto3" json:"Reference,omitempty"` // default value DefaultValue string `protobuf:"bytes,6,opt,name=DefaultValue,proto3" json:"DefaultValue,omitempty"` // append sql before , SQLAppend []string `protobuf:"bytes,7,rep,name=SQLAppend,proto3" json:"SQLAppend,omitempty"` // append sql after , SQLAppendsEnd []string `protobuf:"bytes,8,rep,name=SQLAppendsEnd,proto3" json:"SQLAppendsEnd,omitempty"` // db no update // when in update, do not update this field, for example, create time NoUpdate bool `protobuf:"varint,9,opt,name=NoUpdate,proto3" json:"NoUpdate,omitempty"` // serial type 0:not serial type 2:smallint(serial2) 4:integer(serial4) 8:bigint(serial8) // strong advice not use serial type,it's hard in distributed system SerialType int32 `protobuf:"varint,10,opt,name=SerialType,proto3" json:"SerialType,omitempty"` // db type DbType FieldDbType `protobuf:"varint,11,opt,name=DbType,proto3,enum=protodb.FieldDbType" json:"DbType,omitempty"` // use custom db type when DbType is not good fit DbTypeStr string `protobuf:"bytes,12,opt,name=DbTypeStr,proto3" json:"DbTypeStr,omitempty"` // zero value treat as null for insert,update, especially for reference field ZeroAsNull bool `protobuf:"varint,13,opt,name=ZeroAsNull,proto3" json:"ZeroAsNull,omitempty"` // db no insert // when in insert, do not insert this field, for example, database has default value NoInsert bool `protobuf:"varint,14,opt,name=NoInsert,proto3" json:"NoInsert,omitempty"` // comment for field Comment []string `protobuf:"bytes,15,rep,name=Comment,proto3" json:"Comment,omitempty"` // unique group name // when a unique constrain include multiple column, specify the a group name for it UniqueName string `protobuf:"bytes,16,opt,name=UniqueName,proto3" json:"UniqueName,omitempty"` // contains filtered or unexported fields }
func (*PDBField) Descriptor
deprecated
func (*PDBField) GetComment ¶ added in v0.1.5
func (*PDBField) GetDbType ¶ added in v0.1.3
func (x *PDBField) GetDbType() FieldDbType
func (*PDBField) GetDbTypeStr ¶ added in v0.1.3
func (*PDBField) GetDefaultValue ¶
func (*PDBField) GetNoInsert ¶ added in v0.1.5
func (*PDBField) GetNoUpdate ¶
func (*PDBField) GetNotNull ¶ added in v0.1.3
func (*PDBField) GetPrimary ¶ added in v0.1.3
func (*PDBField) GetReference ¶
func (*PDBField) GetSQLAppend ¶ added in v0.1.3
func (*PDBField) GetSQLAppendsEnd ¶
func (*PDBField) GetSerialType ¶
func (*PDBField) GetUniqueName ¶ added in v0.1.5
func (*PDBField) GetZeroAsNull ¶ added in v0.1.3
func (*PDBField) IsAutoIncrement ¶ added in v0.1.5
is auto increment
func (*PDBField) NeedInInsert ¶ added in v0.1.5
need in insert
func (*PDBField) NeedInUpdate ¶ added in v0.1.5
need in update
func (*PDBField) PdbDbTypeStr ¶ added in v0.1.5
func (x *PDBField) PdbDbTypeStr(fieldMsg protoreflect.FieldDescriptor) string
PdbDbTypeStr get db type string from pdb if specified
func (*PDBField) ProtoMessage ¶
func (*PDBField) ProtoMessage()
func (*PDBField) ProtoReflect ¶
func (x *PDBField) ProtoReflect() protoreflect.Message
type PDBFile ¶
type PDBFile struct { // name style(msg & field) // empty='go': default, go name style, better performance in crud operation in // go (like: UserName) 'snake': snake name style (like: user_name) NameStyle string `protobuf:"bytes,1,opt,name=NameStyle,proto3" json:"NameStyle,omitempty"` // comment for file Comment []string `protobuf:"bytes,2,rep,name=Comment,proto3" json:"Comment,omitempty"` // contains filtered or unexported fields }
func (*PDBFile) Descriptor
deprecated
func (*PDBFile) GetComment ¶ added in v0.1.5
func (*PDBFile) GetNameStyle ¶
func (*PDBFile) ProtoMessage ¶
func (*PDBFile) ProtoMessage()
func (*PDBFile) ProtoReflect ¶
func (x *PDBFile) ProtoReflect() protoreflect.Message
type PDBMsg ¶
type PDBMsg struct { // comment for table Comment []string `protobuf:"bytes,1,rep,name=Comment,proto3" json:"Comment,omitempty"` // sql prepends before create table SQLPrepend []string `protobuf:"bytes,2,rep,name=SQLPrepend,proto3" json:"SQLPrepend,omitempty"` // sql appends before ) SQLAppend []string `protobuf:"bytes,3,rep,name=SQLAppend,proto3" json:"SQLAppend,omitempty"` // sql appends after ) before ; SQLAppendsAfter []string `protobuf:"bytes,4,rep,name=SQLAppendsAfter,proto3" json:"SQLAppendsAfter,omitempty"` // sql appends after ; SQLAppendsEnd []string `protobuf:"bytes,5,rep,name=SQLAppendsEnd,proto3" json:"SQLAppendsEnd,omitempty"` // generate proto msg { {msg}}List in xxx.list.proto // 0: auto if msg name start with db then generate { {msg}}List // 1: always generate { {msg}}List // 4: never generate { {msg}}List MsgList int32 `protobuf:"varint,6,opt,name=MsgList,proto3" json:"MsgList,omitempty"` // contains filtered or unexported fields }
func (*PDBMsg) Descriptor
deprecated
func (*PDBMsg) GetComment ¶ added in v0.1.5
func (*PDBMsg) GetMsgList ¶ added in v0.1.1
func (*PDBMsg) GetSQLAppend ¶ added in v0.1.3
func (*PDBMsg) GetSQLAppendsAfter ¶
func (*PDBMsg) GetSQLAppendsEnd ¶
func (*PDBMsg) GetSQLPrepend ¶ added in v0.1.3
func (*PDBMsg) ProtoMessage ¶
func (*PDBMsg) ProtoMessage()
func (*PDBMsg) ProtoReflect ¶
func (x *PDBMsg) ProtoReflect() protoreflect.Message
Click to show internal directories.
Click to hide internal directories.