Documentation
¶
Index ¶
- Constants
- Variables
- func AddPostHook(point sqlgen.HookPoint, fn PostHook)
- func AddPostTagHook(point sqlgen.HookPoint, fn PostTagHook)
- func AddTagHook(point sqlgen.HookPoint, fn TagHook)
- func AddUserHook(point sqlgen.HookPoint, fn UserHook)
- func CountPostTags(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)
- func CountPosts(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)
- func CountTags(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)
- func CountUsers(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)
- func DeleteAllPostTags(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)
- func DeleteAllPosts(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)
- func DeleteAllTags(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)
- func DeleteAllUsers(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (int64, error)
- func EachPost(ctx context.Context, exec sqlgen.Executor, fn func(*Post) error, ...) error
- func EachPostTag(ctx context.Context, exec sqlgen.Executor, fn func(*PostTag) error, ...) error
- func EachTag(ctx context.Context, exec sqlgen.Executor, fn func(*Tag) error, ...) error
- func EachUser(ctx context.Context, exec sqlgen.Executor, fn func(*User) error, ...) error
- func PostCursor(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (*sqlgen.Cursor[*Post], error)
- func PostExists(ctx context.Context, exec sqlgen.Executor, id string) (bool, error)
- func PostTagCursor(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (*sqlgen.Cursor[*PostTag], error)
- func PostTagExists(ctx context.Context, exec sqlgen.Executor, postID string, tagID int32) (bool, error)
- func PostTags(mods ...sqlgen.QueryMod) *sqlgen.Query
- func Posts(mods ...sqlgen.QueryMod) *sqlgen.Query
- func TagCursor(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (*sqlgen.Cursor[*Tag], error)
- func TagExists(ctx context.Context, exec sqlgen.Executor, id int32) (bool, error)
- func Tags(mods ...sqlgen.QueryMod) *sqlgen.Query
- func UpdateAllPostTags(ctx context.Context, exec sqlgen.Executor, set map[string]any, ...) (int64, error)
- func UpdateAllPosts(ctx context.Context, exec sqlgen.Executor, set map[string]any, ...) (int64, error)
- func UpdateAllTags(ctx context.Context, exec sqlgen.Executor, set map[string]any, ...) (int64, error)
- func UpdateAllUsers(ctx context.Context, exec sqlgen.Executor, set map[string]any, ...) (int64, error)
- func UserCursor(ctx context.Context, exec sqlgen.Executor, mods ...sqlgen.QueryMod) (*sqlgen.Cursor[*User], error)
- func UserExists(ctx context.Context, exec sqlgen.Executor, id string) (bool, error)
- func Users(mods ...sqlgen.QueryMod) *sqlgen.Query
- type Post
- func (o *Post) AddTags(ctx context.Context, exec sqlgen.Executor, related ...*Tag) error
- func (o *Post) Delete(ctx context.Context, exec sqlgen.Executor) error
- func (o *Post) Insert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error
- func (o *Post) Reload(ctx context.Context, exec sqlgen.Executor) error
- func (o *Post) RemoveTags(ctx context.Context, exec sqlgen.Executor, related ...*Tag) error
- func (o *Post) ScanRow(rows interface{ ... }) error
- func (o *Post) SetTags(ctx context.Context, exec sqlgen.Executor, related ...*Tag) error
- func (o *Post) SetUser(ctx context.Context, exec sqlgen.Executor, related *User) error
- func (o *Post) Update(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error
- func (o *Post) Upsert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error
- type PostAuthorIDFilter
- func (f PostAuthorIDFilter) EQ(val string) sqlgen.QueryMod
- func (f PostAuthorIDFilter) GT(val string) sqlgen.QueryMod
- func (f PostAuthorIDFilter) GTE(val string) sqlgen.QueryMod
- func (f PostAuthorIDFilter) IN(vals ...string) sqlgen.QueryMod
- func (f PostAuthorIDFilter) LT(val string) sqlgen.QueryMod
- func (f PostAuthorIDFilter) LTE(val string) sqlgen.QueryMod
- func (f PostAuthorIDFilter) NEQ(val string) sqlgen.QueryMod
- type PostBodyFilter
- func (f PostBodyFilter) EQ(val string) sqlgen.QueryMod
- func (f PostBodyFilter) GT(val string) sqlgen.QueryMod
- func (f PostBodyFilter) GTE(val string) sqlgen.QueryMod
- func (f PostBodyFilter) IN(vals ...string) sqlgen.QueryMod
- func (f PostBodyFilter) LT(val string) sqlgen.QueryMod
- func (f PostBodyFilter) LTE(val string) sqlgen.QueryMod
- func (f PostBodyFilter) NEQ(val string) sqlgen.QueryMod
- type PostCreatedAtFilter
- func (f PostCreatedAtFilter) EQ(val time.Time) sqlgen.QueryMod
- func (f PostCreatedAtFilter) GT(val time.Time) sqlgen.QueryMod
- func (f PostCreatedAtFilter) GTE(val time.Time) sqlgen.QueryMod
- func (f PostCreatedAtFilter) IN(vals ...time.Time) sqlgen.QueryMod
- func (f PostCreatedAtFilter) LT(val time.Time) sqlgen.QueryMod
- func (f PostCreatedAtFilter) LTE(val time.Time) sqlgen.QueryMod
- func (f PostCreatedAtFilter) NEQ(val time.Time) sqlgen.QueryMod
- type PostHook
- type PostIDFilter
- func (f PostIDFilter) EQ(val string) sqlgen.QueryMod
- func (f PostIDFilter) GT(val string) sqlgen.QueryMod
- func (f PostIDFilter) GTE(val string) sqlgen.QueryMod
- func (f PostIDFilter) IN(vals ...string) sqlgen.QueryMod
- func (f PostIDFilter) LT(val string) sqlgen.QueryMod
- func (f PostIDFilter) LTE(val string) sqlgen.QueryMod
- func (f PostIDFilter) NEQ(val string) sqlgen.QueryMod
- type PostPublishedAtFilter
- func (f PostPublishedAtFilter) EQ(val sqlgen.Null[time.Time]) sqlgen.QueryMod
- func (f PostPublishedAtFilter) GT(val sqlgen.Null[time.Time]) sqlgen.QueryMod
- func (f PostPublishedAtFilter) GTE(val sqlgen.Null[time.Time]) sqlgen.QueryMod
- func (f PostPublishedAtFilter) IN(vals ...sqlgen.Null[time.Time]) sqlgen.QueryMod
- func (f PostPublishedAtFilter) IsNotNull() sqlgen.QueryMod
- func (f PostPublishedAtFilter) IsNull() sqlgen.QueryMod
- func (f PostPublishedAtFilter) LT(val sqlgen.Null[time.Time]) sqlgen.QueryMod
- func (f PostPublishedAtFilter) LTE(val sqlgen.Null[time.Time]) sqlgen.QueryMod
- func (f PostPublishedAtFilter) NEQ(val sqlgen.Null[time.Time]) sqlgen.QueryMod
- type PostRels
- type PostSlice
- func (s PostSlice) DeleteAll(ctx context.Context, exec sqlgen.Executor) (int64, error)
- func (s PostSlice) InsertAll(ctx context.Context, exec sqlgen.Executor) error
- func (s PostSlice) LoadCountRelations(ctx context.Context, exec sqlgen.Executor, names ...string) error
- func (s PostSlice) LoadRelations(ctx context.Context, exec sqlgen.Executor, loads ...*sqlgen.EagerLoadRequest) error
- func (s PostSlice) UpdateAll(ctx context.Context, exec sqlgen.Executor, set map[string]any) (int64, error)
- type PostStatus
- type PostStatusFilter
- func (f PostStatusFilter) EQ(val PostStatus) sqlgen.QueryMod
- func (f PostStatusFilter) GT(val PostStatus) sqlgen.QueryMod
- func (f PostStatusFilter) GTE(val PostStatus) sqlgen.QueryMod
- func (f PostStatusFilter) IN(vals ...PostStatus) sqlgen.QueryMod
- func (f PostStatusFilter) LT(val PostStatus) sqlgen.QueryMod
- func (f PostStatusFilter) LTE(val PostStatus) sqlgen.QueryMod
- func (f PostStatusFilter) NEQ(val PostStatus) sqlgen.QueryMod
- type PostTag
- func (o *PostTag) Delete(ctx context.Context, exec sqlgen.Executor) error
- func (o *PostTag) Insert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error
- func (o *PostTag) Reload(ctx context.Context, exec sqlgen.Executor) error
- func (o *PostTag) ScanRow(rows interface{ ... }) error
- func (o *PostTag) Update(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error
- func (o *PostTag) Upsert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error
- type PostTagHook
- type PostTagPostIDFilter
- func (f PostTagPostIDFilter) EQ(val string) sqlgen.QueryMod
- func (f PostTagPostIDFilter) GT(val string) sqlgen.QueryMod
- func (f PostTagPostIDFilter) GTE(val string) sqlgen.QueryMod
- func (f PostTagPostIDFilter) IN(vals ...string) sqlgen.QueryMod
- func (f PostTagPostIDFilter) LT(val string) sqlgen.QueryMod
- func (f PostTagPostIDFilter) LTE(val string) sqlgen.QueryMod
- func (f PostTagPostIDFilter) NEQ(val string) sqlgen.QueryMod
- type PostTagRels
- type PostTagSlice
- type PostTagTagIDFilter
- func (f PostTagTagIDFilter) EQ(val int32) sqlgen.QueryMod
- func (f PostTagTagIDFilter) GT(val int32) sqlgen.QueryMod
- func (f PostTagTagIDFilter) GTE(val int32) sqlgen.QueryMod
- func (f PostTagTagIDFilter) IN(vals ...int32) sqlgen.QueryMod
- func (f PostTagTagIDFilter) LT(val int32) sqlgen.QueryMod
- func (f PostTagTagIDFilter) LTE(val int32) sqlgen.QueryMod
- func (f PostTagTagIDFilter) NEQ(val int32) sqlgen.QueryMod
- type PostTitleFilter
- func (f PostTitleFilter) EQ(val string) sqlgen.QueryMod
- func (f PostTitleFilter) GT(val string) sqlgen.QueryMod
- func (f PostTitleFilter) GTE(val string) sqlgen.QueryMod
- func (f PostTitleFilter) IN(vals ...string) sqlgen.QueryMod
- func (f PostTitleFilter) LT(val string) sqlgen.QueryMod
- func (f PostTitleFilter) LTE(val string) sqlgen.QueryMod
- func (f PostTitleFilter) NEQ(val string) sqlgen.QueryMod
- type Tag
- func (o *Tag) AddPosts(ctx context.Context, exec sqlgen.Executor, related ...*Post) error
- func (o *Tag) Delete(ctx context.Context, exec sqlgen.Executor) error
- func (o *Tag) Insert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error
- func (o *Tag) Reload(ctx context.Context, exec sqlgen.Executor) error
- func (o *Tag) RemovePosts(ctx context.Context, exec sqlgen.Executor, related ...*Post) error
- func (o *Tag) ScanRow(rows interface{ ... }) error
- func (o *Tag) SetPosts(ctx context.Context, exec sqlgen.Executor, related ...*Post) error
- func (o *Tag) Update(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error
- func (o *Tag) Upsert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error
- type TagHook
- type TagIDFilter
- func (f TagIDFilter) EQ(val int32) sqlgen.QueryMod
- func (f TagIDFilter) GT(val int32) sqlgen.QueryMod
- func (f TagIDFilter) GTE(val int32) sqlgen.QueryMod
- func (f TagIDFilter) IN(vals ...int32) sqlgen.QueryMod
- func (f TagIDFilter) LT(val int32) sqlgen.QueryMod
- func (f TagIDFilter) LTE(val int32) sqlgen.QueryMod
- func (f TagIDFilter) NEQ(val int32) sqlgen.QueryMod
- type TagNameFilter
- func (f TagNameFilter) EQ(val string) sqlgen.QueryMod
- func (f TagNameFilter) GT(val string) sqlgen.QueryMod
- func (f TagNameFilter) GTE(val string) sqlgen.QueryMod
- func (f TagNameFilter) IN(vals ...string) sqlgen.QueryMod
- func (f TagNameFilter) LT(val string) sqlgen.QueryMod
- func (f TagNameFilter) LTE(val string) sqlgen.QueryMod
- func (f TagNameFilter) NEQ(val string) sqlgen.QueryMod
- type TagRels
- type TagSlice
- func (s TagSlice) DeleteAll(ctx context.Context, exec sqlgen.Executor) (int64, error)
- func (s TagSlice) InsertAll(ctx context.Context, exec sqlgen.Executor) error
- func (s TagSlice) LoadCountRelations(ctx context.Context, exec sqlgen.Executor, names ...string) error
- func (s TagSlice) LoadRelations(ctx context.Context, exec sqlgen.Executor, loads ...*sqlgen.EagerLoadRequest) error
- func (s TagSlice) UpdateAll(ctx context.Context, exec sqlgen.Executor, set map[string]any) (int64, error)
- type User
- func (o *User) AddPosts(ctx context.Context, exec sqlgen.Executor, related ...*Post) error
- func (o *User) Delete(ctx context.Context, exec sqlgen.Executor) error
- func (o *User) Insert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error
- func (o *User) Reload(ctx context.Context, exec sqlgen.Executor) error
- func (o *User) ScanRow(rows interface{ ... }) error
- func (o *User) Update(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error
- func (o *User) Upsert(ctx context.Context, exec sqlgen.Executor, cols ...sqlgen.Columns) error
- type UserBioFilter
- func (f UserBioFilter) EQ(val sqlgen.Null[string]) sqlgen.QueryMod
- func (f UserBioFilter) GT(val sqlgen.Null[string]) sqlgen.QueryMod
- func (f UserBioFilter) GTE(val sqlgen.Null[string]) sqlgen.QueryMod
- func (f UserBioFilter) IN(vals ...sqlgen.Null[string]) sqlgen.QueryMod
- func (f UserBioFilter) IsNotNull() sqlgen.QueryMod
- func (f UserBioFilter) IsNull() sqlgen.QueryMod
- func (f UserBioFilter) LT(val sqlgen.Null[string]) sqlgen.QueryMod
- func (f UserBioFilter) LTE(val sqlgen.Null[string]) sqlgen.QueryMod
- func (f UserBioFilter) NEQ(val sqlgen.Null[string]) sqlgen.QueryMod
- type UserCreatedAtFilter
- func (f UserCreatedAtFilter) EQ(val time.Time) sqlgen.QueryMod
- func (f UserCreatedAtFilter) GT(val time.Time) sqlgen.QueryMod
- func (f UserCreatedAtFilter) GTE(val time.Time) sqlgen.QueryMod
- func (f UserCreatedAtFilter) IN(vals ...time.Time) sqlgen.QueryMod
- func (f UserCreatedAtFilter) LT(val time.Time) sqlgen.QueryMod
- func (f UserCreatedAtFilter) LTE(val time.Time) sqlgen.QueryMod
- func (f UserCreatedAtFilter) NEQ(val time.Time) sqlgen.QueryMod
- type UserEmailFilter
- func (f UserEmailFilter) EQ(val string) sqlgen.QueryMod
- func (f UserEmailFilter) GT(val string) sqlgen.QueryMod
- func (f UserEmailFilter) GTE(val string) sqlgen.QueryMod
- func (f UserEmailFilter) IN(vals ...string) sqlgen.QueryMod
- func (f UserEmailFilter) LT(val string) sqlgen.QueryMod
- func (f UserEmailFilter) LTE(val string) sqlgen.QueryMod
- func (f UserEmailFilter) NEQ(val string) sqlgen.QueryMod
- type UserHook
- type UserIDFilter
- func (f UserIDFilter) EQ(val string) sqlgen.QueryMod
- func (f UserIDFilter) GT(val string) sqlgen.QueryMod
- func (f UserIDFilter) GTE(val string) sqlgen.QueryMod
- func (f UserIDFilter) IN(vals ...string) sqlgen.QueryMod
- func (f UserIDFilter) LT(val string) sqlgen.QueryMod
- func (f UserIDFilter) LTE(val string) sqlgen.QueryMod
- func (f UserIDFilter) NEQ(val string) sqlgen.QueryMod
- type UserNameFilter
- func (f UserNameFilter) EQ(val string) sqlgen.QueryMod
- func (f UserNameFilter) GT(val string) sqlgen.QueryMod
- func (f UserNameFilter) GTE(val string) sqlgen.QueryMod
- func (f UserNameFilter) IN(vals ...string) sqlgen.QueryMod
- func (f UserNameFilter) LT(val string) sqlgen.QueryMod
- func (f UserNameFilter) LTE(val string) sqlgen.QueryMod
- func (f UserNameFilter) NEQ(val string) sqlgen.QueryMod
- type UserRels
- type UserSlice
- func (s UserSlice) DeleteAll(ctx context.Context, exec sqlgen.Executor) (int64, error)
- func (s UserSlice) InsertAll(ctx context.Context, exec sqlgen.Executor) error
- func (s UserSlice) LoadCountRelations(ctx context.Context, exec sqlgen.Executor, names ...string) error
- func (s UserSlice) LoadRelations(ctx context.Context, exec sqlgen.Executor, loads ...*sqlgen.EagerLoadRequest) error
- func (s UserSlice) UpdateAll(ctx context.Context, exec sqlgen.Executor, set map[string]any) (int64, error)
Constants ¶
const PostTableName = "posts"
PostTableName is the database table name.
const PostTagTableName = "post_tags"
PostTagTableName is the database table name.
const TagTableName = "tags"
TagTableName is the database table name.
const UserTableName = "users"
UserTableName is the database table name.
Variables ¶
var PostColumns = struct { ID string AuthorID string Title string Body string Status string CreatedAt string PublishedAt string }{ ID: "id", AuthorID: "author_id", Title: "title", Body: "body", Status: "status", CreatedAt: "created_at", PublishedAt: "published_at", }
PostColumns contains all column names for the posts table.
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\".\"created_at\"", }, }
PostPreloadUser is the PreloadDef for the User relationship.
var PostTagColumns = struct { PostID string TagID string }{ PostID: "post_id", TagID: "tag_id", }
PostTagColumns contains all column names for the post_tags table.
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.
var PostWhere = struct { ID PostIDFilter AuthorID PostAuthorIDFilter Title PostTitleFilter Body PostBodyFilter Status PostStatusFilter CreatedAt PostCreatedAtFilter PublishedAt PostPublishedAtFilter }{ ID: PostIDFilter{/* contains filtered or unexported fields */}, AuthorID: PostAuthorIDFilter{/* 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.
var TagColumns = struct { ID string Name string }{ ID: "id", Name: "name", }
TagColumns contains all column names for the tags table.
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.
var UserColumns = struct { ID string Email string Name string Bio string CreatedAt string }{ ID: "id", Email: "email", Name: "name", Bio: "bio", CreatedAt: "created_at", }
UserColumns contains all column names for the users table.
var UserWhere = struct { ID UserIDFilter Email UserEmailFilter Name UserNameFilter Bio UserBioFilter 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 */}, CreatedAt: UserCreatedAtFilter{/* contains filtered or unexported fields */}, }
UserWhere provides type-safe where clause builders for each column.
Functions ¶
func AddPostHook ¶
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 AddTagHook ¶
AddTagHook registers a typed hook for the given hook point. The hook receives the model pointer and can inspect or modify it.
func AddUserHook ¶
AddUserHook registers a typed hook for the given hook point. The hook receives the model pointer and can inspect or modify it.
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 ¶
CountPosts returns the count of rows matching the query mods.
func CountUsers ¶
CountUsers returns the count of rows matching the query 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 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 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 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 ¶
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 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 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 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 ¶
Exists checks if a row with the given primary key exists.
Types ¶
type Post ¶
type Post struct {
ID string `db:"id" json:"id"`
AuthorID string `db:"author_id" json:"author_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 ¶
FindPostByPK finds a Post by primary key.
func (*Post) Insert ¶
Insert inserts the Post into the database. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).
func (*Post) RemoveTags ¶
RemoveTags removes from the Tags relationship by deleting join table rows.
func (*Post) SetTags ¶
SetTags replaces the Tags relationship entirely. Deletes all existing join rows, then inserts new ones.
type PostAuthorIDFilter ¶
type PostAuthorIDFilter struct {
// contains filtered or unexported fields
}
PostAuthorIDFilter provides where clauses for the author_id column.
type PostBodyFilter ¶
type PostBodyFilter struct {
// contains filtered or unexported fields
}
PostBodyFilter provides where clauses for the body column.
type PostCreatedAtFilter ¶
type PostCreatedAtFilter struct {
// contains filtered or unexported fields
}
PostCreatedAtFilter provides where clauses for the created_at column.
type PostIDFilter ¶
type PostIDFilter struct {
// contains filtered or unexported fields
}
PostIDFilter provides where clauses for the id column.
type PostPublishedAtFilter ¶
type PostPublishedAtFilter struct {
// contains filtered or unexported fields
}
PostPublishedAtFilter provides where clauses for the published_at column.
func (PostPublishedAtFilter) IsNotNull ¶
func (f PostPublishedAtFilter) IsNotNull() sqlgen.QueryMod
func (PostPublishedAtFilter) IsNull ¶
func (f PostPublishedAtFilter) IsNull() sqlgen.QueryMod
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) InsertAll ¶
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.
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) String ¶
func (e PostStatus) String() string
String returns the string representation.
type PostStatusFilter ¶
type PostStatusFilter struct {
// contains filtered or unexported fields
}
PostStatusFilter provides where clauses for the status column.
func (PostStatusFilter) EQ ¶
func (f PostStatusFilter) EQ(val PostStatus) sqlgen.QueryMod
func (PostStatusFilter) GT ¶
func (f PostStatusFilter) GT(val PostStatus) sqlgen.QueryMod
func (PostStatusFilter) GTE ¶
func (f PostStatusFilter) GTE(val PostStatus) sqlgen.QueryMod
func (PostStatusFilter) IN ¶
func (f PostStatusFilter) IN(vals ...PostStatus) sqlgen.QueryMod
func (PostStatusFilter) LT ¶
func (f PostStatusFilter) LT(val PostStatus) sqlgen.QueryMod
func (PostStatusFilter) LTE ¶
func (f PostStatusFilter) LTE(val PostStatus) sqlgen.QueryMod
func (PostStatusFilter) NEQ ¶
func (f PostStatusFilter) NEQ(val PostStatus) sqlgen.QueryMod
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 (*PostTag) Insert ¶
Insert inserts the PostTag into the database. Optional Columns parameter controls which 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 PostTagPostIDFilter ¶
type PostTagPostIDFilter struct {
// contains filtered or unexported fields
}
PostTagPostIDFilter provides where clauses for the post_id column.
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.
type PostTitleFilter ¶
type PostTitleFilter struct {
// contains filtered or unexported fields
}
PostTitleFilter provides where clauses for the title column.
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 ¶
FindTagByPK finds a Tag by primary key.
func (*Tag) Insert ¶
Insert inserts the Tag into the database. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).
func (*Tag) RemovePosts ¶
RemovePosts removes from the Posts relationship by deleting join table rows.
func (*Tag) SetPosts ¶
SetPosts replaces the Posts relationship entirely. Deletes all existing join rows, then inserts new ones.
type TagIDFilter ¶
type TagIDFilter struct {
// contains filtered or unexported fields
}
TagIDFilter provides where clauses for the id column.
type TagNameFilter ¶
type TagNameFilter struct {
// contains filtered or unexported fields
}
TagNameFilter provides where clauses for the name column.
type TagSlice ¶
type TagSlice []*Tag
TagSlice is a slice of Tag pointers.
func AllTags ¶
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) InsertAll ¶
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.
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"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
R *UserRels `db:"-" json:"-"`
}
User represents a row from the 'users' table.
func FindUserByPK ¶
FindUserByPK finds a User by primary key.
func (*User) Insert ¶
Insert inserts the User into the database. Optional Columns parameter controls which columns are included (Whitelist/Blacklist).
type UserBioFilter ¶
type UserBioFilter struct {
// contains filtered or unexported fields
}
UserBioFilter provides where clauses for the bio column.
func (UserBioFilter) IsNotNull ¶
func (f UserBioFilter) IsNotNull() sqlgen.QueryMod
func (UserBioFilter) IsNull ¶
func (f UserBioFilter) IsNull() sqlgen.QueryMod
type UserCreatedAtFilter ¶
type UserCreatedAtFilter struct {
// contains filtered or unexported fields
}
UserCreatedAtFilter provides where clauses for the created_at column.
type UserEmailFilter ¶
type UserEmailFilter struct {
// contains filtered or unexported fields
}
UserEmailFilter provides where clauses for the email column.
type UserIDFilter ¶
type UserIDFilter struct {
// contains filtered or unexported fields
}
UserIDFilter provides where clauses for the id column.
type UserNameFilter ¶
type UserNameFilter struct {
// contains filtered or unexported fields
}
UserNameFilter provides where clauses for the name column.
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) InsertAll ¶
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.
Source Files
¶
- sqlgen_dialect.go
- sqlgen_enum_post_status.go
- sqlgen_post_tags_crud.go
- sqlgen_post_tags_hooks.go
- sqlgen_post_tags_model.go
- sqlgen_post_tags_where.go
- sqlgen_posts_count_loaders.go
- sqlgen_posts_crud.go
- sqlgen_posts_hooks.go
- sqlgen_posts_loaders.go
- sqlgen_posts_model.go
- sqlgen_posts_preload.go
- sqlgen_posts_relations.go
- sqlgen_posts_where.go
- sqlgen_tags_count_loaders.go
- sqlgen_tags_crud.go
- sqlgen_tags_hooks.go
- sqlgen_tags_loaders.go
- sqlgen_tags_model.go
- sqlgen_tags_relations.go
- sqlgen_tags_where.go
- sqlgen_users_count_loaders.go
- sqlgen_users_crud.go
- sqlgen_users_hooks.go
- sqlgen_users_loaders.go
- sqlgen_users_model.go
- sqlgen_users_relations.go
- sqlgen_users_where.go