models

package
v0.0.0-...-b043d65 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CategoryTableName = "categories"

CategoryTableName is the database table name.

View Source
const CommentTableName = "comments"

CommentTableName is the database table name.

View Source
const PostTableName = "posts"

PostTableName is the database table name.

View Source
const PostTagTableName = "post_tags"

PostTagTableName is the database table name.

View Source
const ProfileTableName = "profiles"

ProfileTableName is the database table name.

View Source
const TagTableName = "tags"

TagTableName is the database table name.

View Source
const UserTableName = "users"

UserTableName is the database table name.

Variables

View Source
var CategoryColumns = struct {
	ID       string
	Name     string
	ParentID string
}{
	ID:       "id",
	Name:     "name",
	ParentID: "parent_id",
}

CategoryColumns contains all column names for the categories table.

View Source
var CategoryPreloadParent = sqlgen.PreloadDef{
	Name:     "Parent",
	Table:    CategoryTableName,
	JoinCond: "\"categories\".\"id\" = \"categories\".\"parent_id\"",
	Columns: []string{
		"\"categories\".\"id\"",
		"\"categories\".\"name\"",
		"\"categories\".\"parent_id\"",
	},
}

CategoryPreloadParent is the PreloadDef for the Parent relationship.

View Source
var CategoryWhere = struct {
	ID       CategoryIDFilter
	Name     CategoryNameFilter
	ParentID CategoryParentIDFilter
}{
	ID:       CategoryIDFilter{/* contains filtered or unexported fields */},
	Name:     CategoryNameFilter{/* contains filtered or unexported fields */},
	ParentID: CategoryParentIDFilter{/* contains filtered or unexported fields */},
}

CategoryWhere provides type-safe where clause builders for each column.

View Source
var CommentColumns = struct {
	ID              string
	AuthorID        string
	CommentableType string
	CommentableID   string
	Kind            string
	Body            string
	CreatedAt       string
}{
	ID:              "id",
	AuthorID:        "author_id",
	CommentableType: "commentable_type",
	CommentableID:   "commentable_id",
	Kind:            "kind",
	Body:            "body",
	CreatedAt:       "created_at",
}

CommentColumns contains all column names for the comments table.

View Source
var CommentPreloadUser = sqlgen.PreloadDef{
	Name:     "User",
	Table:    UserTableName,
	JoinCond: "\"users\".\"id\" = \"comments\".\"author_id\"",
	Columns: []string{
		"\"users\".\"id\"",
		"\"users\".\"email\"",
		"\"users\".\"name\"",
		"\"users\".\"bio\"",
		"\"users\".\"age\"",
		"\"users\".\"score\"",
		"\"users\".\"is_admin\"",
		"\"users\".\"metadata\"",
		"\"users\".\"created_at\"",
	},
}

CommentPreloadUser is the PreloadDef for the User relationship.

View Source
var CommentWhere = struct {
	ID              CommentIDFilter
	AuthorID        CommentAuthorIDFilter
	CommentableType CommentCommentableTypeFilter
	CommentableID   CommentCommentableIDFilter
	Kind            CommentKindFilter
	Body            CommentBodyFilter
	CreatedAt       CommentCreatedAtFilter
}{
	ID:              CommentIDFilter{/* contains filtered or unexported fields */},
	AuthorID:        CommentAuthorIDFilter{/* contains filtered or unexported fields */},
	CommentableType: CommentCommentableTypeFilter{/* contains filtered or unexported fields */},
	CommentableID:   CommentCommentableIDFilter{/* contains filtered or unexported fields */},
	Kind:            CommentKindFilter{/* contains filtered or unexported fields */},
	Body:            CommentBodyFilter{/* contains filtered or unexported fields */},
	CreatedAt:       CommentCreatedAtFilter{/* contains filtered or unexported fields */},
}

CommentWhere provides type-safe where clause builders for each column.

View Source
var PostColumns = struct {
	ID          string
	AuthorID    string
	CategoryID  string
	Title       string
	Body        string
	Status      string
	CreatedAt   string
	PublishedAt string
}{
	ID:          "id",
	AuthorID:    "author_id",
	CategoryID:  "category_id",
	Title:       "title",
	Body:        "body",
	Status:      "status",
	CreatedAt:   "created_at",
	PublishedAt: "published_at",
}

PostColumns contains all column names for the posts table.

View Source
var PostPreloadCategory = sqlgen.PreloadDef{
	Name:     "Category",
	Table:    CategoryTableName,
	JoinCond: "\"categories\".\"id\" = \"posts\".\"category_id\"",
	Columns: []string{
		"\"categories\".\"id\"",
		"\"categories\".\"name\"",
		"\"categories\".\"parent_id\"",
	},
}

PostPreloadCategory is the PreloadDef for the Category relationship.

View Source
var PostPreloadUser = sqlgen.PreloadDef{
	Name:     "User",
	Table:    UserTableName,
	JoinCond: "\"users\".\"id\" = \"posts\".\"author_id\"",
	Columns: []string{
		"\"users\".\"id\"",
		"\"users\".\"email\"",
		"\"users\".\"name\"",
		"\"users\".\"bio\"",
		"\"users\".\"age\"",
		"\"users\".\"score\"",
		"\"users\".\"is_admin\"",
		"\"users\".\"metadata\"",
		"\"users\".\"created_at\"",
	},
}

PostPreloadUser is the PreloadDef for the User relationship.

View Source
var PostTagColumns = struct {
	PostID string
	TagID  string
}{
	PostID: "post_id",
	TagID:  "tag_id",
}

PostTagColumns contains all column names for the post_tags table.

View Source
var PostTagWhere = struct {
	PostID PostTagPostIDFilter
	TagID  PostTagTagIDFilter
}{
	PostID: PostTagPostIDFilter{/* contains filtered or unexported fields */},
	TagID:  PostTagTagIDFilter{/* contains filtered or unexported fields */},
}

PostTagWhere provides type-safe where clause builders for each column.

View Source
var PostWhere = struct {
	ID          PostIDFilter
	AuthorID    PostAuthorIDFilter
	CategoryID  PostCategoryIDFilter
	Title       PostTitleFilter
	Body        PostBodyFilter
	Status      PostStatusFilter
	CreatedAt   PostCreatedAtFilter
	PublishedAt PostPublishedAtFilter
}{
	ID:          PostIDFilter{/* contains filtered or unexported fields */},
	AuthorID:    PostAuthorIDFilter{/* contains filtered or unexported fields */},
	CategoryID:  PostCategoryIDFilter{/* contains filtered or unexported fields */},
	Title:       PostTitleFilter{/* contains filtered or unexported fields */},
	Body:        PostBodyFilter{/* contains filtered or unexported fields */},
	Status:      PostStatusFilter{/* contains filtered or unexported fields */},
	CreatedAt:   PostCreatedAtFilter{/* contains filtered or unexported fields */},
	PublishedAt: PostPublishedAtFilter{/* contains filtered or unexported fields */},
}

PostWhere provides type-safe where clause builders for each column.

View Source
var ProfileColumns = struct {
	ID        string
	UserID    string
	AvatarURL string
	Website   string
}{
	ID:        "id",
	UserID:    "user_id",
	AvatarURL: "avatar_url",
	Website:   "website",
}

ProfileColumns contains all column names for the profiles table.

View Source
var ProfilePreloadUser = sqlgen.PreloadDef{
	Name:     "User",
	Table:    UserTableName,
	JoinCond: "\"users\".\"id\" = \"profiles\".\"user_id\"",
	Columns: []string{
		"\"users\".\"id\"",
		"\"users\".\"email\"",
		"\"users\".\"name\"",
		"\"users\".\"bio\"",
		"\"users\".\"age\"",
		"\"users\".\"score\"",
		"\"users\".\"is_admin\"",
		"\"users\".\"metadata\"",
		"\"users\".\"created_at\"",
	},
}

ProfilePreloadUser is the PreloadDef for the User relationship.

View Source
var ProfileWhere = struct {
	ID        ProfileIDFilter
	UserID    ProfileUserIDFilter
	AvatarURL ProfileAvatarURLFilter
	Website   ProfileWebsiteFilter
}{
	ID:        ProfileIDFilter{/* contains filtered or unexported fields */},
	UserID:    ProfileUserIDFilter{/* contains filtered or unexported fields */},
	AvatarURL: ProfileAvatarURLFilter{/* contains filtered or unexported fields */},
	Website:   ProfileWebsiteFilter{/* contains filtered or unexported fields */},
}

ProfileWhere provides type-safe where clause builders for each column.

View Source
var TagColumns = struct {
	ID   string
	Name string
}{
	ID:   "id",
	Name: "name",
}

TagColumns contains all column names for the tags table.

View Source
var TagWhere = struct {
	ID   TagIDFilter
	Name TagNameFilter
}{
	ID:   TagIDFilter{/* contains filtered or unexported fields */},
	Name: TagNameFilter{/* contains filtered or unexported fields */},
}

TagWhere provides type-safe where clause builders for each column.

