gqlid

package
v0.0.0-...-d724b4b Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotValidID = errors.New("ID: invalid ID format")

ErrNotValidID is returned when the ID if not in the required format (base64 encoded gob).

Functions

func ParseInt64For

func ParseInt64For(service, resource string, s string) (idValue int64, err error)

ParseInt64For parses an ID and returns an error if it's not an int64.

Types

type ID

type ID struct {
	Service     string
	Resource    string
	Type        Type
	ValueInt64  int64
	ValueInt32  int32
	ValueString string
}

ID of an item within a GraphQL service.

func Int32

func Int32(service, resource string, id int32) *ID

Int32 ID.

func Int64

func Int64(service, resource string, id int64) *ID

Int64 ID.

func Parse

func Parse(s string) (id *ID, err error)

Parse an ID from a base64 encoded GraphQL ID.

func String

func String(service, resource string, id string) *ID

String ID.

func (*ID) Encoded

func (id *ID) Encoded() (s string)

Encoded returns the base64 encoded ID or panics if an error occurred.

func (*ID) Int32

func (id *ID) Int32() (value int32, ok bool)

Int32 gets the value of the ID.

func (*ID) Int64

func (id *ID) Int64() (value int64, ok bool)

Int64 gets the value of the ID.

func (*ID) String

func (id *ID) String() (value string, ok bool)

String gets the value of the ID.

type Type

type Type int

Type of the ID.

const (

	// TypeInt64 means that the underlying ID is an int64 value.
	TypeInt64 Type = 1
	// TypeInt32 means that the underlying ID is an int32 value.
	TypeInt32
	// TypeString means that the underlying ID is a string value.
	TypeString
)

Jump to

Keyboard shortcuts

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