Signature | Description | Supported Languages | Available Adapters | Latest Version |
---|---|---|---|---|
HTTP | HTTP Signature meant to be used for HTTP handlers and middleware. | Go, Rust, TypeScript, JavaScript | net/http, FastHTTP, NextJS | 0.3.8 |
Getting Started
To start using Scale Signatures in Golang, you’ll need to have the Scale framework installed and set up. If you haven’t done this yet, please refer to the Getting Started guide.Defining a Signature
Defining a Scale Signature in Golang involves creating a struct that represents the input and output of your function. Here’s the default output of thescale signature new
command:
Context
is a Scale Signature that defines a struct with a string and a default string value.
For more information on using this syntax, using HCL format
Using a Signature
Generate the signature, defined in the example above, by again using the CLI:guest
and host
signatures, each of which are set of functions/interfaces that handle getting the data in, and out, of the associated scale function(s), in a type-safe, and performant manner.
For more information on why we need bindings for the guest and the host, see the overview.
Now, to use a Scale Signature in Golang, using the generated signature above, you can define a function accordingly. Here’s an example:
scale signature use <name:tag>
command. Once this is done, you can use the types defined in your signature file for input and output of your scale function.
All of the commands for working with signatures are in the CLI API reference.
Next Steps
Now that you know the basics of Scale Signatures in Golang, you can start integrating them into your Scale plugins/functions. For more info, please refer to the API Reference.Chaining Functions
Scale Functions are designed to be chained together to form a pipeline of functions that can be executed sequentially. To allow developers to make decisions about when the next function in the chain should be executed, all signatures provide aNext()
method which runs the next function in the chain.
Next()
method will not do anything and will return the same context.