model

package
v0.0.0-...-dd0a71d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TestMessage1_Enum_name = map[int32]string{
		0: "KEY_0",
		1: "KEY_1",
	}
	TestMessage1_Enum_value = map[string]int32{
		"KEY_0": 0,
		"KEY_1": 1,
	}
)

Enum value maps for TestMessage1_Enum.

View Source
var File_internal_model_testdata_proto protoreflect.FileDescriptor

Functions

func FormatTime

func FormatTime(Time time.Time) string

func GetDefaultValue

func GetDefaultValue(field protoreflect.FieldDescriptor) string

GetDefaultValue returns string that is used as a default value in the input field The main goal is provide helpful scaffolding for more complex message types.

func GetFormTreatment

func GetFormTreatment(field protoreflect.FieldDescriptor) (Input, Parse)

func ModelLoader

func ModelLoader() gin.HandlerFunc

Types

type Field

type Field struct {
	Name         string
	Kind         string
	Input        Input
	Parse        Parse
	DefaultValue string
	Enums        map[string]string
}

type File

type File struct {
	Path     string
	Package  string
	Services []Service
}

type Input

type Input string
const (
	CheckboxInput Input = "checkbox"
	SelectInput   Input = "select"
	TextInput     Input = "text"
	TextareaInput Input = "textarea"
)

type Message

type Message struct {
	Fields []Field
}

type Method

type Method struct {
	Name  string
	Input Message
}

type Model

type Model struct {
	Files []File
}

func (*Model) GetFirstMethod

func (model *Model) GetFirstMethod() (File, Service, Method)

func (*Model) GetMethod

func (model *Model) GetMethod(serviceName, methodName string) (File, Service, Method)

type Parse

type Parse string
const (
	ArrayParse  Parse = "array"
	BoolParse   Parse = "bool"
	IntParse    Parse = "int"
	ObjectParse Parse = "object"
	TextParse   Parse = "text"
)

type Service

type Service struct {
	Name    string
	Methods []Method
}

type TestMessage1

type TestMessage1 struct {
	String_         string                       `protobuf:"bytes,1,opt,name=string,proto3" json:"string,omitempty"`
	Int32           int32                        `protobuf:"varint,2,opt,name=int32,proto3" json:"int32,omitempty"`
	Bool            bool                         `protobuf:"varint,3,opt,name=bool,proto3" json:"bool,omitempty"`
	RepeatedString  []string                     `protobuf:"bytes,4,rep,name=repeated_string,json=repeatedString,proto3" json:"repeated_string,omitempty"`
	RepeatedInt32   []int32                      `protobuf:"varint,5,rep,packed,name=repeated_int32,json=repeatedInt32,proto3" json:"repeated_int32,omitempty"`
	RepeatedEnum    []TestMessage1_Enum          `` /* 128-byte string literal not displayed */
	RepeatedMessage []*TestMessage1_Message      `protobuf:"bytes,7,rep,name=repeated_message,json=repeatedMessage,proto3" json:"repeated_message,omitempty"`
	NestedMessage   *TestMessage1_NestedMessage1 `protobuf:"bytes,8,opt,name=nested_message,json=nestedMessage,proto3" json:"nested_message,omitempty"`
	Timestamp       *timestamppb.Timestamp       `protobuf:"bytes,9,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	MapStringSint64 map[string]int64             `` /* 200-byte string literal not displayed */
	Enum            TestMessage1_Enum            `protobuf:"varint,11,opt,name=enum,proto3,enum=TestMessage1_Enum" json:"enum,omitempty"`
	// contains filtered or unexported fields
}

func (*TestMessage1) Descriptor deprecated

func (*TestMessage1) Descriptor() ([]byte, []int)

Deprecated: Use TestMessage1.ProtoReflect.Descriptor instead.

func (*TestMessage1) GetBool

func (x *TestMessage1) GetBool() bool

func (*TestMessage1) GetEnum

func (x *TestMessage1) GetEnum() TestMessage1_Enum

func (*TestMessage1) GetInt32

func (x *TestMessage1) GetInt32() int32

func (*TestMessage1) GetMapStringSint64

func (x *TestMessage1) GetMapStringSint64() map[string]int64

func (*TestMessage1) GetNestedMessage

func (x *TestMessage1) GetNestedMessage() *TestMessage1_NestedMessage1

func (*TestMessage1) GetRepeatedEnum

func (x *TestMessage1) GetRepeatedEnum() []TestMessage1_Enum

func (*TestMessage1) GetRepeatedInt32

func (x *TestMessage1) GetRepeatedInt32() []int32

func (*TestMessage1) GetRepeatedMessage

func (x *TestMessage1) GetRepeatedMessage() []*TestMessage1_Message

func (*TestMessage1) GetRepeatedString

func (x *TestMessage1) GetRepeatedString() []string

func (*TestMessage1) GetString_

func (x *TestMessage1) GetString_() string

func (*TestMessage1) GetTimestamp

func (x *TestMessage1) GetTimestamp() *timestamppb.Timestamp

func (*TestMessage1) ProtoMessage

func (*TestMessage1) ProtoMessage()

func (*TestMessage1) ProtoReflect

func (x *TestMessage1) ProtoReflect() protoreflect.Message

func (*TestMessage1) Reset

func (x *TestMessage1) Reset()

func (*TestMessage1) String

func (x *TestMessage1) String() string

type TestMessage1_Enum

type TestMessage1_Enum int32
const (
	TestMessage1_KEY_0 TestMessage1_Enum = 0
	TestMessage1_KEY_1 TestMessage1_Enum = 1
)

func (TestMessage1_Enum) Descriptor

func (TestMessage1_Enum) Enum

func (TestMessage1_Enum) EnumDescriptor deprecated

func (TestMessage1_Enum) EnumDescriptor() ([]byte, []int)

Deprecated: Use TestMessage1_Enum.Descriptor instead.

func (TestMessage1_Enum) Number

func (TestMessage1_Enum) String

func (x TestMessage1_Enum) String() string

func (TestMessage1_Enum) Type

type TestMessage1_Message

type TestMessage1_Message struct {
	Name    string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	IsValid bool   `protobuf:"varint,2,opt,name=is_valid,json=isValid,proto3" json:"is_valid,omitempty"`
	// contains filtered or unexported fields
}

func (*TestMessage1_Message) Descriptor deprecated

func (*TestMessage1_Message) Descriptor() ([]byte, []int)

Deprecated: Use TestMessage1_Message.ProtoReflect.Descriptor instead.

func (*TestMessage1_Message) GetIsValid

func (x *TestMessage1_Message) GetIsValid() bool

func (*TestMessage1_Message) GetName

func (x *TestMessage1_Message) GetName() string

func (*TestMessage1_Message) ProtoMessage

func (*TestMessage1_Message) ProtoMessage()

func (*TestMessage1_Message) ProtoReflect

func (x *TestMessage1_Message) ProtoReflect() protoreflect.Message

func (*TestMessage1_Message) Reset

func (x *TestMessage1_Message) Reset()

func (*TestMessage1_Message) String

func (x *TestMessage1_Message) String() string

type TestMessage1_NestedMessage1

type TestMessage1_NestedMessage1 struct {
	Name                 string                       `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	AnotherNestedMessage *TestMessage1_NestedMessage2 `protobuf:"bytes,2,opt,name=another_nested_message,json=anotherNestedMessage,proto3" json:"another_nested_message,omitempty"`
	// contains filtered or unexported fields
}

