reader

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package reader contains a package-authored Datly 1.0 reader example.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthOutput

type AuthOutput struct {
	Allowed bool `parameter:"Allowed,kind=output,in=allowed"`
}

AuthOutput is the part of the ACL component output consumed by this example.

type Components

type Components struct {
	Record xdatly.Component[RecordInput, RecordOutput] `component:"Record,path=/v1/api/records/{id},method=GET,connector=main,view=Record" desc:"Reads RECORDS records"`
}

Components is the Datly 1.0 package-level component declaration.

type Record

type Record struct {
	ID               int        `json:"id" sqlx:"ID,primaryKey=true"`
	Name             string     `json:"name" sqlx:"NAME"`
	ParentID         *int       `json:"parentId,omitempty" sqlx:"PARENT_ID"`
	Target           *string    `json:"target,omitempty" sqlx:"TARGET"`
	Exclusion        *string    `json:"exclusion,omitempty" sqlx:"EXCLUSION"`
	UnitPrice        *float64   `json:"unitPrice,omitempty" sqlx:"UNIT_PRICE"`
	Weight           int        `json:"weight" sqlx:"WEIGHT"`
	Status           int        `json:"status" sqlx:"STATUS"`
	RateLimit        *float64   `json:"rateLimit,omitempty" sqlx:"RATE_LIMIT"`
	RateDuration     *int       `json:"rateDuration,omitempty" sqlx:"RATE_DURATION"`
	RateWindow       *int       `json:"rateWindow,omitempty" sqlx:"RATE_WINDOW"`
	LifetimeLimit    float64    `json:"lifetimeLimit" sqlx:"LIFETIME_LIMIT"`
	ExternalRecordID *string    `json:"externalRecordId,omitempty" sqlx:"EXTERNAL_RECORD_ID"`
	CapacityLimit    *int       `json:"capacityLimit,omitempty" sqlx:"CAPACITY_LIMIT"`
	ManualAssignment int        `json:"manualAssignment" sqlx:"MANUAL_ASSIGNMENT"`
	IsPriority       int        `json:"isPriority" sqlx:"IS_PRIORITY"`
	Created          *time.Time `json:"created,omitempty" sqlx:"CREATED"`
	CreatedUser      *int       `json:"createdUser,omitempty" sqlx:"CREATED_USER"`
	Updated          *time.Time `json:"updated,omitempty" sqlx:"UPDATED"`
	UpdatedUser      *int       `json:"updatedUser,omitempty" sqlx:"UPDATED_USER"`
}

Record is the direct RECORDS projection used by the example reader.

type RecordInput

type RecordInput struct {
	JWT *jwt.Claims `parameter:"JWT,kind=header,in=Authorization,dataType=string,errorCode=401" codec:"JwtClaim"`

	ID      []int  `parameter:"ID,kind=path,in=id,cardinality=Many" predicate:"in,group=0,a,ID"`
	GroupID []int  `parameter:"GroupID,kind=query,in=groupId,cardinality=Many" predicate:"in,group=0,c,ID"`
	OrderID []int  `parameter:"OrderID,kind=query,in=orderId,cardinality=Many" predicate:"in,group=0,ao,ID"`
	Name    string `parameter:"Name,kind=query,in=name" predicate:"equal,group=0,a,NAME"`

	IncludeArchived bool `parameter:"IncludeArchived,kind=query,in=includeArchivedRecords"`

	Auth *AuthOutput `parameter:"Auth,kind=component,in=GET:/v1/api/platform/acl/auth,required" predicate:"handler,group=0,*authorization.Record"`

	Fields  []string `parameter:"Fields,kind=query,in=fields" querySelector:"view=Record"`
	OrderBy string   `parameter:"OrderBy,kind=query,in=orderBy" querySelector:"view=Record"`
	Limit   int      `parameter:"Limit,kind=query,in=limit" querySelector:"view=Record"`

	Has *RecordInputHas `setMarker:"true" json:"-" sqlx:"-"`
}

RecordInput demonstrates transport, codec, component, predicate, and query selector bindings on one reader contract.

type RecordInputHas

type RecordInputHas struct {
	JWT             bool
	ID              bool
	GroupID         bool
	OrderID         bool
	Name            bool
	IncludeArchived bool
	Auth            bool
	Fields          bool
	OrderBy         bool
	Limit           bool
}

type RecordOutput

type RecordOutput struct {
	Status string `json:"status" parameter:"Status,kind=output,in=status"`

	Data []*Record `` /* 645-byte string literal not displayed */
}

Jump to

Keyboard shortcuts

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