diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 2776e6a..f0baa96 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -33,7 +33,7 @@ nfpms: homepage: https://phi-orm.vercel.app maintainer: Clancy description: "Phi - A compile-time ORM for Go mirroring the Prisma developer experience." - license: MIT + license: Apache-2.0 formats: - deb - rpm diff --git a/README.md b/README.md index 42f7ea7..5f9726a 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,60 @@ # Phi -Phi is a **compile-time ORM for Go** that mirrors the Prisma developer experience. It parses your `schema.prisma` file and generates a type-safe client with zero reflection at runtime. +Phi is a compile-time ORM for Go that mirrors the Prisma developer experience. It parses your `schema.prisma` file and generates a strongly-typed Go database client with zero runtime reflection. -## Features +[Documentation Website](https://phi-orm.vercel.app) | [pkg.go.dev](https://pkg.go.dev/github.com/voidclancy/phi) -- **Compile-time type safety** - queries, predicates, and results are generated from your schema, so mistakes fail at build time, not runtime. -- **Zero runtime overhead** - no reflection, no sidecars. Everything compiles down to standard `database/sql`. -- **Prisma-style schema** - keep writing `schema.prisma` and get types, builders, and migrations generated from it. -- **Multi-provider** - PostgreSQL, SQLite (for now). -- **Schema migrations** - generate and apply migrations straight from the CLI, with optional embedded migrations. +## Key Features + +* **Compile-time Type Safety**: Queries, predicates, and selections fail at build time if invalid. +* **Zero Reflection**: Compiles down to standard `database/sql` calls for maximum query execution speed. +* **Prisma Schema DX**: Use your existing `schema.prisma` models, enums, native attributes, and relations. +* **Declarative Migrations**: Integrated forward-only migration engine powered by Atlas DDL diffing. +* **Extension Hooks**: Intercept and mutate CRUD operations via middleware closures. +* **Multi-Provider**: Native support for PostgreSQL and SQLite. + +## Installation + +Install the Phi CLI tool: + +```bash +go install github.com/voidclancy/phi@latest +``` + +## Quick Start + +1. Initialize your configuration file: + +```bash +phi init +``` + +2. Generate your type-safe Go client: + +```bash +phi generate +``` + +3. Query your database: + +```go +client, err := phi.NewClient(phi.WithDSN(os.Getenv("DATABASE_URL"))) +if err != nil { + log.Fatal(err) +} +defer client.Close() + +u, err := client.User.FindUnique( + user.Email.EQ("user@example.com"), +).Exec(ctx) +``` ## Documentation -[https://phi-orm.vercel.app](https://phi-orm.vercel.app) \ No newline at end of file +Full guides, API references, CLI commands, and hooks documentation are available on the documentation website: + +[https://phi-orm.vercel.app](https://phi-orm.vercel.app) + +## License + +[Apache 2.0 License](LICENSE) \ No newline at end of file diff --git a/makefile b/makefile index 3e001da..52446bf 100644 --- a/makefile +++ b/makefile @@ -1,4 +1,15 @@ -.PHONY: build build-prod run test coverage cover-html install db-up db-down db-clean bi fmt fmt-check tidy tidy-check vulncheck vet integration-gen integration-test bench bench-sqlite bench-pg bench-all race lint test-sqlite test-pg test-dbs ci-local +.PHONY: build build-prod run test coverage cover-html install db-up db-down db-clean bi fmt fmt-check tidy tidy-check vulncheck vet integration-gen integration-test bench bench-sqlite bench-pg bench-all race lint test-sqlite test-pg test-dbs ci-local index-pkg + +index-pkg: + @TAG=$$(git describe --tags --abbrev=0 2>/dev/null); \ + if [ -z "$$TAG" ]; then \ + echo "No git tag found. Please push a tag first (e.g. git tag v0.1.0 && git push origin v0.1.0)"; \ + exit 1; \ + fi; \ + echo "Indexing $$TAG on pkg.go.dev via proxy.golang.org..."; \ + curl -s https://proxy.golang.org/github.com/voidclancy/phi/@v/$$TAG.info; \ + echo ""; \ + echo "Package $$TAG submitted to pkg.go.dev" bi: build install