func (*TestMessage1_NestedMessage1) Descriptor deprecated

func (*TestMessage1_NestedMessage1) Descriptor() ([]byte, []int)

Deprecated: Use TestMessage1_NestedMessage1.ProtoReflect.Descriptor instead.

func (*TestMessage1_NestedMessage1) GetAnotherNestedMessage

func (x *TestMessage1_NestedMessage1) GetAnotherNestedMessage() *TestMessage1_NestedMessage2

func (*TestMessage1_NestedMessage1) GetName

func (x *TestMessage1_NestedMessage1) GetName() string

func (*TestMessage1_NestedMessage1) ProtoMessage

func (*TestMessage1_NestedMessage1) ProtoMessage()

func (*TestMessage1_NestedMessage1) ProtoReflect

func (*TestMessage1_NestedMessage1) Reset

func (x *TestMessage1_NestedMessage1) Reset()

func (*TestMessage1_NestedMessage1) String

func (x *TestMessage1_NestedMessage1) String() string

type TestMessage1_NestedMessage2

type TestMessage1_NestedMessage2 struct {
	Ids []int32 `protobuf:"zigzag32,1,rep,packed,name=ids,proto3" json:"ids,omitempty"`
	// contains filtered or unexported fields
}

func (*TestMessage1_NestedMessage2) Descriptor deprecated

func (*TestMessage1_NestedMessage2) Descriptor() ([]byte, []int)

Deprecated: Use TestMessage1_NestedMessage2.ProtoReflect.Descriptor instead.

func (*TestMessage1_NestedMessage2) GetIds

func (x *TestMessage1_NestedMessage2) GetIds() []int32

func (*TestMessage1_NestedMessage2) ProtoMessage

func (*TestMessage1_NestedMessage2) ProtoMessage()

func (*TestMessage1_NestedMessage2) ProtoReflect

func (*TestMessage1_NestedMessage2) Reset

func (x *TestMessage1_NestedMessage2) Reset()

func (*TestMessage1_NestedMessage2) String

func (x *TestMessage1_NestedMessage2) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL