servicestruct

package
v1.42.3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateServiceStructs = errRange.New(
		"Multiple service structs found",
		"Multiple service structs were found in the same service. Encore only allows one service struct to be defined per service.",
	)

	ErrReceiverNotAServiceStruct = errRange.New(
		"Invalid service struct for API",
		"API endpoints defined as receiver functions must be defined on a service struct.",
	)

	ErrServiceStructReferencedInAnotherService = errRange.New(
		"Service struct referenced in another service",
		"Service structs cannot be referenced in other services. They can only be referenced in the service that defines them.",
	)
)

Functions

func ResolveServiceStructUsage

func ResolveServiceStructUsage(data usage.ResolveData, s *ServiceStruct) usage.Usage

Types

type ParseData

type ParseData struct {
	Errs   *perr.List
	Schema *schema.Parser

	File *pkginfo.File
	Decl *ast.GenDecl
	Dir  *directive.Directive
	Doc  string
}

type ServiceStruct

type ServiceStruct struct {
	Decl *schema.TypeDecl // decl is the type declaration
	Doc  string

	// Init is the function for initializing this group.
	// It is nil if there is no initialization function.
	Init option.Option[*schema.FuncDecl]
}

ServiceStruct describes a dependency injection struct for a service.

func Parse

func Parse(d ParseData) *ServiceStruct

Parse parses the service struct in the provided type declaration.

func (*ServiceStruct) End

func (ss *ServiceStruct) End() token.Pos

func (*ServiceStruct) Kind

func (ss *ServiceStruct) Kind() resource.Kind

func (*ServiceStruct) Package

func (ss *ServiceStruct) Package() *pkginfo.Package

func (*ServiceStruct) Pos

func (ss *ServiceStruct) Pos() token.Pos

func (*ServiceStruct) SortKey added in v1.16.3

func (ss *ServiceStruct) SortKey() string

type Usage

type Usage struct {
	usage.Base

	ServiceStruct *ServiceStruct
}

Jump to

Keyboard shortcuts

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