Skip to content

Instantly share code, notes, and snippets.

@scottcagno
scottcagno / app.go
Last active September 25, 2023 21:15
Web framework idea...
package app
import (
"fmt"
"log/slog"
"net/http"
"os"
"sort"
"strings"
"sync"
@scottcagno
scottcagno / search.go
Created September 19, 2023 20:54
Simple beginnings of a search engine type thing...
package main
import (
"fmt"
"io"
"log"
"os"
"regexp"
"sort"
"strconv"
@scottcagno
scottcagno / bin.go
Last active July 26, 2023 17:29
simple binary encoding and decoding
package main
import (
"bufio"
"bytes"
"encoding/binary"
"fmt"
"io"
"log"
"math"
@scottcagno
scottcagno / table_dto.go
Created January 30, 2023 18:56
General purpose DTO in Go
package main
import (
"fmt"
"reflect"
)
type User struct {
ID int
Name string
@scottcagno
scottcagno / main.go
Created January 23, 2023 07:59
Poller.go
package main
import (
"fmt"
"log"
"sync"
"time"
)
func main() {
@scottcagno
scottcagno / api-new-idea.go
Last active December 21, 2022 21:27
API ideas and examples
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"reflect"
"runtime"
"strconv"
@scottcagno
scottcagno / poller_ticker.go
Created November 24, 2022 21:10
Poller Ticker final
https://go.dev/play/p/oAUq-zpkhhp
@scottcagno
scottcagno / final-repo.go
Last active January 20, 2024 22:05
Generic Repository idea and implementation
package api
import (
"errors"
"sync"
)
// QueryFunc is a function that is injected with a type
// and returns a boolean
type QueryFunc[T any] func(t T) bool
@scottcagno
scottcagno / main.go
Created October 26, 2022 22:28
RESTful API Idea in Go
package main
import (
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"net/url"
)
@scottcagno
scottcagno / RESTful.md
Created October 2, 2022 21:50
RESTful API Guidelines

RESTful APIs

The term REST was suggested by Roy Fielding in his Ph.D. dissertation in the year 2000.
It stands for Representational State Transfer and is described as:

"REST emphasizes scalability of component interactions, generality of interfaces,
independent deployment of components, and intermediary components to reduce interaction
latency, enforce security and encapsulate legacy systems."