idproto

package
v0.0.0-...-b09d569 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Argument

type Argument struct {
	Name  string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Value *Literal `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

A named value passed to a GraphQL field or contained in an input object.

func (*Argument) Canonical

func (arg *Argument) Canonical() *Argument

Canonical returns the argument with any contained IDs canonicalized.

func (*Argument) Descriptor deprecated

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

Deprecated: Use Argument.ProtoReflect.Descriptor instead.

func (*Argument) GetName

func (x *Argument) GetName() string

func (*Argument) GetValue

func (x *Argument) GetValue() *Literal

func (*Argument) ProtoMessage

func (*Argument) ProtoMessage()

func (*Argument) ProtoReflect

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

func (*Argument) Reset

func (x *Argument) Reset()

func (*Argument) String

func (x *Argument) String() string

func (*Argument) Tainted

func (arg *Argument) Tainted() bool

Tainted returns true if the ID contains any tainted selectors.

type ID

type ID struct {

	// The parent ID, if any.
	Parent *ID `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
	// The GraphQL type of the value.
	Type *Type `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	// GraphQL field name.
	Field string `protobuf:"bytes,3,opt,name=field,proto3" json:"field,omitempty"`
	// GraphQL field arguments, always in alphabetical order.
	Args []*Argument `protobuf:"bytes,4,rep,name=args,proto3" json:"args,omitempty"`
	// If true, this Selector is not reproducible.
	//
	// TODO: do we need to refer to session/client IDs or anything here? Or is
	// that all internal? Forcing function is whether this is used as an
	// in-memory query cache key. But the query cache might be made per-session
	// or even per-client instead anyway! What buys us the most?
	Tainted bool `protobuf:"varint,5,opt,name=tainted,proto3" json:"tainted,omitempty"`
	// If true, this Selector may be omitted from the pipeline without changing
	// the ultimate result.
	//
	// This is used to prevent meta-queries like 'pipeline' and 'withFocus' from
	// busting cache keys when desired.
	//
	// It is worth noting that we don't store meta information at this level and
	// continue to force metadata to be set via GraphQL queries. It makes IDs
	// always easy to evaluate.
	Meta bool `protobuf:"varint,6,opt,name=meta,proto3" json:"meta,omitempty"`
	// If the field returns a list, this is the index of the element to select.
	// Note that this defaults to zero, as IDs always refer to
	//
	// Here we're teetering dangerously close to full blown attribute path
	// selection, but we're intentionally limiting ourselves instead to cover
	// only the common case of returning a list of objects. The only case not
	// handled is a nested list. Don't do that; have a type instead.
	Nth int64 `protobuf:"varint,7,opt,name=nth,proto3" json:"nth,omitempty"`
	// A module that must be loaded prior to evaluating this ID.
	//
	// The actual usage of this ID is opaque to the protocol. In Dagger this is
	// the module ID providing the implementation of the field.
	Module *ID `protobuf:"bytes,8,opt,name=module,proto3" json:"module,omitempty"`
	// contains filtered or unexported fields
}

ID represents a GraphQL value of a certain type, constructed by evaluating its contained pipeline. In other words, it represents a constructor-addressed value, which may be an object, an array, or a scalar value.

It may be binary=>base64-encoded to be used as a GraphQL ID value for objects. Alternatively it may be stored in a database and referred to via an RFC-6920 ni://sha-256;... URI.

func New

func New() *ID

func (*ID) Append

func (id *ID) Append(ret *ast.Type, field string, args ...*Argument) *ID

func (*ID) Canonical

func (id *ID) Canonical() *ID

Canonical returns the ID with any contained IDs canonicalized.

func (*ID) Clone

func (id *ID) Clone() *ID

func (*ID) Decode

func (id *ID) Decode(str string) error

func (*ID) Descriptor deprecated

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

Deprecated: Use ID.ProtoReflect.Descriptor instead.

func (*ID) Digest

func (id *ID) Digest() (digest.Digest, error)

Digest returns the digest of the encoded ID. It does NOT canonicalize the ID first.

func (*ID) Display

func (id *ID) Display() string

func (*ID) DisplaySelf

func (id *ID) DisplaySelf() string

func (*ID) Encode

func (id *ID) Encode() (string, error)

func (*ID) GetArgs

func (x *ID) GetArgs() []*Argument

func (*ID) GetField

func (x *ID) GetField() string

func (*ID) GetMeta

func (x *ID) GetMeta() bool

func (*ID) GetModule

func (x *ID) GetModule() *ID

func (*ID) GetNth

func (x *ID) GetNth() int64

func (*ID) GetParent

func (x *ID) GetParent() *ID

func (*ID) GetTainted

func (x *ID) GetTainted() bool

func (*ID) GetType

func (x *ID) GetType() *Type

func (*ID) IsTainted

func (id *ID) IsTainted() bool

Tainted returns true if the ID contains any tainted selectors.

func (*ID) Modules

func (id *ID) Modules() []*ID

func (*ID) Path

func (id *ID) Path() string

func (*ID) ProtoMessage

func (*ID) ProtoMessage()

func (*ID) ProtoReflect

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

func (*ID) Rebase

func (id *ID) Rebase(root *ID) *ID

func (*ID) Reset

func (x *ID) Reset()

func (*ID) SelectNth

func (id *ID) SelectNth(i int)

func (*ID) SetTainted

func (id *ID) SetTainted(tainted bool)

func (*ID) String

func (x *ID) String() string

func (*ID) WithNth

func (id *ID) WithNth(i int) *ID

type List

type List struct {
	Values []*Literal `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
	// contains filtered or unexported fields
}

A list of values.

func (*List) Descriptor deprecated

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

