quickstart

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package quickstart shows the static Foundation v2 workflow.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build() (*app.App, error)

Build creates a ready application using generated registrations.

func FoundationActions

func FoundationActions() []foundationactions.Definition

func FoundationHTTPHandlers

func FoundationHTTPHandlers() []foundationweb.HandlerDefinition

func RegisterFoundation

func RegisterFoundation(application *foundationapp.App)

Types

type CreateUser

type CreateUser struct {
	Name  string    `json:"name"`
	Users UserStore `inject:"users"`
	// contains filtered or unexported fields
}

CreateUser is a generated action registration target.

func (*CreateUser) Handle

func (a *CreateUser) Handle(context.Context) (any, error)

Handle creates a user.

type GetUser

type GetUser struct {
	ID    int       `path:"id"`
	Users UserStore `inject:"users"`
	// contains filtered or unexported fields
}

GetUser is a generated HTTP registration target.

func (*GetUser) Handle

func (h *GetUser) Handle(context.Context) (any, error)

Handle returns the requested user.

type MemoryUserStore

type MemoryUserStore struct {
	contracts.Implements[UserStore]
	// contains filtered or unexported fields
}

MemoryUserStore is an in-memory UserStore implementation.

func NewMemoryUserStore

func NewMemoryUserStore() *MemoryUserStore

NewMemoryUserStore creates an empty store.

func (*MemoryUserStore) Create

func (s *MemoryUserStore) Create(name string) User

Create stores a user.

func (*MemoryUserStore) Find

func (s *MemoryUserStore) Find(id int) (User, bool)

Find returns a user by ID.

type User

type User struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

User is the model returned by the example handlers.

type UserStore

type UserStore interface {
	Create(name string) User
	Find(id int) (User, bool)
}

UserStore is the application contract used by the example.

Jump to

Keyboard shortcuts

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