Skip to content

Commit e8ea218

Browse files
committed
squibble: fix some comment typos and add documentation links
1 parent 323a915 commit e8ea218

3 files changed

Lines changed: 24 additions & 24 deletions

File tree

squibble.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
//
66
// # Overview
77
//
8-
// A Schema value manages the schema of a SQLite database that will be modified
9-
// over time. The current database schema is stored in the Current field, and
10-
// migrations from previous versions are captured as UpdateRules.
8+
// A [Schema] value manages the schema of a SQLite database that will be
9+
// modified over time. The current database schema is stored in the Current
10+
// field, and migrations from previous versions are captured as UpdateRules.
1111
//
12-
// When the program starts up, it should pass the open database to the Apply
13-
// method of the Schema. This verifies that the Schema is valid, then checks
12+
// When the program starts up, it should pass the open database to the
13+
// [Schema.Apply] method. This verifies that the Schema is valid, then checks
1414
// whether the database is up-to-date. If not, it applies any relevant update
1515
// rules to bring it to the current state. If Apply fails, the database is
1616
// rolled back.
@@ -22,11 +22,11 @@
2222
//
2323
// # Update Rules
2424
//
25-
// The Updates field of the Schema must contain an ordered list of update rules
26-
// for all the versions of the schema prior to the Current one, from oldest to
27-
// newest. Each rule has the hash of a previous schema version and a function
28-
// that can be applied to the database to upgrade it to the next version in
29-
// sequence.
25+
// The Updates field of the [Schema] must contain an ordered list of
26+
// [UpdateRule] for each version of the schema prior to the Current one from
27+
// oldest to newest. Each rule has the hash of a previous schema version and a
28+
// function that can be applied to the database to upgrade it to the next
29+
// version in sequence.
3030
//
3131
// When revising the schema, you must add a new rule mapping the old (existing)
3232
// schema to the new one. These rules are intended to be a permanent record of
@@ -45,7 +45,7 @@
4545
//
4646
// # Validation
4747
//
48-
// You use the Validate function to check that the current schema in the
48+
// You use the [Validate] function to check that the current schema in the
4949
// special sqlite_schema table maintained by SQLite matches a schema written as
5050
// SQL text. If not, it reports a diff describing the differences between what
5151
// the text wants and what the real schema has.
@@ -130,20 +130,20 @@ func (s *Schema) logf(msg string, args ...any) {
130130

131131
type ctxSchemaKey struct{}
132132

133-
// Logf sends a log message to the logger attached to ctx, or to log.Printf if
134-
// ctx does not have a logger attached. The context passed to the apply
135-
// function of an UpdateRule will have this set to the logger for the Schema.
133+
// Logf sends a log message to the logger attached to ctx, or to [log.Printf]
134+
// if ctx does not have a logger attached. The context passed to the apply
135+
// function of an UpdateRule will have this set to the logger for the [Schema].
136136
func Logf(ctx context.Context, msg string, args ...any) {
137137
s, _ := ctx.Value(ctxSchemaKey{}).(*Schema)
138138
s.logf(msg, args...)
139139
}
140140

141141
// Apply applies any pending schema migrations to the given database. It
142-
// reports an error immediately if s is not consistent (per Check); otherwise
143-
// it creates a new transaction and attempts to apply all applicable upgrades
144-
// to db within it. If this succeeds and the transaction commits successfully,
145-
// then Apply succeeds. Otherwise, the transaction is rolled back and Apply
146-
// reports the reason wny.
142+
// reports an error immediately if s is not consistent (per [Schema.Check]);
143+
// otherwise it creates a new transaction and attempts to apply all applicable
144+
// upgrades to db within it. If this succeeds and the transaction commits
145+
// successfully, then Apply succeeds. Otherwise, the transaction is rolled back
146+
// and Apply reports the reason why.
147147
//
148148
// When applying a schema to an existing unmanaged database, Apply reports an
149149
// error if the current schema is not compatible with the existing schema;
@@ -335,7 +335,7 @@ func History(ctx context.Context, db DBConn) ([]HistoryRow, error) {
335335
return out, nil
336336
}
337337

338-
// HistoryRow is a row in the schema history maintained by the Schema type.
338+
// HistoryRow is a row in the schema history maintained by the [Schema] type.
339339
type HistoryRow struct {
340340
Timestamp time.Time `json:"timestamp"` // In UTC
341341
Digest string `json:"digest"` // The digest of the schema at this update

upgrades.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"fmt"
99
)
1010

11-
// Exec returns an UpdateRule apply function that executes the specified
11+
// Exec returns an [UpdateRule] apply function that executes the specified
1212
// statements sequentially.
1313
func Exec(stmts ...string) func(context.Context, DBConn) error {
1414
return func(ctx context.Context, db DBConn) error {

validate.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import (
1414

1515
// Validate checks whether the current schema of db appears to match the
1616
// specified schema, and reports an error if there are discrepancies.
17-
// An error reported by Validate has concrete type ValidationError if
18-
// the schemas differ.
17+
// An error reported by Validate has concrete type [ValidationError] if the
18+
// schemas differ.
1919
func Validate(ctx context.Context, db DBConn, schema string) error {
2020
comp, err := schemaTextToRows(ctx, schema)
2121
if err != nil {
@@ -48,7 +48,7 @@ func schemaTextToRows(ctx context.Context, schema string) ([]schemaRow, error) {
4848
return readSchema(ctx, tx, "main")
4949
}
5050

51-
// ValidationError is the concrete type of errors reported by the Validate
51+
// ValidationError is the concrete type of errors reported by the [Validate]
5252
// function.
5353
type ValidationError struct {
5454
// Diff is a human readable summary of the difference between what was in

0 commit comments

Comments
 (0)