Deprecated: Use List.ProtoReflect.Descriptor instead.

func (*List) GetValues

func (x *List) GetValues() []*Literal

func (*List) ProtoMessage

func (*List) ProtoMessage()

func (*List) ProtoReflect

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

func (*List) Reset

func (x *List) Reset()

func (*List) String

func (x *List) String() string

type Literal

type Literal struct {

	// Types that are assignable to Value:
	//
	//	*Literal_Id
	//	*Literal_Null
	//	*Literal_Bool
	//	*Literal_Enum
	//	*Literal_Int
	//	*Literal_Float
	//	*Literal_String_
	//	*Literal_List
	//	*Literal_Object
	Value isLiteral_Value `protobuf_oneof:"value"`
	// contains filtered or unexported fields
}

A value passed to an argument or contained in a list.

func (*Literal) Canonical

func (lit *Literal) Canonical() *Literal

Canonical returns the literal with any contained IDs canonicalized.

func (*Literal) Descriptor deprecated

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

Deprecated: Use Literal.ProtoReflect.Descriptor instead.

func (*Literal) Display

func (lit *Literal) Display() string

ToAST returns an AST value appropriate for passing to a GraphQL server.

func (*Literal) GetBool

func (x *Literal) GetBool() bool

func (*Literal) GetEnum

func (x *Literal) GetEnum() string

func (*Literal) GetFloat

func (x *Literal) GetFloat() float64

func (*Literal) GetId

func (x *Literal) GetId() *ID

func (*Literal) GetInt

func (x *Literal) GetInt() int64

func (*Literal) GetList

func (x *Literal) GetList() *List

func (*Literal) GetNull

func (x *Literal) GetNull() bool

func (*Literal) GetObject

func (x *Literal) GetObject() *Object

func (*Literal) GetString_

func (x *Literal) GetString_() string

func (*Literal) GetValue

func (m *Literal) GetValue() isLiteral_Value

func (*Literal) Modules

func (arg *Literal) Modules() []*ID

func (*Literal) ProtoMessage

func (*Literal) ProtoMessage()

func (*Literal) ProtoReflect

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

func (*Literal) Reset

func (x *Literal) Reset()

func (*Literal) String

func (x *Literal) String() string

func (*Literal) Tainted

func (lit *Literal) Tainted() bool

func (*Literal) ToAST

func (lit *Literal) ToAST() *ast.Value

ToAST returns an AST value appropriate for passing to a GraphQL server.

func (*Literal) ToInput

func (lit *Literal) ToInput() any

ToInput returns a value appropriate for passing to an InputDecoder with minimal encoding/decoding overhead.

type Literal_Bool

type Literal_Bool struct {
	Bool bool `protobuf:"varint,3,opt,name=bool,proto3,oneof"`
}

type Literal_Enum

type Literal_Enum struct {
	Enum string `protobuf:"bytes,4,opt,name=enum,proto3,oneof"`
}

type Literal_Float

type Literal_Float struct {
	Float float64 `protobuf:"fixed64,6,opt,name=float,proto3,oneof"`
}

type Literal_Id

type Literal_Id struct {
	Id *ID `protobuf:"bytes,1,opt,name=id,proto3,oneof"`
}

type Literal_Int

type Literal_Int struct {
	Int int64 `protobuf:"varint,5,opt,name=int,proto3,oneof"`
}

type Literal_List

type Literal_List struct {
	List *List `protobuf:"bytes,8,opt,name=list,proto3,oneof"`
}

type Literal_Null

type Literal_Null struct {
	Null bool `protobuf:"varint,2,opt,name=null,proto3,oneof"`
}

type Literal_Object

type Literal_Object struct {
	Object *Object `protobuf:"bytes,9,opt,name=object,proto3,oneof"`
}

type Literal_String_

type Literal_String_ struct {
	String_ string `protobuf:"bytes,7,opt,name=string,proto3,oneof"`
}

type Literate

type Literate interface {
	ToLiteral() *Literal
}

type Object

type Object struct {
	Values []*Argument `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
	// contains filtered or unexported fields
}

A series of named values.

func (*Object) Descriptor deprecated

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

Deprecated: Use Object.ProtoReflect.Descriptor instead.

func (*Object) GetValues

func (x *Object) GetValues() []*Argument

func (*Object) ProtoMessage

func (*Object) ProtoMessage()

func (*Object) ProtoReflect

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

func (*Object) Reset

func (x *Object) Reset()

func (*Object) String

func (x *Object) String() string

type Type

type Type struct {
	NamedType string `protobuf:"bytes,1,opt,name=namedType,proto3" json:"namedType,omitempty"`
	Elem      *Type  `protobuf:"bytes,2,opt,name=elem,proto3" json:"elem,omitempty"`
	NonNull   bool   `protobuf:"varint,3,opt,name=nonNull,proto3" json:"nonNull,omitempty"`
	// contains filtered or unexported fields
}

A GraphQL type.

func NewType

func NewType(gqlType *ast.Type) *Type

func (*Type) Descriptor deprecated

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

Deprecated: Use Type.ProtoReflect.Descriptor instead.

func (*Type) GetElem

func (x *Type) GetElem() *Type

func (*Type) GetNamedType

func (x *Type) GetNamedType() string

func (*Type) GetNonNull

func (x *Type) GetNonNull() bool

func (*Type) ProtoMessage

func (*Type) ProtoMessage()

func (*Type) ProtoReflect

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

func (*Type) Reset

func (x *Type) Reset()

func (*Type) String

func (x *Type) String() string

func (*Type) ToAST

func (t *Type) ToAST() *ast.Type

Jump to

Keyboard shortcuts

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