Documentation ¶
Index ¶
- Constants
- type ConversionMode
- type Enum
- type EnumEntry
- type Field
- func (f *Field) GetAppendFieldValue(loopName string) string
- func (f *Field) GetEnumFromStringCall() string
- func (f *Field) GetExpandConverter(receiver string) string
- func (f *Field) GetFormFieldFileNames() string
- func (f *Field) GetFormFieldValueNames() string
- func (f *Field) GetMapEnumRealValueType() string
- func (f *Field) GetMapFieldKeyType() string
- func (f *Field) GetMapFieldKeyValueType() string
- func (f *Field) GetMapValueType() string
- func (f *Field) GetModelConverter(receiver string) string
- func (f *Field) GetModelTag() string
- func (f *Field) GetName() string
- func (f *Field) GetProtoConverter(receiver string) string
- func (f *Field) GetProtoType() string
- func (f *Field) GetResponseConverter(receiver string) string
- func (f *Field) GetResponseTag() string
- func (f *Field) GetType() string
- func (f *Field) GetValidationDefinition() *extension.Validation
- func (f *Field) GetValidator() string
- func (f *Field) GoEnumType() string
- func (f *Field) GoMessageType() string
- func (f *Field) HasMultipartFormFiles() bool
- func (f *Field) HasMultipartFormValues() bool
- func (f *Field) HasValidatorTag() bool
- func (f *Field) IsEnum() bool
- func (f *Field) IsInternalMessage() bool
- func (f *Field) IsMap() bool
- func (f *Field) IsMessage() bool
- func (f *Field) IsMultipartForm() bool
- func (f *Field) IsMultipartFormRequired() bool
- func (f *Field) IsPointer() bool
- func (f *Field) IsProtobufTimestamp() bool
- func (f *Field) MapToEnum() bool
- func (f *Field) MapToMessage() bool
- func (f *Field) NeedsAddressNotation() bool
- func (f *Field) NeedsOzzoIsPackage() bool
- func (f *Field) Validate() error
- type FieldLocation
- type FieldMapEntry
- type HttpRule
- type Message
- func (m *Message) ArrayFields() []*Field
- func (m *Message) BodyArgumentsFields() []*Field
- func (m *Message) BodyRequired() bool
- func (m *Message) EntityValidate() error
- func (m *Message) Export() bool
- func (m *Message) FullParseFromBody() bool
- func (m *Message) GetEntityName() string
- func (m *Message) GetFormFieldFileNames() string
- func (m *Message) GetFormFieldValueNames() string
- func (m *Message) GetReceiverName() string
- func (m *Message) HasArrayField() bool
- func (m *Message) HasCommonSettings() bool
- func (m *Message) HasEnumField() bool
- func (m *Message) HasFieldWithValidation() bool
- func (m *Message) HasHeaderArguments() bool
- func (m *Message) HasIDField() bool
- func (m *Message) HasInternalMessageFields() bool
- func (m *Message) HasMapField() bool
- func (m *Message) HasMessageField() bool
- func (m *Message) HasMultipartField() bool
- func (m *Message) HasQueryArguments() bool
- func (m *Message) HeaderArgumentsFields() []*Field
- func (m *Message) InternalMessageFields() []*Field
- func (m *Message) IsCommonSettings() bool
- func (m *Message) IsEntity() bool
- func (m *Message) IsRpcRequestArgument() bool
- func (m *Message) Kind() MessageKind
- func (m *Message) MapFields() []*Field
- func (m *Message) NonArrayFields() []*Field
- func (m *Message) PathArgumentsFields() []*Field
- func (m *Message) QueryArgumentsFields() []*Field
- func (m *Message) SettingsValidate() error
- func (m *Message) SimpleFields() []*Field
- type MessageKind
- type Method
- type MsgFieldDefaultValue
- type NewMessageOptions
- type Request
- type Returns
Constants ¶
const ( StringType = "String" FloatType = "Float" DoubleType = "Double" BoolType = "Bool" Int32Type = "Int32" Int64Type = "Int64" UInt32Type = "UInt32" UInt64Type = "UInt64" BytesType = "Bytes" Float32Type = "Float32" Float64Type = "Float64" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConversionMode ¶
type ConversionMode int32
const ( ConversionMode_ProtoToModel ConversionMode = iota ConversionMode_ModelToProto )
type Field ¶
type Field struct { GoName string GoType string JsonName string ProtoName string IsArray bool Type descriptor.FieldDescriptorProto_Type Location FieldLocation // contains filtered or unexported fields }
func NewField ¶
func NewField( packageName string, field *descriptor.FieldDescriptorProto, fieldSchema *protogen.Field, details *endpointDetails, ) *Field
func (*Field) GetAppendFieldValue ¶
GetAppendFieldValue gives the call, in a string format, that must be used to append this Field into a slice of the name type.
func (*Field) GetEnumFromStringCall ¶
func (*Field) GetExpandConverter ¶
func (*Field) GetFormFieldFileNames ¶
func (*Field) GetFormFieldValueNames ¶
func (*Field) GetMapEnumRealValueType ¶
func (*Field) GetMapFieldKeyType ¶
func (*Field) GetMapFieldKeyValueType ¶
func (*Field) GetMapValueType ¶
func (*Field) GetModelConverter ¶
func (*Field) GetModelTag ¶
GetModelTag retrieves the field type by checking if it has a different value defined in some of our extensions.
func (*Field) GetName ¶
GetName retrieves the field name by checking if it has a different name defined in some of our extensions.
func (*Field) GetProtoConverter ¶
func (*Field) GetProtoType ¶
func (*Field) GetResponseConverter ¶
GetResponseConverter gives the call, in a string format, that must be used to convert the Field when used inside a response structure.
func (*Field) GetResponseTag ¶
GetResponseTag retrieves the field type by checking if it has a different value defined in some of our extensions.
func (*Field) GetType ¶
GetType retrieves the field type by checking if it has a different type defined in some of our extensions.
func (*Field) GetValidationDefinition ¶
func (f *Field) GetValidationDefinition() *extension.Validation
func (*Field) GetValidator ¶
GetValidator returns the Field validator source syntax call to be used by an ozzo validation call.
func (*Field) GoEnumType ¶
func (*Field) GoMessageType ¶
GoMessageType returns just the message type name, without the package prefix.
func (*Field) HasMultipartFormFiles ¶
func (*Field) HasMultipartFormValues ¶
func (*Field) HasValidatorTag ¶
HasValidatorTag checks if the Field is using the protobuf validator tag in its declaration.
func (*Field) IsInternalMessage ¶
IsInternalMessage checks by looking at the Field name if it corresponds to an internal message or not.
func (*Field) IsMultipartForm ¶
func (*Field) IsMultipartFormRequired ¶
func (*Field) IsProtobufTimestamp ¶
func (*Field) MapToMessage ¶
func (*Field) NeedsAddressNotation ¶
NeedsAddressNotation checks if the current field needs to use the address notation (&) when validating it.
func (*Field) NeedsOzzoIsPackage ¶
type FieldLocation ¶
type FieldLocation int32
const ( FieldLocation_Unknown FieldLocation = iota FieldLocation_Body FieldLocation_Query FieldLocation_Path FieldLocation_Header )
func (FieldLocation) String ¶
func (l FieldLocation) String() string
type FieldMapEntry ¶
type FieldMapEntry struct { Key string // contains filtered or unexported fields }
func (*FieldMapEntry) GetDefaultValue ¶
func (e *FieldMapEntry) GetDefaultValue() string
type Message ¶
type Message struct { HasHttpResponseModel bool DontExport bool Name string Fields []*Field // contains filtered or unexported fields }
func LoadEntities ¶
LoadEntities loads all messages from a protogen.File and set them as entity kind.
func NewMessage ¶
func NewMessage(options *NewMessageOptions) (*Message, error)
NewMessage creates a new Message structure according a few options. After successfully creating a new one, it loads all internal custom proto definitions, the extension API, for all fields and for itself.
func (*Message) ArrayFields ¶
func (*Message) BodyArgumentsFields ¶
BodyArgumentsFields gives a slice of Field that must be parsed from the request body.
func (*Message) BodyRequired ¶
BodyRequired checks if the message has at least one field that should be parsed from the request body.
func (*Message) EntityValidate ¶
EntityValidate validates if the Message is currently in the expected format to be an entity.
func (*Message) FullParseFromBody ¶
FullParseFromBody checks if the whole message must be parsed from the request body.
func (*Message) GetEntityName ¶
GetEntityName returns the message name in the entity format, i.e., without the Proto suffix.
func (*Message) GetFormFieldFileNames ¶
func (*Message) GetFormFieldValueNames ¶
func (*Message) GetReceiverName ¶
GetReceiverName retrieves the receiver name to be used for function declarations.
func (*Message) HasArrayField ¶
HasArrayField checks if the message has any array field.
func (*Message) HasCommonSettings ¶
func (*Message) HasEnumField ¶
HasEnumField checks if the message has at least one enum Field.
func (*Message) HasFieldWithValidation ¶
func (*Message) HasHeaderArguments ¶
HasHeaderArguments checks if the message has any Field that must be parsed from the request header.
func (*Message) HasIDField ¶
func (*Message) HasInternalMessageFields ¶
func (*Message) HasMapField ¶
func (*Message) HasMessageField ¶
HasMessageField checks if the message has at least one message Field.
func (*Message) HasMultipartField ¶
func (*Message) HasQueryArguments ¶
HasQueryArguments checks if the message has any Field that must be parsed from the request query.
func (*Message) HeaderArgumentsFields ¶
HeaderArgumentsFields gives a slice of Field that must be parsed from the request header.
func (*Message) InternalMessageFields ¶
func (*Message) IsCommonSettings ¶
func (*Message) IsRpcRequestArgument ¶
IsRpcRequestArgument checks if the message is the argument of an RPC.
func (*Message) Kind ¶
func (m *Message) Kind() MessageKind
func (*Message) NonArrayFields ¶
func (*Message) PathArgumentsFields ¶
PathArgumentsFields gives a slice of Field that must be parsed from the request path.
func (*Message) QueryArgumentsFields ¶
QueryArgumentsFields gives a slice of Field that must be parsed from the request query.
func (*Message) SettingsValidate ¶
SettingsValidate validates if the Message is currently in the expected format to be a settings entity.
func (*Message) SimpleFields ¶
SimpleFields gives back only fields that are not array, messages or maps.
type MessageKind ¶
type MessageKind int32
const ( MessageKind_Unknown MessageKind = iota MessageKind_Entity MessageKind_Input MessageKind_Output MessageKind_External )
type Method ¶
type Method struct { Name string HTTPMethod string Endpoint string ContentType string Request Request Returns Returns Scopes []string AdditionalHTTPMethods []HttpRule // contains filtered or unexported fields }
func LoadMethods ¶
LoadMethods loads all RPC methods from a service declaration if the protobuf file has one.
func (*Method) AuthVersion ¶
func (*Method) EchoEndpoint ¶
func (*Method) IsHTTPEndpoint ¶
func (*Method) IsMultipartFormData ¶
func (*Method) IsTextPlain ¶
type MsgFieldDefaultValue ¶
type MsgFieldDefaultValue struct { FieldName string // contains filtered or unexported fields }
func (*MsgFieldDefaultValue) GetDefaultValue ¶
func (m *MsgFieldDefaultValue) GetDefaultValue() string
type NewMessageOptions ¶
type NewMessageOptions struct { PackageName string Message *descriptor.DescriptorProto Fields []*Field MessageSchema *protogen.Message Kind MessageKind Responses *responseMessages }
NewMessageOptions is a structure to be used when we need to create a new Message.