Documentation ¶
Index ¶
- Constants
- Variables
- func ParseSort(fields []string) string
- type Address
- func (*Address) Descriptor() ([]byte, []int)deprecated
- func (x *Address) GetCity() string
- func (x *Address) GetCountry() string
- func (x *Address) GetLatitude() string
- func (x *Address) GetLine1() string
- func (x *Address) GetLine2() string
- func (x *Address) GetLine3() string
- func (x *Address) GetLongitude() string
- func (x *Address) GetState() string
- func (x *Address) GetZipCode() string
- func (*Address) ProtoMessage()
- func (x *Address) ProtoReflect() protoreflect.Message
- func (x *Address) Reset()
- func (x *Address) String() string
- type AddressEntity
- type AfterCreate
- type AfterDelete
- type AfterUpdate
- type BeforeCreate
- type BeforeDelete
- type BeforeUpdate
- type DynamicValue
- func (*DynamicValue) Descriptor() ([]byte, []int)deprecated
- func (x *DynamicValue) GetBoolValue() bool
- func (x *DynamicValue) GetDoubleValue() float64
- func (x *DynamicValue) GetFloatValue() float32
- func (x *DynamicValue) GetIntValue() int32
- func (x *DynamicValue) GetJsonValue() *structpb.Struct
- func (x *DynamicValue) GetLongValue() int64
- func (x *DynamicValue) GetNullValue() structpb.NullValue
- func (x *DynamicValue) GetStringValue() string
- func (m *DynamicValue) GetValue() isDynamicValue_Value
- func (*DynamicValue) ProtoMessage()
- func (x *DynamicValue) ProtoReflect() protoreflect.Message
- func (x *DynamicValue) Reset()
- func (x *DynamicValue) String() string
- type DynamicValueFilter
- func (*DynamicValueFilter) Descriptor() ([]byte, []int)deprecated
- func (x *DynamicValueFilter) GetBoolValue() *query.BooleanFilterOperators
- func (x *DynamicValueFilter) GetDoubleValue() *query.DoubleFilterOperators
- func (m *DynamicValueFilter) GetFilter() isDynamicValueFilter_Filter
- func (x *DynamicValueFilter) GetFloatValue() *query.FloatFilterOperators
- func (x *DynamicValueFilter) GetIntValue() *query.Int32FilterOperators
- func (x *DynamicValueFilter) GetLongValue() *query.Int64FilterOperators
- func (x *DynamicValueFilter) GetNullValue() *query.NullFilterOperators
- func (x *DynamicValueFilter) GetStringValue() *query.StringFilterOperation
- func (*DynamicValueFilter) ProtoMessage()
- func (x *DynamicValueFilter) ProtoReflect() protoreflect.Message
- func (x *DynamicValueFilter) Reset()
- func (x *DynamicValueFilter) String() string
- type DynamicValueFilter_BoolValue
- type DynamicValueFilter_DoubleValue
- type DynamicValueFilter_FloatValue
- type DynamicValueFilter_IntValue
- type DynamicValueFilter_LongValue
- type DynamicValueFilter_NullValue
- type DynamicValueFilter_StringValue
- type DynamicValue_BoolValue
- type DynamicValue_DoubleValue
- type DynamicValue_FloatValue
- type DynamicValue_IntValue
- type DynamicValue_JsonValue
- type DynamicValue_LongValue
- type DynamicValue_NullValue
- type DynamicValue_StringValue
- type JSONMap
- func (JSONMap) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (m JSONMap) GormDataType() string
- func (m JSONMap) GormValue(ctx context.Context, db *gorm.DB) clause.Expr
- func (m JSONMap) MarshalJSON() ([]byte, error)
- func (m *JSONMap) Scan(val interface{}) error
- func (m *JSONMap) UnmarshalJSON(b []byte) error
- func (m JSONMap) Value() (driver.Value, error)
- type Repo
- type SortOpt
- type Value
- func (v *Value) GetNativeValue() interface{}
- func (v *Value) RunIfBool(f func(v bool))
- func (v *Value) RunIfDouble(f func(v float64))
- func (v *Value) RunIfFloat(f func(v float32))
- func (v *Value) RunIfInt(f func(v int32))
- func (v *Value) RunIfJson(f func(v map[string]interface{}))
- func (v *Value) RunIfLong(f func(v int64))
- func (v *Value) RunIfNull(f func())
- func (v *Value) RunIfString(f func(v string))
- func (v *Value) SetAsBool(value bool)
- func (v *Value) SetAsDouble(value float64)
- func (v *Value) SetAsFloat(value float32)
- func (v *Value) SetAsInt(value int32)
- func (v *Value) SetAsJson(value map[string]interface{})
- func (v *Value) SetAsLong(value int64)
- func (v *Value) SetAsNull()
- func (v *Value) SetAsString(value string)
- func (v *Value) ToDynamicValue() *DynamicValue
- func (v *Value) ToStructPb() *structpb.Value
Constants ¶
View Source
const BoolKind = "bool"
View Source
const DoubleKind = "double"
View Source
const FloatKind = "float"
View Source
const IntKind = "int"
View Source
const JsonKind = "json"
View Source
const LongKind = "long"
View Source
const NullKind = "null"
View Source
const StringKind = "string"
Variables ¶
View Source
var File_data_address_proto protoreflect.FileDescriptor
View Source
var File_data_data_proto protoreflect.FileDescriptor
Functions ¶
Types ¶
type Address ¶
type Address struct { //Country or region Country string `protobuf:"bytes,1,opt,name=country,proto3" json:"country,omitempty"` //State or province State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` City string `protobuf:"bytes,3,opt,name=city,proto3" json:"city,omitempty"` ZipCode string `protobuf:"bytes,4,opt,name=zip_code,json=zipCode,proto3" json:"zip_code,omitempty"` Line1 string `protobuf:"bytes,5,opt,name=line1,proto3" json:"line1,omitempty"` Line2 string `protobuf:"bytes,6,opt,name=line2,proto3" json:"line2,omitempty"` Line3 string `protobuf:"bytes,7,opt,name=line3,proto3" json:"line3,omitempty"` Longitude string `protobuf:"bytes,8,opt,name=longitude,proto3" json:"longitude,omitempty"` Latitude string `protobuf:"bytes,9,opt,name=latitude,proto3" json:"latitude,omitempty"` // contains filtered or unexported fields }
func (*Address) Descriptor
deprecated
func (*Address) GetCountry ¶
func (*Address) GetLatitude ¶
func (*Address) GetLongitude ¶
func (*Address) GetZipCode ¶
func (*Address) ProtoMessage ¶
func (*Address) ProtoMessage()
func (*Address) ProtoReflect ¶
func (x *Address) ProtoReflect() protoreflect.Message
type AddressEntity ¶
type AddressEntity struct { //Country or region Country string //State or province State string City string ZipCode string Line1 string Line2 string Line3 string //TODO database geo? Longitude string //TODO database geo? Latitude string }
func NewAddressEntityFromPb ¶
func NewAddressEntityFromPb(s *Address) *AddressEntity
func (*AddressEntity) ToPb ¶
func (s *AddressEntity) ToPb() *Address
type AfterCreate ¶
type AfterCreate[TEntity any] struct { Entity TEntity }
func NewAfterCreate ¶
func NewAfterCreate[TEntity any](entity TEntity) *AfterCreate[TEntity]
type AfterDelete ¶
type AfterDelete[TEntity any] struct { Entity TEntity }
func NewAfterDelete ¶
func NewAfterDelete[TEntity any](entity TEntity) *AfterDelete[TEntity]
type AfterUpdate ¶
type AfterUpdate[TEntity any] struct { Entity TEntity }
func NewAfterUpdate ¶
func NewAfterUpdate[TEntity any](entity TEntity) *AfterUpdate[TEntity]
type BeforeCreate ¶
type BeforeCreate[TEntity any] struct { Entity TEntity }
func NewBeforeCreate ¶
func NewBeforeCreate[TEntity any](entity TEntity) *BeforeCreate[TEntity]
type BeforeDelete ¶
type BeforeDelete[TEntity any] struct { Entity TEntity }
func NewBeforeDelete ¶
func NewBeforeDelete[TEntity any](entity TEntity) *BeforeDelete[TEntity]
type BeforeUpdate ¶
func NewBeforeUpdate ¶
func NewBeforeUpdate[TEntity any](entity TEntity) *BeforeUpdate[TEntity]
type DynamicValue ¶
type DynamicValue struct { // Types that are assignable to Value: // *DynamicValue_IntValue // *DynamicValue_LongValue // *DynamicValue_FloatValue // *DynamicValue_DoubleValue // *DynamicValue_StringValue // *DynamicValue_BoolValue // *DynamicValue_NullValue // *DynamicValue_JsonValue Value isDynamicValue_Value `protobuf_oneof:"value"` // contains filtered or unexported fields }
func (*DynamicValue) Descriptor
deprecated
func (*DynamicValue) Descriptor() ([]byte, []int)
Deprecated: Use DynamicValue.ProtoReflect.Descriptor instead.
func (*DynamicValue) GetBoolValue ¶
func (x *DynamicValue) GetBoolValue() bool
func (*DynamicValue) GetDoubleValue ¶
func (x *DynamicValue) GetDoubleValue() float64
func (*DynamicValue) GetFloatValue ¶
func (x *DynamicValue) GetFloatValue() float32
func (*DynamicValue) GetIntValue ¶
func (x *DynamicValue) GetIntValue() int32
func (*DynamicValue) GetJsonValue ¶
func (x *DynamicValue) GetJsonValue() *structpb.Struct
func (*DynamicValue) GetLongValue ¶
func (x *DynamicValue) GetLongValue() int64
func (*DynamicValue) GetNullValue ¶
func (x *DynamicValue) GetNullValue() structpb.NullValue
func (*DynamicValue) GetStringValue ¶
func (x *DynamicValue) GetStringValue() string
func (*DynamicValue) GetValue ¶
func (m *DynamicValue) GetValue() isDynamicValue_Value
func (*DynamicValue) ProtoMessage ¶
func (*DynamicValue) ProtoMessage()
func (*DynamicValue) ProtoReflect ¶
func (x *DynamicValue) ProtoReflect() protoreflect.Message
func (*DynamicValue) Reset ¶
func (x *DynamicValue) Reset()
func (*DynamicValue) String ¶
func (x *DynamicValue) String() string
type DynamicValueFilter ¶
type DynamicValueFilter struct { // Types that are assignable to Filter: // *DynamicValueFilter_IntValue // *DynamicValueFilter_LongValue // *DynamicValueFilter_FloatValue // *DynamicValueFilter_DoubleValue // *DynamicValueFilter_StringValue // *DynamicValueFilter_BoolValue // *DynamicValueFilter_NullValue Filter isDynamicValueFilter_Filter `protobuf_oneof:"filter"` // contains filtered or unexported fields }
func (*DynamicValueFilter) Descriptor
deprecated
func (*DynamicValueFilter) Descriptor() ([]byte, []int)
Deprecated: Use DynamicValueFilter.ProtoReflect.Descriptor instead.
func (*DynamicValueFilter) GetBoolValue ¶
func (x *DynamicValueFilter) GetBoolValue() *query.BooleanFilterOperators
func (*DynamicValueFilter) GetDoubleValue ¶
func (x *DynamicValueFilter) GetDoubleValue() *query.DoubleFilterOperators
func (*DynamicValueFilter) GetFilter ¶
func (m *DynamicValueFilter) GetFilter() isDynamicValueFilter_Filter
func (*DynamicValueFilter) GetFloatValue ¶
func (x *DynamicValueFilter) GetFloatValue() *query.FloatFilterOperators
func (*DynamicValueFilter) GetIntValue ¶
func (x *DynamicValueFilter) GetIntValue() *query.Int32FilterOperators
func (*DynamicValueFilter) GetLongValue ¶
func (x *DynamicValueFilter) GetLongValue() *query.Int64FilterOperators
func (*DynamicValueFilter) GetNullValue ¶
func (x *DynamicValueFilter) GetNullValue() *query.NullFilterOperators
func (*DynamicValueFilter) GetStringValue ¶
func (x *DynamicValueFilter) GetStringValue() *query.StringFilterOperation
func (*DynamicValueFilter) ProtoMessage ¶
func (*DynamicValueFilter) ProtoMessage()
func (*DynamicValueFilter) ProtoReflect ¶
func (x *DynamicValueFilter) ProtoReflect() protoreflect.Message
func (*DynamicValueFilter) Reset ¶
func (x *DynamicValueFilter) Reset()
func (*DynamicValueFilter) String ¶
func (x *DynamicValueFilter) String() string
type DynamicValueFilter_BoolValue ¶
type DynamicValueFilter_BoolValue struct {
BoolValue *query.BooleanFilterOperators `protobuf:"bytes,7,opt,name=bool_value,json=boolValue,proto3,oneof"`
}
type DynamicValueFilter_DoubleValue ¶
type DynamicValueFilter_DoubleValue struct {
DoubleValue *query.DoubleFilterOperators `protobuf:"bytes,5,opt,name=double_value,json=doubleValue,proto3,oneof"`
}
type DynamicValueFilter_FloatValue ¶
type DynamicValueFilter_FloatValue struct {
FloatValue *query.FloatFilterOperators `protobuf:"bytes,4,opt,name=float_value,json=floatValue,proto3,oneof"`
}
type DynamicValueFilter_IntValue ¶
type DynamicValueFilter_IntValue struct {
IntValue *query.Int32FilterOperators `protobuf:"bytes,2,opt,name=int_value,json=intValue,proto3,oneof"`
}
type DynamicValueFilter_LongValue ¶
type DynamicValueFilter_LongValue struct {
LongValue *query.Int64FilterOperators `protobuf:"bytes,3,opt,name=long_value,json=longValue,proto3,oneof"`
}
type DynamicValueFilter_NullValue ¶
type DynamicValueFilter_NullValue struct {
NullValue *query.NullFilterOperators `protobuf:"bytes,8,opt,name=null_value,json=nullValue,proto3,oneof"`
}
type DynamicValueFilter_StringValue ¶
type DynamicValueFilter_StringValue struct {
StringValue *query.StringFilterOperation `protobuf:"bytes,6,opt,name=string_value,json=stringValue,proto3,oneof"`
}
type DynamicValue_BoolValue ¶
type DynamicValue_BoolValue struct {
BoolValue bool `protobuf:"varint,7,opt,name=bool_value,json=boolValue,proto3,oneof"`
}
type DynamicValue_DoubleValue ¶
type DynamicValue_DoubleValue struct {
DoubleValue float64 `protobuf:"fixed64,5,opt,name=double_value,json=doubleValue,proto3,oneof"`
}
type DynamicValue_FloatValue ¶
type DynamicValue_FloatValue struct {
FloatValue float32 `protobuf:"fixed32,4,opt,name=float_value,json=floatValue,proto3,oneof"`
}
type DynamicValue_IntValue ¶
type DynamicValue_IntValue struct {
IntValue int32 `protobuf:"varint,2,opt,name=int_value,json=intValue,proto3,oneof"`
}
type DynamicValue_JsonValue ¶
type DynamicValue_LongValue ¶
type DynamicValue_LongValue struct {
LongValue int64 `protobuf:"varint,3,opt,name=long_value,json=longValue,proto3,oneof"`
}
type DynamicValue_NullValue ¶
type DynamicValue_StringValue ¶
type DynamicValue_StringValue struct {
StringValue string `protobuf:"bytes,6,opt,name=string_value,json=stringValue,proto3,oneof"`
}
type JSONMap ¶
type JSONMap map[string]interface{}
JSONMap defiend JSON data type, need to implements driver.Valuer, sql.Scanner interface
func (JSONMap) GormDBDataType ¶
GormDBDataType gorm db data type
func (JSONMap) GormDataType ¶
GormDataType gorm common data type
func (JSONMap) MarshalJSON ¶
MarshalJSON to output non base64 encoded []byte
func (*JSONMap) UnmarshalJSON ¶
UnmarshalJSON to deserialize []byte
type Repo ¶
type Repo[TEntity any, TKey any, TQuery any] interface { List(ctx context.Context, query *TQuery) ([]*TEntity, error) First(ctx context.Context, query *TQuery) (*TEntity, error) Count(ctx context.Context, query *TQuery) (total int64, filtered int64, err error) Get(ctx context.Context, id TKey) (*TEntity, error) Create(ctx context.Context, entity *TEntity) error BatchCreate(ctx context.Context, entity []*TEntity, batchSize int) error Update(ctx context.Context, id TKey, entity *TEntity, p query.Select) error Upsert(ctx context.Context, entity *TEntity) error Delete(ctx context.Context, id TKey) error }
type SortOpt ¶
func ParseSortIntoOpt ¶
type Value ¶
type Value struct { // which kind of data, can be "null","int","long","float","double","string","bool" Kind string IntValue int32 LongValue int64 FloatValue float32 DoubleValue float64 StringValue string BoolValue bool JsonValue JSONMap }
Value represents dynamic field which is friendly for database
func NewFromDynamicValue ¶
func NewFromDynamicValue(v *DynamicValue) *Value
func (*Value) GetNativeValue ¶
func (v *Value) GetNativeValue() interface{}
func (*Value) RunIfDouble ¶
func (*Value) RunIfFloat ¶
func (*Value) RunIfString ¶
func (*Value) SetAsDouble ¶
func (*Value) SetAsFloat ¶
func (*Value) SetAsString ¶
func (*Value) ToDynamicValue ¶
func (v *Value) ToDynamicValue() *DynamicValue
func (*Value) ToStructPb ¶
Click to show internal directories.
Click to hide internal directories.