Int64 Function Return
Tip
Use Float64 Return for 64-bit floating point numbers. Use Number Return for arbitrary precision numbers.
Int64 function return expects a 64-bit integer number value from function logic. Set values in function logic with the Go built-in int64
type, Go built-in *int64
type, or the framework int64 type.
Function Definition
Use the function.Int64Return
type in the function definition.
In this example, a function definition includes a int64 return:
func (f ExampleFunction) Definition(ctx context.Context, req function.DefinitionRequest, resp *function.DefinitionResponse) { resp.Definition = function.Definition{ // ... other Definition fields ... Return: function.Int64Return{ // ... potentially other Int64Return fields ... }, }}
Custom Types
You may want to build your own data value and type implementations to allow your provider to combine validation and other behaviors into a reusable bundle. This helps avoid duplication and ensures consistency. These implementations use the CustomType
field in the return type.
Refer to Custom Types for further details on creating provider-defined types and values.
Documentation
Return documentation is expected in the top-level function documentation. Refer to function documentation for information about the Summary
, Description
, and MarkdownDescription
fields available.
Setting Return Data
The function implementation documentation covers the general methods for setting function return data in function logic.
When setting the value for this return:
- If
CustomType
is set, use its associated value type. - Otherwise, use the Go built-in
int64
type, Go built-in*int64
type, or framework int64 type.
In this example, a function defines a int64 return and sets its value:
func (f ExampleFunction) Definition(ctx context.Context, req function.DefinitionRequest, resp *function.DefinitionResponse) { resp.Definition = function.Definition{ // ... other Definition fields ... Return: function.Int64Return{}, }} func (f ExampleFunction) Run(ctx context.Context, req function.RunRequest, resp *function.RunResponse) { // ... other logic ... // hardcoded value for example brevity result := 123 resp.Error = function.ConcatFuncErrors(resp.Error, resp.Result.Set(ctx, &result))}