models

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package models is the schema of the testing example: bank accounts whose balance the database refuses to take below zero.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	momo.Model `momo:"table:accounts"`
	ID         int64  `momo:"pk,identity"`
	Owner      string `momo:"size:100,notnull,unique"`
	Balance    int64  `momo:"notnull,check:balance >= 0"`
}

Account holds money. The check constraint is what makes a failed debit a reliable reason to roll back: the database enforces the rule, not the caller.

func (*Account) MomoMeta

func (*Account) MomoMeta() *momo.Meta[Account]

Directories

Path Synopsis
Package account holds typed column descriptors and relation descriptors for the Account model.
Package account holds typed column descriptors and relation descriptors for the Account model.

Jump to

Keyboard shortcuts

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