View Source
var UserColumns = struct {
	ID        string
	Email     string
	Name      string
	Bio       string
	Age       string
	Score     string
	IsAdmin   string
	Metadata  string
	CreatedAt string
}{
	ID:        "id",
	Email:     "email",
	Name:      "name",
	Bio:       "bio",
	Age:       "age",
	Score:     "score",
	IsAdmin:   "is_admin",
	Metadata:  "metadata",
	CreatedAt: "created_at",
}

UserColumns contains all column names for the users table.

View Source
var UserPreloadProfile = sqlgen.PreloadDef{
	Name:     "Profile",
	Table:    ProfileTableName,
	JoinCond: "\"profiles\".\"user_id\" = \"users\".\"id\"",
	Columns: []string{
		"\"profiles\".\"id\"",
		"\"profiles\".\"user_id\"",
		"\"profiles\".\"avatar_url\"",
		"\"profiles\".\"website\"",
	},
}

UserPreloadProfile is the PreloadDef for the Profile relationship.

View Source
var UserWhere = struct {
	ID        UserIDFilter
	Email     UserEmailFilter
	Name      UserNameFilter
	Bio       UserBioFilter
	Age       UserAgeFilter
	Score     UserScoreFilter
	IsAdmin   UserIsAdminFilter
	Metadata  UserMetadataFilter
	CreatedAt UserCreatedAtFilter
}{
	ID:        UserIDFilter{/* contains filtered or unexported fields */},
	Email:     UserEmailFilter{/* contains filtered or unexported fields */},
	Name:      UserNameFilter{/* contains filtered or unexported fields */},
	Bio:       UserBioFilter{/* contains filtered or unexported fields */},
	Age:       UserAgeFilter{/* contains filtered or unexported fields */},
	Score:     UserScoreFilter{/* contains filtered or unexported fields */},
	IsAdmin:   UserIsAdminFilter{/* contains filtered or unexported fields */},
	Metadata:  UserMetadataFilter{/* contains filtered or unexported fields */},
	CreatedAt: UserCreatedAtFilter{/* contains filtered or unexported fields */},
}

UserWhere provides type-safe where clause builders for each column.

Functions

func AddCategoryHook

func AddCategoryHook(point sqlgen.HookPoint, fn CategoryHook)

AddCategoryHook registers a typed hook for the given hook point. The hook receives the model pointer and can inspect or modify it.

func AddCommentHook

func AddCommentHook(point sqlgen.HookPoint, fn CommentHook)

AddCommentHook registers a typed hook for the given hook point. The hook receives the model pointer and can inspect or modify it.

func AddPostHook

func AddPostHook(point sqlgen.HookPoint, fn PostHook)

AddPostHook registers a typed hook for the given hook point. The hook receives the model pointer and can inspect or modify it.

func AddPostTagHook

func AddPostTagHook(point sqlgen.HookPoint, fn PostTagHook)

AddPostTagHook registers a typed hook for the given hook point. The hook receives the model pointer and can inspect or modify it.

func AddProfileHook

func AddProfileHook(point sqlgen.HookPoint, fn ProfileHook)

AddProfileHook registers a typed hook for the given hook point. The hook receives the model pointer and can inspect or modify it.

func AddTagHook

func AddTagHook(point sqlgen.HookPoint, fn TagHook)

AddTagHook registers a typed hook for the given hook point. The hook receives the model pointer and can inspect or modify it.

func AddUserHook

func AddUserHook(point sqlgen.HookPoint, fn UserHook)

AddUserHook registers a typed hook for the given hook point. The hook receives the model pointer and can inspect or modify it.

func Categories

func Categories(mods ...sqlgen.QueryMod) *sqlgen.Query

Categories returns a query builder for the categories table.

func CategoryCursor

