{"modulePath":"github.com/viant/datly","version":"v1.1.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package reader\n\nPackage reader contains a package-authored Datly 1.0 reader example.\n\n## Types\n\n```go\ntype AuthOutput struct {\n\tAllowed bool `parameter:\"Allowed,kind=output,in=allowed\"`\n}\n```\nAuthOutput is the part of the ACL component output consumed by this example.\n\n```go\ntype Components struct {\n\tRecord xdatly.Component[RecordInput, RecordOutput] `component:\"Record,path=/v1/api/records/{id},method=GET,connector=main,view=Record\" desc:\"Reads RECORDS records\"`\n}\n```\nComponents is the Datly 1.0 package-level component declaration.\n\n```go\ntype Record struct {\n\tID               int        `json:\"id\" sqlx:\"ID,primaryKey=true\"`\n\tName             string     `json:\"name\" sqlx:\"NAME\"`\n\tParentID         *int       `json:\"parentId,omitempty\" sqlx:\"PARENT_ID\"`\n\tTarget           *string    `json:\"target,omitempty\" sqlx:\"TARGET\"`\n\tExclusion        *string    `json:\"exclusion,omitempty\" sqlx:\"EXCLUSION\"`\n\tUnitPrice        *float64   `json:\"unitPrice,omitempty\" sqlx:\"UNIT_PRICE\"`\n\tWeight           int        `json:\"weight\" sqlx:\"WEIGHT\"`\n\tStatus           int        `json:\"status\" sqlx:\"STATUS\"`\n\tRateLimit        *float64   `json:\"rateLimit,omitempty\" sqlx:\"RATE_LIMIT\"`\n\tRateDuration     *int       `json:\"rateDuration,omitempty\" sqlx:\"RATE_DURATION\"`\n\tRateWindow       *int       `json:\"rateWindow,omitempty\" sqlx:\"RATE_WINDOW\"`\n\tLifetimeLimit    float64    `json:\"lifetimeLimit\" sqlx:\"LIFETIME_LIMIT\"`\n\tExternalRecordID *string    `json:\"externalRecordId,omitempty\" sqlx:\"EXTERNAL_RECORD_ID\"`\n\tCapacityLimit    *int       `json:\"capacityLimit,omitempty\" sqlx:\"CAPACITY_LIMIT\"`\n\tManualAssignment int        `json:\"manualAssignment\" sqlx:\"MANUAL_ASSIGNMENT\"`\n\tIsPriority       int        `json:\"isPriority\" sqlx:\"IS_PRIORITY\"`\n\tCreated          *time.Time `json:\"created,omitempty\" sqlx:\"CREATED\"`\n\tCreatedUser      *int       `json:\"createdUser,omitempty\" sqlx:\"CREATED_USER\"`\n\tUpdated          *time.Time `json:\"updated,omitempty\" sqlx:\"UPDATED\"`\n\tUpdatedUser      *int       `json:\"updatedUser,omitempty\" sqlx:\"UPDATED_USER\"`\n}\n```\nRecord is the direct RECORDS projection used by the example reader.\n\n```go\ntype RecordInput struct {\n\tJWT *jwt.Claims `parameter:\"JWT,kind=header,in=Authorization,dataType=string,errorCode=401\" codec:\"JwtClaim\"`\n\n\tID      []int  `parameter:\"ID,kind=path,in=id,cardinality=Many\" predicate:\"in,group=0,a,ID\"`\n\tGroupID []int  `parameter:\"GroupID,kind=query,in=groupId,cardinality=Many\" predicate:\"in,group=0,c,ID\"`\n\tOrderID []int  `parameter:\"OrderID,kind=query,in=orderId,cardinality=Many\" predicate:\"in,group=0,ao,ID\"`\n\tName    string `parameter:\"Name,kind=query,in=name\" predicate:\"equal,group=0,a,NAME\"`\n\n\tIncludeArchived bool `parameter:\"IncludeArchived,kind=query,in=includeArchivedRecords\"`\n\n\tAuth *AuthOutput `parameter:\"Auth,kind=component,in=GET:/v1/api/platform/acl/auth,required\" predicate:\"handler,group=0,*authorization.Record\"`\n\n\tFields  []string `parameter:\"Fields,kind=query,in=fields\" querySelector:\"view=Record\"`\n\tOrderBy string   `parameter:\"OrderBy,kind=query,in=orderBy\" querySelector:\"view=Record\"`\n\tLimit   int      `parameter:\"Limit,kind=query,in=limit\" querySelector:\"view=Record\"`\n\n\tHas *RecordInputHas `setMarker:\"true\" json:\"-\" sqlx:\"-\"`\n}\n```\nRecordInput demonstrates transport, codec, component, predicate, and query selector bindings on one reader contract.\n\n```go\ntype RecordInputHas struct {\n\tJWT             bool\n\tID              bool\n\tGroupID         bool\n\tOrderID         bool\n\tName            bool\n\tIncludeArchived bool\n\tAuth            bool\n\tFields          bool\n\tOrderBy         bool\n\tLimit           bool\n}\n```\n\n```go\ntype RecordOutput struct {\n\tStatus string `json:\"status\" parameter:\"Status,kind=output,in=status\"`\n\n\tData []*Record `json:\"data\" parameter:\"Data,kind=output,in=view,cardinality=Many\" view:\"Record,type=Record,table=RECORDS,connector=main,allowNulls=true,batch=10000,selectorNamespace=a,selectorProjection=true,selectorOrderBy=true,selectorCriteria=true,selectorLimit=true\" sql:\"SELECT a.ID, a.NAME, a.PARENT_ID, a.TARGET, a.EXCLUSION, a.UNIT_PRICE, a.WEIGHT, a.STATUS, a.RATE_LIMIT, a.RATE_DURATION, a.RATE_WINDOW, a.LIFETIME_LIMIT, a.EXTERNAL_RECORD_ID, a.CAPACITY_LIMIT, a.MANUAL_ASSIGNMENT, a.IS_PRIORITY, a.CREATED, a.CREATED_USER, a.UPDATED, a.UPDATED_USER FROM RECORDS a ${predicate.Builder().CombineOr($predicate.FilterGroup(0, \\\"AND\\\")).Build(\\\"WHERE\\\")}\"`\n}\n```\n\n","path":"github.com/viant/datly/example/reader","name":"reader","synopsis":"Package reader contains a package-authored Datly 1.0 reader example.","isRedistributable":true}
