Code Explainers

Code explainers tagged #error-wrapping

go
type PostCursor struct {
	CreatedAt time.Time
	ID        int64
}

Keyset pagination with cursors in Go

pagination keyset-cursor database
Intermediate 8 steps
go
package config
 
import (
	"fmt"

Parsing timeout config in Go

configuration validation error-wrapping
Intermediate 7 steps
go
package storage
 
import (
	"context"

A SQLite-backed order store in Go

database/sql sqlite error-wrapping
Intermediate 7 steps
go
package config
 
import (
	"fmt"

Loading and saving YAML config in Go

yaml struct-tags defaults
Intermediate 8 steps
go
package checksum
 
import (
	"crypto/sha256"

Computing SHA-256 checksums in Go

hashing io-streaming filesystem-walk
Intermediate 7 steps
go
package inventory
 
import (
	"encoding/csv"

Parsing CSV into typed structs in Go

csv-parsing error-wrapping type-conversion
Intermediate 8 steps
go
package payments
 
import (
	"context"

Fetching a charge over HTTP in Go

context-timeout http-client json-decoding
Intermediate 6 steps
go
package feed
 
import (
	"encoding/json"

Streaming a JSON array in Go

streaming json decoder
Intermediate 6 steps
go
package store
 
import (
	"database/sql"

Wrapping and inspecting errors in Go

error-handling error-wrapping sentinel-errors
Intermediate 8 steps