func CategoryCursor(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (*sqlgen.Cursor[*Category], error)

CategoryCursor returns a cursor for iterating over categories rows one at a time.

func CategoryExists

func CategoryExists(ctx context.Context, exec sqlgen.Executor, id int32) (bool, error)

Exists checks if a row with the given primary key exists.

func CommentCursor

func CommentCursor(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (*sqlgen.Cursor[*Comment], error)

CommentCursor returns a cursor for iterating over comments rows one at a time.

func CommentExists

func CommentExists(ctx context.Context, exec sqlgen.Executor, id string) (bool, error)

Exists checks if a row with the given primary key exists.

func Comments

func Comments(mods ...sqlgen.QueryMod) *sqlgen.Query

Comments returns a query builder for the comments table.

func CountCategories

func CountCategories(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)

CountCategories returns the count of rows matching the query mods.

func CountComments

func CountComments(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)

CountComments returns the count of rows matching the query mods.

func CountPostTags

func CountPostTags(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)

CountPostTags returns the count of rows matching the query mods.

func CountPosts

func CountPosts(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)

CountPosts returns the count of rows matching the query mods.

func CountProfiles

func CountProfiles(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)

CountProfiles returns the count of rows matching the query mods.

func CountTags

func CountTags(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)

CountTags returns the count of rows matching the query mods.

func CountUsers

func CountUsers(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)

CountUsers returns the count of rows matching the query mods.

func DeleteAllCategories

func DeleteAllCategories(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)

DeleteAllCategories deletes all rows matching the given mods.

func DeleteAllComments

func DeleteAllComments(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)

DeleteAllComments deletes all rows matching the given mods.

func DeleteAllPostTags

func DeleteAllPostTags(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)

DeleteAllPostTags deletes all rows matching the given mods.

func DeleteAllPosts

func DeleteAllPosts(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)

DeleteAllPosts deletes all rows matching the given mods.

func DeleteAllProfiles

func DeleteAllProfiles(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)

DeleteAllProfiles deletes all rows matching the given mods.

func DeleteAllTags

func DeleteAllTags(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)

DeleteAllTags deletes all rows matching the given mods.

func DeleteAllUsers

func DeleteAllUsers(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)

DeleteAllUsers deletes all rows matching the given mods.

func EachCategory

func EachCategory(ctx context.Context, exec sqlgen.Executor, fn func(*Category) error, mods ...sqlgen.QueryMod) error

EachCategory executes a query and calls fn for each row. Iteration stops early if fn returns an error. Rows are not accumulated in memory.

func EachComment

func EachComment(ctx context.Context, exec sqlgen.Executor, fn func(*Comment) error, mods ...sqlgen.QueryMod) error

EachComment executes a query and calls fn for each row. Iteration stops early if fn returns an error. Rows are not accumulated in memory.

func EachPost

func EachPost(ctx context.Context, exec sqlgen.Executor, fn func(*Post) error, mods ...sqlgen.QueryMod) error

EachPost executes a query and calls fn for each row. Iteration stops early if fn returns an error. Rows are not accumulated in memory.

func EachPostTag

func EachPostTag(ctx context.Context, exec sqlgen.Executor, fn func(*PostTag) error, mods ...sqlgen.QueryMod) error

EachPostTag executes a query and calls fn for each row. Iteration stops early if fn returns an error. Rows are not accumulated in memory.

func EachProfile

func EachProfile(ctx context.Context, exec sqlgen.Executor, fn func(*Profile) error, mods ...sqlgen.QueryMod) error

EachProfile executes a query and calls fn for each row. Iteration stops early if fn returns an error. Rows are not accumulated in memory.

func EachTag

func EachTag(ctx context.Context, exec sqlgen.Executor, fn func(*Tag) error, mods ...sqlgen.QueryMod) error

EachTag executes a query and calls fn for each row. Iteration stops early if fn returns an error. Rows are not accumulated in memory.

func EachUser

func EachUser(ctx context.Context, exec sqlgen.Executor, fn func(*User) error, mods ...sqlgen.QueryMod) error

EachUser executes a query and calls fn for each row. Iteration stops early if fn returns an error. Rows are not accumulated in memory.

func PostCursor

func PostCursor(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (*sqlgen.Cursor[*Post], error)

PostCursor returns a cursor for iterating over posts rows one at a time.

func PostExists

func PostExists(ctx context.Context, exec sqlgen.Executor, id string) (bool, error)

Exists checks if a row with the given primary key exists.

func PostTagCursor

func PostTagCursor(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (*sqlgen.Cursor[*PostTag], error)

PostTagCursor returns a cursor for iterating over post_tags rows one at a time.

func PostTagExists

func PostTagExists(ctx context.Context, exec sqlgen.Executor, postID string, tagID int32) (bool, error)

Exists checks if a row with the given primary key exists.

func PostTags

func PostTags(mods ...sqlgen.QueryMod) *sqlgen.Query

PostTags returns a query builder for the post_tags table.

func Posts

func Posts(mods ...sqlgen.QueryMod) *sqlgen.Query

Posts returns a query builder for the posts table.

func ProfileCursor

func ProfileCursor(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (*sqlgen.Cursor[*Profile], error)

ProfileCursor returns a cursor for iterating over profiles rows one at a time.

func ProfileExists

func ProfileExists(ctx context.Context, exec sqlgen.Executor, id string) (bool, error)

Exists checks if a row with the given primary key exists.

func Profiles

func Profiles(mods ...sqlgen.QueryMod) *sqlgen.Query

Profiles returns a query builder for the profiles table.

func TagCursor

func TagCursor(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (*sqlgen.Cursor[*Tag], error)

TagCursor returns a cursor for iterating over tags rows one at a time.

func TagExists

func TagExists(ctx context.Context, exec sqlgen.Executor, id int32) (bool, error)

Exists checks if a row with the given primary key exists.

func Tags

func Tags(mods ...sqlgen.QueryMod) *sqlgen.Query

Tags returns a query builder for the tags table.

func UpdateAllCategories

func UpdateAllCategories(ctx context.Context, exec sqlgen.Executor, set map[string]any, mods ...sqlgen.QueryMod) (int64, error)

UpdateAllCategories updates all rows matching the given mods. set is a map of column name -> new value.

func UpdateAllComments

func UpdateAllComments(ctx context.Context, exec sqlgen.Executor, set map[string]any, mods ...sqlgen.QueryMod) (int64, error)

UpdateAllComments updates all rows matching the given mods. set is a map of column name -> new value.

func UpdateAllPostTags

func UpdateAllPostTags(ctx context.Context, exec sqlgen.Executor, set map[string]any, mods ...sqlgen.QueryMod) (int64, error)

UpdateAllPostTags updates all rows matching the given mods. set is a map of column name -> new value.

func UpdateAllPosts

func UpdateAllPosts(ctx context.Context, exec sqlgen.Executor, set map[string]any, mods ...sqlgen.QueryMod) (int64, error)

UpdateAllPosts updates all rows matching the given mods. set is a map of column name -> new value.

func UpdateAllProfiles

func UpdateAllProfiles(ctx context.Context, exec sqlgen.Executor, set map[string]any, mods ...sqlgen.QueryMod) (int64, error)

UpdateAllProfiles updates all rows matching the given mods. set is a map of column name -> new value.

func UpdateAllTags

func UpdateAllTags(ctx context.Context, exec sqlgen.Executor, set map[string]any, mods ...sqlgen.QueryMod) (int64, error)

UpdateAllTags updates all rows matching the given mods. set is a map of column name -> new value.

func UpdateAllUsers

func UpdateAllUsers(ctx context.Context, exec sqlgen.Executor, set map[string]any, mods ...sqlgen.QueryMod) (int64, error)

UpdateAllUsers updates all rows matching the given mods. set is a map of column name -> new value.

func UserCursor

func UserCursor(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (*sqlgen.Cursor[*User], error)

UserCursor returns a cursor for iterating over users rows one at a time.

func UserExists

func UserExists(ctx context.Context, exec sqlgen.Executor, id string) (bool, error)

Exists checks if a row with the given primary key exists.

func Users

func Users(mods ...sqlgen.QueryMod) *sqlgen.Query

Users returns a query builder for the users table.

Types

type Category

type Category struct {
	ID       int32              `db:"id" json:"id"`
	Name     string             `db:"name" json:"name"`
	ParentID sqlgen.Null[int32] `db:"parent_id" json:"parent_id"`

	R *CategoryRels `db:"-" json:"-"`
}

Category represents a row from the 'categories' table.

func FindCategoryByPK

func FindCategoryByPK(ctx context.Context, exec sqlgen.Executor, id int32) (*Category, error)

FindCategoryByPK finds a Category by primary key.

func InsertCategory

func InsertCategory(ctx context.Context, exec sqlgen.Executor, mods ...CategoryMod) (*Category, error)

InsertCategory creates a Category with random values, applies mods, and inserts it.

func NewCategory

func NewCategory(mods ...CategoryMod) *Category

NewCategory creates a Category with random values for all non-auto-increment fields. Pass modifier functions to override specific fields.

func (*Category) AddParentsInverse

func (o *Category) AddParentsInverse(ctx context.Context, exec sqlgen.Executor, related ...*Category) error

AddParentsInverse adds models to the ParentsInverse relationship by setting their FK.

func (*Category) AddPosts

func (o *Category) AddPosts(ctx context.Context, exec sqlgen.Executor, related ...*Post) error

AddPosts adds models to the Posts relationship by setting their FK.

func (*Category) Delete

func (o *Category) Delete(ctx context.Context, exec sqlgen.Executor) error

Delete deletes the Category from the database.

func (*Category) Insert

func (o *Category) Insert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Insert inserts the Category into the database. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).

func (*Category) Reload

func (o *Category) Reload(ctx context.Context, exec sqlgen.Executor) error

Reload refreshes the Category from the database using its primary key.

func (*Category) RemoveParent

func (o *Category) RemoveParent(ctx context.Context, exec sqlgen.Executor) error

RemoveParent clears the Parent relationship by setting the FK to NULL.

func (*Category) RemoveParentsInverse

func (o *Category) RemoveParentsInverse(ctx context.Context, exec sqlgen.Executor, related ...*Category) error

RemoveParentsInverse removes models from the ParentsInverse relationship by setting their FK to NULL.

func (*Category) RemovePosts

func (o *Category) RemovePosts(ctx context.Context, exec sqlgen.Executor, related ...*Post) error

RemovePosts removes models from the Posts relationship by setting their FK to NULL.

func (*Category) ScanRow

func (o *Category) ScanRow(rows interface{ Scan(...any) error }) error

ScanRow scans a database row into a Category.

func (*Category) SetParent

func (o *Category) SetParent(ctx context.Context, exec sqlgen.Executor, related *Category) error

SetParent sets the Parent relationship by updating the FK column.

func (*Category) Update

func (o *Category) Update(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Update updates the Category in the database. Only non-PK columns are updated. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).

func (*Category) Upsert

func (o *Category) Upsert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Upsert inserts or updates the Category based on the primary key. Optional Columns parameter controls which non-PK columns are included (Whitelist/Blacklist).

type CategoryHook

type CategoryHook func(ctx context.Context, exec sqlgen.Executor, model *Category) (context.Context, error)

CategoryHook is a typed hook function for Category lifecycle events.

type CategoryIDFilter

type CategoryIDFilter struct {
	// contains filtered or unexported fields
}

CategoryIDFilter provides where clauses for the id column.

func (CategoryIDFilter) EQ

func (CategoryIDFilter) GT

func (CategoryIDFilter) GTE

func (CategoryIDFilter) IN

func (f CategoryIDFilter) IN(vals ...int32) sqlgen.QueryMod

func (CategoryIDFilter) LT

func (CategoryIDFilter) LTE

func (CategoryIDFilter) NEQ

type CategoryMod

type CategoryMod func(*Category)

CategoryMod is a function that customizes a Category before use.

type CategoryNameFilter

type CategoryNameFilter struct {
	// contains filtered or unexported fields
}

CategoryNameFilter provides where clauses for the name column.

func (CategoryNameFilter) EQ

func (CategoryNameFilter) GT

func (CategoryNameFilter) GTE

func (CategoryNameFilter) IN

func (f CategoryNameFilter) IN(vals ...string) sqlgen.QueryMod

func (CategoryNameFilter) LT

func (CategoryNameFilter) LTE

func (CategoryNameFilter) NEQ

type CategoryParentIDFilter

type CategoryParentIDFilter struct {
	// contains filtered or unexported fields
}

CategoryParentIDFilter provides where clauses for the parent_id column.

func (CategoryParentIDFilter) EQ

func (CategoryParentIDFilter) GT

func (CategoryParentIDFilter) GTE

func (CategoryParentIDFilter) IN

func (CategoryParentIDFilter) IsNotNull

func (f CategoryParentIDFilter) IsNotNull() sqlgen.QueryMod

func (CategoryParentIDFilter) IsNull

func (CategoryParentIDFilter) LT

func (CategoryParentIDFilter) LTE

func (CategoryParentIDFilter) NEQ

type CategoryRels

type CategoryRels struct {
	Parent              *Category
	ParentsInverse      []*Category
	ParentsInverseCount *int64
	Posts               []*Post
	PostsCount          *int64
}

CategoryRels holds eagerly loaded relationships.

type CategorySlice

type CategorySlice []*Category

CategorySlice is a slice of Category pointers.

func AllCategories

func AllCategories(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (CategorySlice, error)

AllCategories retrieves all rows from the categories table with the given query mods. Supports Preload() for LEFT JOIN eager loading of to-one relationships.

func (CategorySlice) DeleteAll

func (s CategorySlice) DeleteAll(ctx context.Context, exec sqlgen.Executor) (int64, error)

DeleteAll deletes all models in the slice.

func (CategorySlice) InsertAll

func (s CategorySlice) InsertAll(ctx context.Context, exec sqlgen.Executor) error

InsertAll batch-inserts all models in the slice. Each model's columns are scanned back via RETURNING, picking up defaults and generated values. Hooks are not fired (consistent with UpdateAll/DeleteAll).

func (CategorySlice) LoadCountRelations

func (s CategorySlice) LoadCountRelations(ctx context.Context, exec sqlgen.Executor, names ...string) error

LoadCountRelations loads counts for the specified relationships. Pass relationship names (e.g., "Posts", "Tags") to load their counts.

func (CategorySlice) LoadRelations

func (s CategorySlice) LoadRelations(ctx context.Context, exec sqlgen.Executor, loads ...*sqlgen.EagerLoadRequest) error

LoadRelations eagerly loads the specified relationships for a slice of Category.

func (CategorySlice) UpdateAll

func (s CategorySlice) UpdateAll(ctx context.Context, exec sqlgen.Executor, set map[string]any) (int64, error)

UpdateAll updates all models in the slice with the given column values.

type Comment

type Comment struct {
	ID              string      `db:"id" json:"id"`
	AuthorID        string      `db:"author_id" json:"author_id"`
	CommentableType string      `db:"commentable_type" json:"commentable_type"`
	CommentableID   string      `db:"commentable_id" json:"commentable_id"`
	Kind            CommentKind `db:"kind" json:"kind"`
	Body            string      `db:"body" json:"body"`
	CreatedAt       time.Time   `db:"created_at" json:"created_at"`

	R *CommentRels `db:"-" json:"-"`
}

Comment represents a row from the 'comments' table.

func FindCommentByPK

func FindCommentByPK(ctx context.Context, exec sqlgen.Executor, id string) (*Comment, error)

FindCommentByPK finds a Comment by primary key.

func InsertComment

func InsertComment(ctx context.Context, exec sqlgen.Executor, mods ...CommentMod) (*Comment, error)

InsertComment creates a Comment with random values, applies mods, and inserts it.

func NewComment

func NewComment(mods ...CommentMod) *Comment

NewComment creates a Comment with random values for all non-auto-increment fields. Pass modifier functions to override specific fields.

func (*Comment) Delete

func (o *Comment) Delete(ctx context.Context, exec sqlgen.Executor) error

Delete deletes the Comment from the database.

func (*Comment) Insert

func (o *Comment) Insert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Insert inserts the Comment into the database. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).

func (*Comment) Reload

func (o *Comment) Reload(ctx context.Context, exec sqlgen.Executor) error

Reload refreshes the Comment from the database using its primary key.

func (*Comment) ScanRow

func (o *Comment) ScanRow(rows interface{ Scan(...any) error }) error

ScanRow scans a database row into a Comment.

func (*Comment) SetUser

func (o *Comment) SetUser(ctx context.Context, exec sqlgen.Executor, related *User) error

SetUser sets the User relationship by updating the FK column.

func (*Comment) Update

func (o *Comment) Update(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Update updates the Comment in the database. Only non-PK columns are updated. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).

func (*Comment) Upsert

func (o *Comment) Upsert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Upsert inserts or updates the Comment based on the primary key. Optional Columns parameter controls which non-PK columns are included (Whitelist/Blacklist).

type CommentAuthorIDFilter

type CommentAuthorIDFilter struct {
	// contains filtered or unexported fields
}

CommentAuthorIDFilter provides where clauses for the author_id column.

func (CommentAuthorIDFilter) EQ

func (CommentAuthorIDFilter) GT

func (CommentAuthorIDFilter) GTE

func (CommentAuthorIDFilter) IN

func (CommentAuthorIDFilter) LT

func (CommentAuthorIDFilter) LTE

func (CommentAuthorIDFilter) NEQ

type CommentBodyFilter

type CommentBodyFilter struct {
	// contains filtered or unexported fields
}

CommentBodyFilter provides where clauses for the body column.

func (CommentBodyFilter) EQ

func (CommentBodyFilter) GT

func (CommentBodyFilter) GTE

func (CommentBodyFilter) IN

func (f CommentBodyFilter) IN(vals ...string) sqlgen.QueryMod

func (CommentBodyFilter) LT

func (CommentBodyFilter) LTE

func (CommentBodyFilter) NEQ

type CommentCommentableIDFilter

type CommentCommentableIDFilter struct {
	// contains filtered or unexported fields
}

CommentCommentableIDFilter provides where clauses for the commentable_id column.

func (CommentCommentableIDFilter) EQ

func (CommentCommentableIDFilter) GT

func (CommentCommentableIDFilter) GTE

func (CommentCommentableIDFilter) IN

func (CommentCommentableIDFilter) LT

func (CommentCommentableIDFilter) LTE

func (CommentCommentableIDFilter) NEQ

type CommentCommentableTypeFilter

type CommentCommentableTypeFilter struct {
	// contains filtered or unexported fields
}

CommentCommentableTypeFilter provides where clauses for the commentable_type column.

func (CommentCommentableTypeFilter) EQ

func (CommentCommentableTypeFilter) GT

func (CommentCommentableTypeFilter) GTE

func (CommentCommentableTypeFilter) IN

func (CommentCommentableTypeFilter) LT

func (CommentCommentableTypeFilter) LTE

func (CommentCommentableTypeFilter) NEQ

type CommentCreatedAtFilter

type CommentCreatedAtFilter struct {
	// contains filtered or unexported fields
}

CommentCreatedAtFilter provides where clauses for the created_at column.

func (CommentCreatedAtFilter) EQ

func (CommentCreatedAtFilter) GT

func (CommentCreatedAtFilter) GTE

func (CommentCreatedAtFilter) IN

func (CommentCreatedAtFilter) LT

func (CommentCreatedAtFilter) LTE

func (CommentCreatedAtFilter) NEQ

type CommentHook

type CommentHook func(ctx context.Context, exec sqlgen.Executor, model *Comment) (context.Context, error)

CommentHook is a typed hook function for Comment lifecycle events.

type CommentIDFilter

type CommentIDFilter struct {
	// contains filtered or unexported fields
}

CommentIDFilter provides where clauses for the id column.

func (CommentIDFilter) EQ

func (CommentIDFilter) GT

func (CommentIDFilter) GTE

func (CommentIDFilter) IN

func (f CommentIDFilter) IN(vals ...string) sqlgen.QueryMod

func (CommentIDFilter) LT

func (CommentIDFilter) LTE

func (CommentIDFilter) NEQ

type CommentKind

type CommentKind string

CommentKind is the 'comment_kind' enum type.

const (
	CommentKindReview CommentKind = "review"
	CommentKindReply  CommentKind = "reply"
	CommentKindNote   CommentKind = "note"
)

func AllCommentKindValues

func AllCommentKindValues() []CommentKind

AllCommentKindValues returns all valid values for this enum.

func (CommentKind) IsValid

func (e CommentKind) IsValid() bool

IsValid checks if the value is a valid enum value.

func (*CommentKind) Scan

func (e *CommentKind) Scan(src any) error

Scan implements sql.Scanner.

func (CommentKind) String

func (e CommentKind) String() string

String returns the string representation.

func (CommentKind) Value

func (e CommentKind) Value() (driver.Value, error)

Value implements driver.Valuer.

type CommentKindFilter

type CommentKindFilter struct {
	// contains filtered or unexported fields
}

CommentKindFilter provides where clauses for the kind column.

func (CommentKindFilter) EQ

func (CommentKindFilter) GT

func (CommentKindFilter) GTE

func (CommentKindFilter) IN

func (CommentKindFilter) LT

func (CommentKindFilter) LTE

func (CommentKindFilter) NEQ

type CommentMod

type CommentMod func(*Comment)

CommentMod is a function that customizes a Comment before use.

type CommentRels

type CommentRels struct {
	User *User
	Post *Post
}

CommentRels holds eagerly loaded relationships.

type CommentSlice

type CommentSlice []*Comment

CommentSlice is a slice of Comment pointers.

func AllComments

func AllComments(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (CommentSlice, error)

AllComments retrieves all rows from the comments table with the given query mods. Supports Preload() for LEFT JOIN eager loading of to-one relationships.

func (CommentSlice) DeleteAll

func (s CommentSlice) DeleteAll(ctx context.Context, exec sqlgen.Executor) (int64, error)

DeleteAll deletes all models in the slice.

func (CommentSlice) InsertAll

func (s CommentSlice) InsertAll(ctx context.Context, exec sqlgen.Executor) error

InsertAll batch-inserts all models in the slice. Each model's columns are scanned back via RETURNING, picking up defaults and generated values. Hooks are not fired (consistent with UpdateAll/DeleteAll).

func (CommentSlice) LoadRelations

func (s CommentSlice) LoadRelations(ctx context.Context, exec sqlgen.Executor, loads ...*sqlgen.EagerLoadRequest) error

LoadRelations eagerly loads the specified relationships for a slice of Comment.

func (CommentSlice) UpdateAll

func (s CommentSlice) UpdateAll(ctx context.Context, exec sqlgen.Executor, set map[string]any) (int64, error)

UpdateAll updates all models in the slice with the given column values.

type Post

type Post struct {
	ID          string                 `db:"id" json:"id"`
	AuthorID    string                 `db:"author_id" json:"author_id"`
	CategoryID  sqlgen.Null[int32]     `db:"category_id" json:"category_id"`
	Title       string                 `db:"title" json:"title"`
	Body        string                 `db:"body" json:"body"`
	Status      PostStatus             `db:"status" json:"status"`
	CreatedAt   time.Time              `db:"created_at" json:"created_at"`
	PublishedAt sqlgen.Null[time.Time] `db:"published_at" json:"published_at"`

	R *PostRels `db:"-" json:"-"`
}

Post represents a row from the 'posts' table.

func FindPostByPK

func FindPostByPK(ctx context.Context, exec sqlgen.Executor, id string) (*Post, error)

FindPostByPK finds a Post by primary key.

func InsertPost

func InsertPost(ctx context.Context, exec sqlgen.Executor, mods ...PostMod) (*Post, error)

InsertPost creates a Post with random values, applies mods, and inserts it.

func NewPost

func NewPost(mods ...PostMod) *Post

NewPost creates a Post with random values for all non-auto-increment fields. Pass modifier functions to override specific fields.

func (*Post) AddTags

func (o *Post) AddTags(ctx context.Context, exec sqlgen.Executor, related ...*Tag) error

AddTags adds to the Tags relationship by inserting join table rows.

func (*Post) Delete

func (o *Post) Delete(ctx context.Context, exec sqlgen.Executor) error

Delete deletes the Post from the database.

func (*Post) Insert

func (o *Post) Insert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Insert inserts the Post into the database. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).

func (*Post) Reload

func (o *Post) Reload(ctx context.Context, exec sqlgen.Executor) error

Reload refreshes the Post from the database using its primary key.

func (*Post) RemoveCategory

func (o *Post) RemoveCategory(ctx context.Context, exec sqlgen.Executor) error

RemoveCategory clears the Category relationship by setting the FK to NULL.

func (*Post) RemoveTags

func (o *Post) RemoveTags(ctx context.Context, exec sqlgen.Executor, related ...*Tag) error

RemoveTags removes from the Tags relationship by deleting join table rows.

func (*Post) ScanRow

func (o *Post) ScanRow(rows interface{ Scan(...any) error }) error

ScanRow scans a database row into a Post.

func (*Post) SetCategory

func (o *Post) SetCategory(ctx context.Context, exec sqlgen.Executor, related *Category) error

SetCategory sets the Category relationship by updating the FK column.

func (*Post) SetTags

func (o *Post) SetTags(ctx context.Context, exec sqlgen.Executor, related ...*Tag) error

SetTags replaces the Tags relationship entirely. Deletes all existing join rows, then inserts new ones.

func (*Post) SetUser

func (o *Post) SetUser(ctx context.Context, exec sqlgen.Executor, related *User) error

SetUser sets the User relationship by updating the FK column.

func (*Post) Update

func (o *Post) Update(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Update updates the Post in the database. Only non-PK columns are updated. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).

func (*Post) Upsert

func (o *Post) Upsert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Upsert inserts or updates the Post based on the primary key. Optional Columns parameter controls which non-PK columns are included (Whitelist/Blacklist).

type PostAuthorIDFilter

type PostAuthorIDFilter struct {
	// contains filtered or unexported fields
}

PostAuthorIDFilter provides where clauses for the author_id column.

func (PostAuthorIDFilter) EQ

func (PostAuthorIDFilter) GT

func (PostAuthorIDFilter) GTE

func (PostAuthorIDFilter) IN

func (f PostAuthorIDFilter) IN(vals ...string) sqlgen.QueryMod

func (PostAuthorIDFilter) LT

func (PostAuthorIDFilter) LTE

func (PostAuthorIDFilter) NEQ

type PostBodyFilter

type PostBodyFilter struct {
	// contains filtered or unexported fields
}

PostBodyFilter provides where clauses for the body column.

func (PostBodyFilter) EQ

func (PostBodyFilter) GT

func (PostBodyFilter) GTE

func (f PostBodyFilter) GTE(val string) sqlgen.QueryMod

func (PostBodyFilter) IN

func (f PostBodyFilter) IN(vals ...string) sqlgen.QueryMod

func (PostBodyFilter) LT

func (PostBodyFilter) LTE

func (f PostBodyFilter) LTE(val string) sqlgen.QueryMod

func (PostBodyFilter) NEQ

func (f PostBodyFilter) NEQ(val string) sqlgen.QueryMod

type PostCategoryIDFilter

type PostCategoryIDFilter struct {
	// contains filtered or unexported fields
}

PostCategoryIDFilter provides where clauses for the category_id column.

func (PostCategoryIDFilter) EQ

func (PostCategoryIDFilter) GT

func (PostCategoryIDFilter) GTE

func (PostCategoryIDFilter) IN

func (PostCategoryIDFilter) IsNotNull

func (f PostCategoryIDFilter) IsNotNull() sqlgen.QueryMod

func (PostCategoryIDFilter) IsNull

func (PostCategoryIDFilter) LT

func (PostCategoryIDFilter) LTE

func (PostCategoryIDFilter) NEQ

type PostCreatedAtFilter

type PostCreatedAtFilter struct {
	// contains filtered or unexported fields
}

PostCreatedAtFilter provides where clauses for the created_at column.

func (PostCreatedAtFilter) EQ

func (PostCreatedAtFilter) GT

func (PostCreatedAtFilter) GTE

func (PostCreatedAtFilter) IN

func (PostCreatedAtFilter) LT

func (PostCreatedAtFilter) LTE

func (PostCreatedAtFilter) NEQ

type PostHook

type PostHook func(ctx context.Context, exec sqlgen.Executor, model *Post) (context.Context, error)

PostHook is a typed hook function for Post lifecycle events.

type PostIDFilter

type PostIDFilter struct {
	// contains filtered or unexported fields
}

PostIDFilter provides where clauses for the id column.

func (PostIDFilter) EQ

func (f PostIDFilter) EQ(val string) sqlgen.QueryMod

func (PostIDFilter) GT

func (f PostIDFilter) GT(val string) sqlgen.QueryMod

func (PostIDFilter) GTE

func (f PostIDFilter) GTE(val string) sqlgen.QueryMod

func (PostIDFilter) IN

func (f PostIDFilter) IN(vals ...string) sqlgen.QueryMod

func (PostIDFilter) LT

func (f PostIDFilter) LT(val string) sqlgen.QueryMod

func (PostIDFilter) LTE

func (f PostIDFilter) LTE(val string) sqlgen.QueryMod

func (PostIDFilter) NEQ

func (f PostIDFilter) NEQ(val string) sqlgen.QueryMod

type PostMod

type PostMod func(*Post)

PostMod is a function that customizes a Post before use.

type PostPublishedAtFilter

type PostPublishedAtFilter struct {
	// contains filtered or unexported fields
}

PostPublishedAtFilter provides where clauses for the published_at column.

func (PostPublishedAtFilter) EQ

func (PostPublishedAtFilter) GT

func (PostPublishedAtFilter) GTE

func (PostPublishedAtFilter) IN

func (PostPublishedAtFilter) IsNotNull

func (f PostPublishedAtFilter) IsNotNull() sqlgen.QueryMod

func (PostPublishedAtFilter) IsNull

func (PostPublishedAtFilter) LT

func (PostPublishedAtFilter) LTE

func (PostPublishedAtFilter) NEQ

type PostRels

type PostRels struct {
	User          *User
	Category      *Category
	Tags          []*Tag
	TagsCount     *int64
	Comments      []*Comment
	CommentsCount *int64
}

PostRels holds eagerly loaded relationships.

type PostSlice

type PostSlice []*Post

PostSlice is a slice of Post pointers.

func AllPosts

func AllPosts(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (PostSlice, error)

AllPosts retrieves all rows from the posts table with the given query mods. Supports Preload() for LEFT JOIN eager loading of to-one relationships.

func (PostSlice) DeleteAll

func (s PostSlice) DeleteAll(ctx context.Context, exec sqlgen.Executor) (int64, error)

DeleteAll deletes all models in the slice.

func (PostSlice) InsertAll

func (s PostSlice) InsertAll(ctx context.Context, exec sqlgen.Executor) error

InsertAll batch-inserts all models in the slice. Each model's columns are scanned back via RETURNING, picking up defaults and generated values. Hooks are not fired (consistent with UpdateAll/DeleteAll).

func (PostSlice) LoadCountRelations

func (s PostSlice) LoadCountRelations(ctx context.Context, exec sqlgen.Executor, names ...string) error

LoadCountRelations loads counts for the specified relationships. Pass relationship names (e.g., "Posts", "Tags") to load their counts.

func (PostSlice) LoadRelations

func (s PostSlice) LoadRelations(ctx context.Context, exec sqlgen.Executor, loads ...*sqlgen.EagerLoadRequest) error

LoadRelations eagerly loads the specified relationships for a slice of Post.

func (PostSlice) UpdateAll

func (s PostSlice) UpdateAll(ctx context.Context, exec sqlgen.Executor, set map[string]any) (int64, error)

UpdateAll updates all models in the slice with the given column values.

type PostStatus

type PostStatus string

PostStatus is the 'post_status' enum type.

const (
	PostStatusDraft     PostStatus = "draft"
	PostStatusPublished PostStatus = "published"
	PostStatusArchived  PostStatus = "archived"
)

func AllPostStatusValues

func AllPostStatusValues() []PostStatus

AllPostStatusValues returns all valid values for this enum.

func (PostStatus) IsValid

func (e PostStatus) IsValid() bool

IsValid checks if the value is a valid enum value.

func (*PostStatus) Scan

func (e *PostStatus) Scan(src any) error

Scan implements sql.Scanner.

func (PostStatus) String

func (e PostStatus) String() string

String returns the string representation.

func (PostStatus) Value

func (e PostStatus) Value() (driver.Value, error)

Value implements driver.Valuer.

type PostStatusFilter

type PostStatusFilter struct {
	// contains filtered or unexported fields
}

PostStatusFilter provides where clauses for the status column.

func (PostStatusFilter) EQ

func (PostStatusFilter) GT

func (PostStatusFilter) GTE

func (PostStatusFilter) IN

func (PostStatusFilter) LT

func (PostStatusFilter) LTE

func (PostStatusFilter) NEQ

type PostTag

type PostTag struct {
	PostID string `db:"post_id" json:"post_id"`
	TagID  int32  `db:"tag_id" json:"tag_id"`

	R *PostTagRels `db:"-" json:"-"`
}

PostTag represents a row from the 'post_tags' table.

func FindPostTagByPK

func FindPostTagByPK(ctx context.Context, exec sqlgen.Executor, postID string, tagID int32) (*PostTag, error)

FindPostTagByPK finds a PostTag by primary key.

func InsertPostTag

func InsertPostTag(ctx context.Context, exec sqlgen.Executor, mods ...PostTagMod) (*PostTag, error)

InsertPostTag creates a PostTag with random values, applies mods, and inserts it.

func NewPostTag

func NewPostTag(mods ...PostTagMod) *PostTag

NewPostTag creates a PostTag with random values for all non-auto-increment fields. Pass modifier functions to override specific fields.

func (*PostTag) Delete

func (o *PostTag) Delete(ctx context.Context, exec sqlgen.Executor) error

Delete deletes the PostTag from the database.

func (*PostTag) Insert

func (o *PostTag) Insert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Insert inserts the PostTag into the database. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).

func (*PostTag) Reload

func (o *PostTag) Reload(ctx context.Context, exec sqlgen.Executor) error

Reload refreshes the PostTag from the database using its primary key.

func (*PostTag) ScanRow

func (o *PostTag) ScanRow(rows interface{ Scan(...any) error }) error

ScanRow scans a database row into a PostTag.

func (*PostTag) Update

func (o *PostTag) Update(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Update updates the PostTag in the database. Only non-PK columns are updated. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).

func (*PostTag) Upsert

func (o *PostTag) Upsert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Upsert inserts or updates the PostTag based on the primary key. Optional Columns parameter controls which non-PK columns are included (Whitelist/Blacklist).

type PostTagHook

type PostTagHook func(ctx context.Context, exec sqlgen.Executor, model *PostTag) (context.Context, error)

PostTagHook is a typed hook function for PostTag lifecycle events.

type PostTagMod

type PostTagMod func(*PostTag)

PostTagMod is a function that customizes a PostTag before use.

type PostTagPostIDFilter

type PostTagPostIDFilter struct {
	// contains filtered or unexported fields
}

PostTagPostIDFilter provides where clauses for the post_id column.

func (PostTagPostIDFilter) EQ

func (PostTagPostIDFilter) GT

func (PostTagPostIDFilter) GTE

func (PostTagPostIDFilter) IN

func (f PostTagPostIDFilter) IN(vals ...string) sqlgen.QueryMod

func (PostTagPostIDFilter) LT

func (PostTagPostIDFilter) LTE

func (PostTagPostIDFilter) NEQ

type PostTagRels

type PostTagRels struct {
}

PostTagRels holds eagerly loaded relationships.

type PostTagSlice

type PostTagSlice []*PostTag

PostTagSlice is a slice of PostTag pointers.

func AllPostTags

func AllPostTags(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (PostTagSlice, error)

AllPostTags retrieves all rows from the post_tags table with the given query mods. Supports Preload() for LEFT JOIN eager loading of to-one relationships.

type PostTagTagIDFilter

type PostTagTagIDFilter struct {
	// contains filtered or unexported fields
}

PostTagTagIDFilter provides where clauses for the tag_id column.

func (PostTagTagIDFilter) EQ

func (PostTagTagIDFilter) GT

func (PostTagTagIDFilter) GTE

func (PostTagTagIDFilter) IN

func (f PostTagTagIDFilter) IN(vals ...int32) sqlgen.QueryMod

func (PostTagTagIDFilter) LT

func (PostTagTagIDFilter) LTE

func (PostTagTagIDFilter) NEQ

type PostTitleFilter

type PostTitleFilter struct {
	// contains filtered or unexported fields
}

PostTitleFilter provides where clauses for the title column.

func (PostTitleFilter) EQ

func (PostTitleFilter) GT

func (PostTitleFilter) GTE

func (PostTitleFilter) IN

func (f PostTitleFilter) IN(vals ...string) sqlgen.QueryMod

func (PostTitleFilter) LT

func (PostTitleFilter) LTE

func (PostTitleFilter) NEQ

type Profile

type Profile struct {
	ID        string              `db:"id" json:"id"`
	UserID    string              `db:"user_id" json:"user_id"`
	AvatarURL sqlgen.Null[string] `db:"avatar_url" json:"avatar_url"`
	Website   sqlgen.Null[string] `db:"website" json:"website"`

	R *ProfileRels `db:"-" json:"-"`
}

Profile represents a row from the 'profiles' table.

func FindProfileByPK

func FindProfileByPK(ctx context.Context, exec sqlgen.Executor, id string) (*Profile, error)

FindProfileByPK finds a Profile by primary key.

func InsertProfile

func InsertProfile(ctx context.Context, exec sqlgen.Executor, mods ...ProfileMod) (*Profile, error)

InsertProfile creates a Profile with random values, applies mods, and inserts it.

func NewProfile

func NewProfile(mods ...ProfileMod) *Profile

NewProfile creates a Profile with random values for all non-auto-increment fields. Pass modifier functions to override specific fields.

func (*Profile) Delete

func (o *Profile) Delete(ctx context.Context, exec sqlgen.Executor) error

Delete deletes the Profile from the database.

func (*Profile) Insert

func (o *Profile) Insert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Insert inserts the Profile into the database. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).

func (*Profile) Reload

func (o *Profile) Reload(ctx context.Context, exec sqlgen.Executor) error

Reload refreshes the Profile from the database using its primary key.

func (*Profile) ScanRow

func (o *Profile) ScanRow(rows interface{ Scan(...any) error }) error

ScanRow scans a database row into a Profile.

func (*Profile) SetUser

func (o *Profile) SetUser(ctx context.Context, exec sqlgen.Executor, related *User) error

SetUser sets the User relationship by updating the FK column.

func (*Profile) Update

func (o *Profile) Update(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Update updates the Profile in the database. Only non-PK columns are updated. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).

func (*Profile) Upsert

func (o *Profile) Upsert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Upsert inserts or updates the Profile based on the primary key. Optional Columns parameter controls which non-PK columns are included (Whitelist/Blacklist).

type ProfileAvatarURLFilter

type ProfileAvatarURLFilter struct {
	// contains filtered or unexported fields
}

ProfileAvatarURLFilter provides where clauses for the avatar_url column.

func (ProfileAvatarURLFilter) EQ

func (ProfileAvatarURLFilter) GT

func (ProfileAvatarURLFilter) GTE

func (ProfileAvatarURLFilter) IN

func (ProfileAvatarURLFilter) IsNotNull

func (f ProfileAvatarURLFilter) IsNotNull() sqlgen.QueryMod

func (ProfileAvatarURLFilter) IsNull

func (ProfileAvatarURLFilter) LT

func (ProfileAvatarURLFilter) LTE

func (ProfileAvatarURLFilter) NEQ

type ProfileHook

type ProfileHook func(ctx context.Context, exec sqlgen.Executor, model *Profile) (context.Context, error)

ProfileHook is a typed hook function for Profile lifecycle events.

type ProfileIDFilter

type ProfileIDFilter struct {
	// contains filtered or unexported fields
}

ProfileIDFilter provides where clauses for the id column.

func (ProfileIDFilter) EQ

func (ProfileIDFilter) GT

func (ProfileIDFilter) GTE

func (ProfileIDFilter) IN

func (f ProfileIDFilter) IN(vals ...string) sqlgen.QueryMod

func (ProfileIDFilter) LT

func (ProfileIDFilter) LTE

func (ProfileIDFilter) NEQ

type ProfileMod

type ProfileMod func(*Profile)

ProfileMod is a function that customizes a Profile before use.

type ProfileRels

type ProfileRels struct {
	User *User
}

ProfileRels holds eagerly loaded relationships.

type ProfileSlice

type ProfileSlice []*Profile

ProfileSlice is a slice of Profile pointers.

func AllProfiles

func AllProfiles(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (ProfileSlice, error)

AllProfiles retrieves all rows from the profiles table with the given query mods. Supports Preload() for LEFT JOIN eager loading of to-one relationships.

func (ProfileSlice) DeleteAll

func (s ProfileSlice) DeleteAll(ctx context.Context, exec sqlgen.Executor) (int64, error)

DeleteAll deletes all models in the slice.

func (ProfileSlice) InsertAll

func (s ProfileSlice) InsertAll(ctx context.Context, exec sqlgen.Executor) error

InsertAll batch-inserts all models in the slice. Each model's columns are scanned back via RETURNING, picking up defaults and generated values. Hooks are not fired (consistent with UpdateAll/DeleteAll).

func (ProfileSlice) LoadRelations

func (s ProfileSlice) LoadRelations(ctx context.Context, exec sqlgen.Executor, loads ...*sqlgen.EagerLoadRequest) error

LoadRelations eagerly loads the specified relationships for a slice of Profile.

func (ProfileSlice) UpdateAll

func (s ProfileSlice) UpdateAll(ctx context.Context, exec sqlgen.Executor, set map[string]any) (int64, error)

UpdateAll updates all models in the slice with the given column values.

type ProfileUserIDFilter

type ProfileUserIDFilter struct {
	// contains filtered or unexported fields
}

ProfileUserIDFilter provides where clauses for the user_id column.

func (ProfileUserIDFilter) EQ

func (ProfileUserIDFilter) GT

func (ProfileUserIDFilter) GTE

func (ProfileUserIDFilter) IN

func (f ProfileUserIDFilter) IN(vals ...string) sqlgen.QueryMod

func (ProfileUserIDFilter) LT

func (ProfileUserIDFilter) LTE

func (ProfileUserIDFilter) NEQ

type ProfileWebsiteFilter

type ProfileWebsiteFilter struct {
	// contains filtered or unexported fields
}

ProfileWebsiteFilter provides where clauses for the website column.

func (ProfileWebsiteFilter) EQ

func (ProfileWebsiteFilter) GT

func (ProfileWebsiteFilter) GTE

func (ProfileWebsiteFilter) IN

func (ProfileWebsiteFilter) IsNotNull

func (f ProfileWebsiteFilter) IsNotNull() sqlgen.QueryMod

func (ProfileWebsiteFilter) IsNull

func (ProfileWebsiteFilter) LT

func (ProfileWebsiteFilter) LTE

func (ProfileWebsiteFilter) NEQ

type Tag

type Tag struct {
	ID   int32  `db:"id" json:"id"`
	Name string `db:"name" json:"name"`

	R *TagRels `db:"-" json:"-"`
}

Tag represents a row from the 'tags' table.

func FindTagByPK

func FindTagByPK(ctx context.Context, exec sqlgen.Executor, id int32) (*Tag, error)

FindTagByPK finds a Tag by primary key.

func InsertTag

func InsertTag(ctx context.Context, exec sqlgen.Executor, mods ...TagMod) (*Tag, error)

InsertTag creates a Tag with random values, applies mods, and inserts it.

func NewTag

func NewTag(mods ...TagMod) *Tag

NewTag creates a Tag with random values for all non-auto-increment fields. Pass modifier functions to override specific fields.

func (*Tag) AddPosts

func (o *Tag) AddPosts(ctx context.Context, exec sqlgen.Executor, related ...*Post) error

AddPosts adds to the Posts relationship by inserting join table rows.

func (*Tag) Delete

func (o *Tag) Delete(ctx context.Context, exec sqlgen.Executor) error

Delete deletes the Tag from the database.

func (*Tag) Insert

func (o *Tag) Insert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Insert inserts the Tag into the database. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).

func (*Tag) Reload

func (o *Tag) Reload(ctx context.Context, exec sqlgen.Executor) error

Reload refreshes the Tag from the database using its primary key.

func (*Tag) RemovePosts

func (o *Tag) RemovePosts(ctx context.Context, exec sqlgen.Executor, related ...*Post) error

RemovePosts removes from the Posts relationship by deleting join table rows.

func (*Tag) ScanRow

func (o *Tag) ScanRow(rows interface{ Scan(...any) error }) error

ScanRow scans a database row into a Tag.

func (*Tag) SetPosts

func (o *Tag) SetPosts(ctx context.Context, exec sqlgen.Executor, related ...*Post) error

SetPosts replaces the Posts relationship entirely. Deletes all existing join rows, then inserts new ones.

func (*Tag) Update

func (o *Tag) Update(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Update updates the Tag in the database. Only non-PK columns are updated. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).

func (*Tag) Upsert

func (o *Tag) Upsert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Upsert inserts or updates the Tag based on the primary key. Optional Columns parameter controls which non-PK columns are included (Whitelist/Blacklist).

type TagHook

type TagHook func(ctx context.Context, exec sqlgen.Executor, model *Tag) (context.Context, error)

TagHook is a typed hook function for Tag lifecycle events.

type TagIDFilter

type TagIDFilter struct {
	// contains filtered or unexported fields
}

TagIDFilter provides where clauses for the id column.

func (TagIDFilter) EQ

func (f TagIDFilter) EQ(val int32) sqlgen.QueryMod

func (TagIDFilter) GT

func (f TagIDFilter) GT(val int32) sqlgen.QueryMod

func (TagIDFilter) GTE

func (f TagIDFilter) GTE(val int32) sqlgen.QueryMod

func (TagIDFilter) IN

func (f TagIDFilter) IN(vals ...int32) sqlgen.QueryMod

func (TagIDFilter) LT

func (f TagIDFilter) LT(val int32) sqlgen.QueryMod

func (TagIDFilter) LTE

func (f TagIDFilter) LTE(val int32) sqlgen.QueryMod

func (TagIDFilter) NEQ

func (f TagIDFilter) NEQ(val int32) sqlgen.QueryMod

type TagMod

type TagMod func(*Tag)

TagMod is a function that customizes a Tag before use.

type TagNameFilter

type TagNameFilter struct {
	// contains filtered or unexported fields
}

TagNameFilter provides where clauses for the name column.

func (TagNameFilter) EQ

func (f TagNameFilter) EQ(val string) sqlgen.QueryMod

func (TagNameFilter) GT

func (f TagNameFilter) GT(val string) sqlgen.QueryMod

func (TagNameFilter) GTE

func (f TagNameFilter) GTE(val string) sqlgen.QueryMod

func (TagNameFilter) IN

func (f TagNameFilter) IN(vals ...string) sqlgen.QueryMod

func (TagNameFilter) LT

func (f TagNameFilter) LT(val string) sqlgen.QueryMod

func (TagNameFilter) LTE

func (f TagNameFilter) LTE(val string) sqlgen.QueryMod

func (TagNameFilter) NEQ

func (f TagNameFilter) NEQ(val string) sqlgen.QueryMod

type TagRels

type TagRels struct {
	Posts      []*Post
	PostsCount *int64
}

TagRels holds eagerly loaded relationships.

type TagSlice

type TagSlice []*Tag

TagSlice is a slice of Tag pointers.

func AllTags

func AllTags(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (TagSlice, error)

AllTags retrieves all rows from the tags table with the given query mods. Supports Preload() for LEFT JOIN eager loading of to-one relationships.

func (TagSlice) DeleteAll

func (s TagSlice) DeleteAll(ctx context.Context, exec sqlgen.Executor) (int64, error)

DeleteAll deletes all models in the slice.

func (TagSlice) InsertAll

func (s TagSlice) InsertAll(ctx context.Context, exec sqlgen.Executor) error

InsertAll batch-inserts all models in the slice. Each model's columns are scanned back via RETURNING, picking up defaults and generated values. Hooks are not fired (consistent with UpdateAll/DeleteAll).

func (TagSlice) LoadCountRelations

func (s TagSlice) LoadCountRelations(ctx context.Context, exec sqlgen.Executor, names ...string) error

LoadCountRelations loads counts for the specified relationships. Pass relationship names (e.g., "Posts", "Tags") to load their counts.

func (TagSlice) LoadRelations

func (s TagSlice) LoadRelations(ctx context.Context, exec sqlgen.Executor, loads ...*sqlgen.EagerLoadRequest) error

LoadRelations eagerly loads the specified relationships for a slice of Tag.

func (TagSlice) UpdateAll

func (s TagSlice) UpdateAll(ctx context.Context, exec sqlgen.Executor, set map[string]any) (int64, error)

UpdateAll updates all models in the slice with the given column values.

type User

type User struct {
	ID        string                       `db:"id" json:"id"`
	Email     string                       `db:"email" json:"email"`
	Name      string                       `db:"name" json:"name"`
	Bio       sqlgen.Null[string]          `db:"bio" json:"bio"`
	Age       sqlgen.Null[int32]           `db:"age" json:"age"`
	Score     sqlgen.Null[string]          `db:"score" json:"score"`
	IsAdmin   bool                         `db:"is_admin" json:"is_admin"`
	Metadata  sqlgen.Null[json.RawMessage] `db:"metadata" json:"metadata"`
	CreatedAt time.Time                    `db:"created_at" json:"created_at"`

	R *UserRels `db:"-" json:"-"`
}

User represents a row from the 'users' table.

func FindUserByPK

func FindUserByPK(ctx context.Context, exec sqlgen.Executor, id string) (*User, error)

FindUserByPK finds a User by primary key.

func InsertUser

func InsertUser(ctx context.Context, exec sqlgen.Executor, mods ...UserMod) (*User, error)

InsertUser creates a User with random values, applies mods, and inserts it.

func NewUser

func NewUser(mods ...UserMod) *User

NewUser creates a User with random values for all non-auto-increment fields. Pass modifier functions to override specific fields.

func (*User) AddComments

func (o *User) AddComments(ctx context.Context, exec sqlgen.Executor, related ...*Comment) error

AddComments adds models to the Comments relationship by setting their FK.

func (*User) AddPosts

func (o *User) AddPosts(ctx context.Context, exec sqlgen.Executor, related ...*Post) error

AddPosts adds models to the Posts relationship by setting their FK.

func (*User) Delete

func (o *User) Delete(ctx context.Context, exec sqlgen.Executor) error

Delete deletes the User from the database.

func (*User) Insert

func (o *User) Insert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Insert inserts the User into the database. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).

func (*User) Reload

func (o *User) Reload(ctx context.Context, exec sqlgen.Executor) error

Reload refreshes the User from the database using its primary key.

func (*User) ScanRow

func (o *User) ScanRow(rows interface{ Scan(...any) error }) error

ScanRow scans a database row into a User.

func (*User) SetProfile

func (o *User) SetProfile(ctx context.Context, exec sqlgen.Executor, related *Profile) error

SetProfile sets the Profile relationship by updating the related model's FK.

func (*User) Update

func (o *User) Update(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Update updates the User in the database. Only non-PK columns are updated. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).

func (*User) Upsert

func (o *User) Upsert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error

Upsert inserts or updates the User based on the primary key. Optional Columns parameter controls which non-PK columns are included (Whitelist/Blacklist).

type UserAgeFilter

type UserAgeFilter struct {
	// contains filtered or unexported fields
}

UserAgeFilter provides where clauses for the age column.

func (UserAgeFilter) EQ

func (UserAgeFilter) GT

func (UserAgeFilter) GTE

func (UserAgeFilter) IN

func (f UserAgeFilter) IN(vals ...sqlgen.Null[int32]) sqlgen.QueryMod

func (UserAgeFilter) IsNotNull

func (f UserAgeFilter) IsNotNull() sqlgen.QueryMod

func (UserAgeFilter) IsNull

func (f UserAgeFilter) IsNull() sqlgen.QueryMod

func (UserAgeFilter) LT

func (UserAgeFilter) LTE

func (UserAgeFilter) NEQ

type UserBioFilter

type UserBioFilter struct {
	// contains filtered or unexported fields
}

UserBioFilter provides where clauses for the bio column.

func (UserBioFilter) EQ

func (UserBioFilter) GT

func (UserBioFilter) GTE

func (UserBioFilter) IN

func (f UserBioFilter) IN(vals ...sqlgen.Null[string]) sqlgen.QueryMod

func (UserBioFilter) IsNotNull

func (f UserBioFilter) IsNotNull() sqlgen.QueryMod

func (UserBioFilter) IsNull

func (f UserBioFilter) IsNull() sqlgen.QueryMod

func (UserBioFilter) LT

func (UserBioFilter) LTE

func (UserBioFilter) NEQ

type UserCreatedAtFilter

type UserCreatedAtFilter struct {
	// contains filtered or unexported fields
}

UserCreatedAtFilter provides where clauses for the created_at column.

func (UserCreatedAtFilter) EQ

func (UserCreatedAtFilter) GT

func (UserCreatedAtFilter) GTE

func (UserCreatedAtFilter) IN

func (UserCreatedAtFilter) LT

func (UserCreatedAtFilter) LTE

func (UserCreatedAtFilter) NEQ

type UserEmailFilter

type UserEmailFilter struct {
	// contains filtered or unexported fields
}

UserEmailFilter provides where clauses for the email column.

func (UserEmailFilter) EQ

func (UserEmailFilter) GT

func (UserEmailFilter) GTE

func (UserEmailFilter) IN

func (f UserEmailFilter) IN(vals ...string) sqlgen.QueryMod

func (UserEmailFilter) LT

func (UserEmailFilter) LTE

func (UserEmailFilter) NEQ

type UserHook

type UserHook func(ctx context.Context, exec sqlgen.Executor, model *User) (context.Context, error)

UserHook is a typed hook function for User lifecycle events.

type UserIDFilter

type UserIDFilter struct {
	// contains filtered or unexported fields
}

UserIDFilter provides where clauses for the id column.

func (UserIDFilter) EQ

func (f UserIDFilter) EQ(val string) sqlgen.QueryMod

func (UserIDFilter) GT

func (f UserIDFilter) GT(val string) sqlgen.QueryMod

func (UserIDFilter) GTE

func (f UserIDFilter) GTE(val string) sqlgen.QueryMod

func (UserIDFilter) IN

func (f UserIDFilter) IN(vals ...string) sqlgen.QueryMod

func (UserIDFilter) LT

func (f UserIDFilter) LT(val string) sqlgen.QueryMod

func (UserIDFilter) LTE

func (f UserIDFilter) LTE(val string) sqlgen.QueryMod

func (UserIDFilter) NEQ

func (f UserIDFilter) NEQ(val string) sqlgen.QueryMod

type UserIsAdminFilter

type UserIsAdminFilter struct {
	// contains filtered or unexported fields
}

UserIsAdminFilter provides where clauses for the is_admin column.

func (UserIsAdminFilter) EQ

func (UserIsAdminFilter) GT

func (UserIsAdminFilter) GTE

func (UserIsAdminFilter) IN

func (f UserIsAdminFilter) IN(vals ...bool) sqlgen.QueryMod

func (UserIsAdminFilter) LT

func (UserIsAdminFilter) LTE

func (UserIsAdminFilter) NEQ

type UserMetadataFilter

type UserMetadataFilter struct {
	// contains filtered or unexported fields
}

UserMetadataFilter provides where clauses for the metadata column.

func (UserMetadataFilter) EQ

func (UserMetadataFilter) GT

func (UserMetadataFilter) GTE

func (UserMetadataFilter) IN

func (UserMetadataFilter) IsNotNull

func (f UserMetadataFilter) IsNotNull() sqlgen.QueryMod

func (UserMetadataFilter) IsNull

func (f UserMetadataFilter) IsNull() sqlgen.QueryMod

func (UserMetadataFilter) LT

func (UserMetadataFilter) LTE

func (UserMetadataFilter) NEQ

type UserMod

type UserMod func(*User)

UserMod is a function that customizes a User before use.

type UserNameFilter

type UserNameFilter struct {
	// contains filtered or unexported fields
}

UserNameFilter provides where clauses for the name column.

func (UserNameFilter) EQ

func (UserNameFilter) GT

func (UserNameFilter) GTE

func (f UserNameFilter) GTE(val string) sqlgen.QueryMod

func (UserNameFilter) IN

func (f UserNameFilter) IN(vals ...string) sqlgen.QueryMod

func (UserNameFilter) LT

func (UserNameFilter) LTE

func (f UserNameFilter) LTE(val string) sqlgen.QueryMod

func (UserNameFilter) NEQ

func (f UserNameFilter) NEQ(val string) sqlgen.QueryMod

type UserRels

type UserRels struct {
	Profile       *Profile
	Posts         []*Post
	PostsCount    *int64
	Comments      []*Comment
	CommentsCount *int64
}

UserRels holds eagerly loaded relationships.

type UserScoreFilter

type UserScoreFilter struct {
	// contains filtered or unexported fields
}

UserScoreFilter provides where clauses for the score column.

func (UserScoreFilter) EQ

func (UserScoreFilter) GT

func (UserScoreFilter) GTE

func (UserScoreFilter) IN

func (UserScoreFilter) IsNotNull

func (f UserScoreFilter) IsNotNull() sqlgen.QueryMod

func (UserScoreFilter) IsNull

func (f UserScoreFilter) IsNull() sqlgen.QueryMod

func (UserScoreFilter) LT

func (UserScoreFilter) LTE

func (UserScoreFilter) NEQ

type UserSlice

type UserSlice []*User

UserSlice is a slice of User pointers.

func AllUsers

func AllUsers(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (UserSlice, error)

AllUsers retrieves all rows from the users table with the given query mods. Supports Preload() for LEFT JOIN eager loading of to-one relationships.

func (UserSlice) DeleteAll

func (s UserSlice) DeleteAll(ctx context.Context, exec sqlgen.Executor) (int64, error)

DeleteAll deletes all models in the slice.

func (UserSlice) InsertAll

func (s UserSlice) InsertAll(ctx context.Context, exec sqlgen.Executor) error

InsertAll batch-inserts all models in the slice. Each model's columns are scanned back via RETURNING, picking up defaults and generated values. Hooks are not fired (consistent with UpdateAll/DeleteAll).

func (UserSlice) LoadCountRelations

func (s UserSlice) LoadCountRelations(ctx context.Context, exec sqlgen.Executor, names ...string) error

LoadCountRelations loads counts for the specified relationships. Pass relationship names (e.g., "Posts", "Tags") to load their counts.

func (UserSlice) LoadRelations

func (s UserSlice) LoadRelations(ctx context.Context, exec sqlgen.Executor, loads ...*sqlgen.EagerLoadRequest) error

LoadRelations eagerly loads the specified relationships for a slice of User.

func (UserSlice) UpdateAll

func (s UserSlice) UpdateAll(ctx context.Context, exec sqlgen.Executor, set map[string]any) (int64, error)

UpdateAll updates all models in the slice with the given column values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL