first commit

This commit is contained in:
2025-07-26 18:34:56 +05:30
commit d340db6dfd
29 changed files with 2284 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
// Code generated by db-gen. DO NOT EDIT.
package branchuser
import "code.patial.tech/go/pgm"
const (
// BranchID field has db type "bigint NOT NULL"
BranchID pgm.Field = "branch_users.branch_id"
// UserID field has db type "bigint NOT NULL"
UserID pgm.Field = "branch_users.user_id"
// RoleID field has db type "smallint NOT NULL"
RoleID pgm.Field = "branch_users.role_id"
// CreatedAt field has db type "timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL"
CreatedAt pgm.Field = "branch_users.created_at"
// UpdatedAt field has db type "timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL"
UpdatedAt pgm.Field = "branch_users.updated_at"
)

View File

@@ -0,0 +1,18 @@
// Code generated by db-gen. DO NOT EDIT.
package comment
import "code.patial.tech/go/pgm"
const (
// ID field has db type "integer NOT NULL"
ID pgm.Field = "comments.id"
// PostID field has db type "integer NOT NULL"
PostID pgm.Field = "comments.post_id"
// UserID field has db type "integer NOT NULL"
UserID pgm.Field = "comments.user_id"
// Content field has db type "text NOT NULL"
Content pgm.Field = "comments.content"
// CreatedAt field has db type "timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP"
CreatedAt pgm.Field = "comments.created_at"
)

View File

@@ -0,0 +1,18 @@
// Code generated by db-gen. DO NOT EDIT.
package employee
import "code.patial.tech/go/pgm"
const (
// ID field has db type "integer NOT NULL"
ID pgm.Field = "employees.id"
// Name field has db type "var NOT NULL"
Name pgm.Field = "employees.name"
// Department field has db type "var NOT NULL"
Department pgm.Field = "employees.department"
// Salary field has db type "decimal(10,2)"
Salary pgm.Field = "employees.salary"
// CreatedAt field has db type "timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP updated_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP"
CreatedAt pgm.Field = "employees.created_at"
)

18
example/db/post/posts.go Normal file
View File

@@ -0,0 +1,18 @@
// Code generated by db-gen. DO NOT EDIT.
package post
import "code.patial.tech/go/pgm"
const (
// ID field has db type "integer NOT NULL"
ID pgm.Field = "posts.id"
// UserID field has db type "integer NOT NULL"
UserID pgm.Field = "posts.user_id"
// Title field has db type "character varying(255) NOT NULL"
Title pgm.Field = "posts.title"
// Content field has db type "text"
Content pgm.Field = "posts.content"
// CreatedAt field has db type "timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP"
CreatedAt pgm.Field = "posts.created_at"
)

15
example/db/schema.go Normal file
View File

@@ -0,0 +1,15 @@
// Code generated by code.patial.tech/go/pgm/cmd
// DO NOT EDIT.
package db
import "code.patial.tech/go/pgm"
var (
User = pgm.Table{Name: "users", FieldCount: 11}
UserSession = pgm.Table{Name: "user_sessions", FieldCount: 8}
BranchUser = pgm.Table{Name: "branch_users", FieldCount: 5}
Post = pgm.Table{Name: "posts", FieldCount: 5}
Comment = pgm.Table{Name: "comments", FieldCount: 5}
Employee = pgm.Table{Name: "employees", FieldCount: 5}
)

30
example/db/user/users.go Normal file
View File

@@ -0,0 +1,30 @@
// Code generated by db-gen. DO NOT EDIT.
package user
import "code.patial.tech/go/pgm"
const (
// ID field has db type "integer NOT NULL"
ID pgm.Field = "users.id"
// Name field has db type "character varying(255) NOT NULL"
Name pgm.Field = "users.name"
// Email field has db type "character varying(255) NOT NULL"
Email pgm.Field = "users.email"
// Phone field has db type "character varying(20)"
Phone pgm.Field = "users.phone"
// FirstName field has db type "character varying(50) NOT NULL"
FirstName pgm.Field = "users.first_name"
// MiddleName field has db type "character varying(50)"
MiddleName pgm.Field = "users.middle_name"
// LastName field has db type "character varying(50) NOT NULL"
LastName pgm.Field = "users.last_name"
// StatusID field has db type "smallint"
StatusID pgm.Field = "users.status_id"
// MfaKind field has db type "character varying(50) DEFAULT 'None'::character varying"
MfaKind pgm.Field = "users.mfa_kind"
// CreatedAt field has db type "timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP"
CreatedAt pgm.Field = "users.created_at"
// UpdatedAt field has db type "timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP"
UpdatedAt pgm.Field = "users.updated_at"
)

View File

@@ -0,0 +1,24 @@
// Code generated by db-gen. DO NOT EDIT.
package usersession
import "code.patial.tech/go/pgm"
const (
// ID field has db type "character varying NOT NULL"
ID pgm.Field = "user_sessions.id"
// CreatedAt field has db type "timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL"
CreatedAt pgm.Field = "user_sessions.created_at"
// UpdatedAt field has db type "timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL"
UpdatedAt pgm.Field = "user_sessions.updated_at"
// ExpiresAt field has db type "timestamp with time zone NOT NULL"
ExpiresAt pgm.Field = "user_sessions.expires_at"
// BranchID field has db type "bigint"
BranchID pgm.Field = "user_sessions.branch_id"
// UserID field has db type "bigint NOT NULL"
UserID pgm.Field = "user_sessions.user_id"
// RoleID field has db type "smallint"
RoleID pgm.Field = "user_sessions.role_id"
// LoginIp field has db type "character varying NOT NULL"
LoginIp pgm.Field = "user_sessions.login_ip"
)