diff --git a/examples/go/cron/types.ftl.go b/examples/go/cron/types.ftl.go index f9f7fa082c..b40a25b5f3 100644 --- a/examples/go/cron/types.ftl.go +++ b/examples/go/cron/types.ftl.go @@ -12,9 +12,11 @@ type ThirtySecondsClient func(context.Context) error func init() { reflection.Register( + reflection.ProvideResourcesForVerb( Hourly, ), + reflection.ProvideResourcesForVerb( ThirtySeconds, ), diff --git a/examples/go/echo/types.ftl.go b/examples/go/echo/types.ftl.go index a50ac05394..c8332be326 100644 --- a/examples/go/echo/types.ftl.go +++ b/examples/go/echo/types.ftl.go @@ -12,6 +12,7 @@ type EchoClient func(context.Context, EchoRequest) (EchoResponse, error) func init() { reflection.Register( + reflection.ProvideResourcesForVerb( Echo, server.VerbClient[ftltime.TimeClient, ftltime.TimeRequest, ftltime.TimeResponse](), diff --git a/examples/go/http/types.ftl.go b/examples/go/http/types.ftl.go index 0e74af1de9..00f5a54413 100644 --- a/examples/go/http/types.ftl.go +++ b/examples/go/http/types.ftl.go @@ -14,9 +14,11 @@ type PostClient func(context.Context, ftlbuiltin.HttpRequest[PostRequest, ftl.Un func init() { reflection.Register( + reflection.ProvideResourcesForVerb( Get, ), + reflection.ProvideResourcesForVerb( Post, ), diff --git a/examples/go/mysql/go.mod b/examples/go/mysql/go.mod index e07201c6dc..7dd8abfe0f 100644 --- a/examples/go/mysql/go.mod +++ b/examples/go/mysql/go.mod @@ -4,6 +4,7 @@ go 1.23.0 require ( github.com/alecthomas/assert/v2 v2.11.0 + github.com/alecthomas/types v0.17.0 github.com/block/ftl v0.189.0 ) @@ -23,7 +24,6 @@ require ( github.com/alecthomas/kong v1.6.0 // indirect github.com/alecthomas/participle/v2 v2.1.1 // indirect github.com/alecthomas/repr v0.4.0 // indirect - github.com/alecthomas/types v0.17.0 // indirect github.com/amacneil/dbmate/v2 v2.24.2 // indirect github.com/aws/aws-sdk-go-v2 v1.32.7 // indirect github.com/aws/aws-sdk-go-v2/config v1.28.7 // indirect diff --git a/examples/go/mysql/queries.ftl.go b/examples/go/mysql/queries.ftl.go index b222bb5f76..dea5040ca5 100644 --- a/examples/go/mysql/queries.ftl.go +++ b/examples/go/mysql/queries.ftl.go @@ -3,17 +3,26 @@ package mysql import ( "context" + "github.com/alecthomas/types/tuple" + "github.com/block/ftl/common/reflection" + "github.com/block/ftl/go-runtime/ftl" + "github.com/block/ftl/go-runtime/server" ) - type CreateRequestQuery struct { - Data string + Data ftl.Option[string] } - -type CreateRequestClient func(context.Context, CreateRequestQuery) error - type GetRequestDataResult struct { - Data string + Data ftl.Option[string] } + +type CreateRequestClient func(context.Context, CreateRequestQuery) error + +type GetRequestDataClient func(context.Context) ([]GetRequestDataResult, error) -type GetRequestDataClient func(context.Context) ([]GetRequestDataResult, error) \ No newline at end of file +func init() { + reflection.Register( + server.QuerySink[CreateRequestQuery]("mysql", "createRequest", reflection.CommandTypeExec, "testdb", "INSERT INTO requests (data) VALUES (?)", []string{"Data"}, []tuple.Pair[string,string]{}), + server.QuerySource[GetRequestDataResult]("mysql", "getRequestData", reflection.CommandTypeMany, "testdb", "SELECT data FROM requests", []string{}, []tuple.Pair[string,string]{tuple.PairOf("data", "Data")}), + ) +} \ No newline at end of file diff --git a/examples/go/mysql/types.ftl.go b/examples/go/mysql/types.ftl.go index 8fb2346164..ffa2902d44 100644 --- a/examples/go/mysql/types.ftl.go +++ b/examples/go/mysql/types.ftl.go @@ -14,10 +14,12 @@ type QueryClient func(context.Context) ([]string, error) func init() { reflection.Register( reflection.Database[MyDbConfig]("testdb", server.InitMySQL), + reflection.ProvideResourcesForVerb( Insert, server.DatabaseHandle[MyDbConfig]("mysql"), ), + reflection.ProvideResourcesForVerb( Query, server.DatabaseHandle[MyDbConfig]("mysql"), diff --git a/examples/go/postgres/types.ftl.go b/examples/go/postgres/types.ftl.go index 7ecb399229..f4a2a22099 100644 --- a/examples/go/postgres/types.ftl.go +++ b/examples/go/postgres/types.ftl.go @@ -14,10 +14,12 @@ type QueryClient func(context.Context) ([]string, error) func init() { reflection.Register( reflection.Database[MyDbConfig]("testdb", server.InitPostgres), + reflection.ProvideResourcesForVerb( Insert, server.DatabaseHandle[MyDbConfig]("postgres"), ), + reflection.ProvideResourcesForVerb( Query, server.DatabaseHandle[MyDbConfig]("postgres"), diff --git a/examples/go/pubsub/types.ftl.go b/examples/go/pubsub/types.ftl.go index 9df8a4a4bf..d30b345481 100644 --- a/examples/go/pubsub/types.ftl.go +++ b/examples/go/pubsub/types.ftl.go @@ -16,13 +16,16 @@ type OrderPizzaClient func(context.Context, OrderPizzaRequest) (OrderPizzaRespon func init() { reflection.Register( + reflection.ProvideResourcesForVerb( CookPizza, server.TopicHandle[Pizza, ftl.SinglePartitionMap[Pizza]]("pubsub", "pizzaReadyTopic"), ), + reflection.ProvideResourcesForVerb( DeliverPizza, ), + reflection.ProvideResourcesForVerb( OrderPizza, server.TopicHandle[Pizza, PizzaPartitionMapper]("pubsub", "newOrderTopic"), diff --git a/examples/go/time/types.ftl.go b/examples/go/time/types.ftl.go index 612f46ec37..0cd191693c 100644 --- a/examples/go/time/types.ftl.go +++ b/examples/go/time/types.ftl.go @@ -13,9 +13,11 @@ type TimeClient func(context.Context, TimeRequest) (TimeResponse, error) func init() { reflection.Register( + reflection.ProvideResourcesForVerb( Internal, ), + reflection.ProvideResourcesForVerb( Time, server.VerbClient[InternalClient, TimeRequest, TimeResponse](),