Documentation ¶
Overview ¶
Code generated by protoc-gen-structify. DO NOT EDIT. source: example/case_two/db/blog.proto provider: sqlite protoc-gen-structify: (version=v1.1.0, branch=main, revision=0176e1872838a373cdc0d8a630d16ecb748ed32d), build: (go=go1.22.6, date=2024-08-14T15:04:24+0300) protoc: 3.15.8
Index ¶
- Variables
- func Dsn(filepath string, mode string, cache string, timeout int) string
- func Open(dsn string, opts ...BlogDatabaseClientOption) (*sql.DB, error)
- func TxFromContext(ctx context.Context) (*sql.Tx, bool)
- type Address
- type AddressAdvancedDeletion
- type AddressCRUDOperations
- type AddressFilters
- type AddressPaginationOperations
- type AddressRawQueryOperations
- type AddressRelationLoading
- type AddressSearchOperations
- type AddressStorage
- type AddressTableManager
- type AddressUpdate
- type AndCondition
- type BetweenCondition
- type BlogDatabaseClientOption
- type BlogDatabaseClientOptions
- type BlogStorages
- type CommentMeta
- type Device
- type DeviceAdvancedDeletion
- type DeviceCRUDOperations
- type DeviceFilters
- type DevicePaginationOperations
- type DeviceRawQueryOperations
- type DeviceRelationLoading
- type DeviceSearchOperations
- type DeviceStorage
- type DeviceTableManager
- type DeviceUpdate
- type EqualsCondition
- type FilterApplier
- func AddressIdBetween(min, max string) FilterApplier
- func AddressIdEq(value string) FilterApplier
- func AddressIdGT(value string) FilterApplier
- func AddressIdGTE(value string) FilterApplier
- func AddressIdIn(values ...interface{}) FilterApplier
- func AddressIdLT(value string) FilterApplier
- func AddressIdLTE(value string) FilterApplier
- func AddressIdLike(value string) FilterApplier
- func AddressIdNotEq(value string) FilterApplier
- func AddressIdNotIn(values ...interface{}) FilterApplier
- func AddressIdNotLike(value string) FilterApplier
- func AddressIdOrderBy(asc bool) FilterApplier
- func AddressUserIdBetween(min, max string) FilterApplier
- func AddressUserIdEq(value string) FilterApplier
- func AddressUserIdGT(value string) FilterApplier
- func AddressUserIdGTE(value string) FilterApplier
- func AddressUserIdIn(values ...interface{}) FilterApplier
- func AddressUserIdLT(value string) FilterApplier
- func AddressUserIdLTE(value string) FilterApplier
- func AddressUserIdLike(value string) FilterApplier
- func AddressUserIdNotEq(value string) FilterApplier
- func AddressUserIdNotIn(values ...interface{}) FilterApplier
- func AddressUserIdNotLike(value string) FilterApplier
- func AddressUserIdOrderBy(asc bool) FilterApplier
- func And(conditions ...FilterApplier) FilterApplier
- func Between(field string, min, max interface{}) FilterApplier
- func DeviceUserIdBetween(min, max string) FilterApplier
- func DeviceUserIdEq(value string) FilterApplier
- func DeviceUserIdGT(value string) FilterApplier
- func DeviceUserIdGTE(value string) FilterApplier
- func DeviceUserIdIn(values ...interface{}) FilterApplier
- func DeviceUserIdLT(value string) FilterApplier
- func DeviceUserIdLTE(value string) FilterApplier
- func DeviceUserIdLike(value string) FilterApplier
- func DeviceUserIdNotEq(value string) FilterApplier
- func DeviceUserIdNotIn(values ...interface{}) FilterApplier
- func DeviceUserIdNotLike(value string) FilterApplier
- func DeviceUserIdOrderBy(asc bool) FilterApplier
- func Eq(field string, value interface{}) FilterApplier
- func GreaterThan(field string, value interface{}) FilterApplier
- func GreaterThanOrEq(field string, value interface{}) FilterApplier
- func In(field string, values ...interface{}) FilterApplier
- func IsNotNull(field string) FilterApplier
- func IsNull(field string) FilterApplier
- func Join(joinType JoinType, table Table, on FilterApplier) FilterApplier
- func LessThan(field string, value interface{}) FilterApplier
- func LessThanOrEq(field string, value interface{}) FilterApplier
- func Like(field string, value interface{}) FilterApplier
- func NotEq(field string, value interface{}) FilterApplier
- func NotIn(field string, values ...interface{}) FilterApplier
- func NotLike(field string, value interface{}) FilterApplier
- func Or(conditions ...FilterApplier) FilterApplier
- func OrderBy(column string, asc bool) FilterApplier
- func PostAuthorIdBetween(min, max string) FilterApplier
- func PostAuthorIdEq(value string) FilterApplier
- func PostAuthorIdGT(value string) FilterApplier
- func PostAuthorIdGTE(value string) FilterApplier
- func PostAuthorIdIn(values ...interface{}) FilterApplier
- func PostAuthorIdLT(value string) FilterApplier
- func PostAuthorIdLTE(value string) FilterApplier
- func PostAuthorIdLike(value string) FilterApplier
- func PostAuthorIdNotEq(value string) FilterApplier
- func PostAuthorIdNotIn(values ...interface{}) FilterApplier
- func PostAuthorIdNotLike(value string) FilterApplier
- func PostAuthorIdOrderBy(asc bool) FilterApplier
- func PostIdBetween(min, max int32) FilterApplier
- func PostIdEq(value int32) FilterApplier
- func PostIdGT(value int32) FilterApplier
- func PostIdGTE(value int32) FilterApplier
- func PostIdIn(values ...interface{}) FilterApplier
- func PostIdLT(value int32) FilterApplier
- func PostIdLTE(value int32) FilterApplier
- func PostIdNotEq(value int32) FilterApplier
- func PostIdNotIn(values ...interface{}) FilterApplier
- func PostIdOrderBy(asc bool) FilterApplier
- func SettingIdBetween(min, max int32) FilterApplier
- func SettingIdEq(value int32) FilterApplier
- func SettingIdGT(value int32) FilterApplier
- func SettingIdGTE(value int32) FilterApplier
- func SettingIdIn(values ...interface{}) FilterApplier
- func SettingIdLT(value int32) FilterApplier
- func SettingIdLTE(value int32) FilterApplier
- func SettingIdNotEq(value int32) FilterApplier
- func SettingIdNotIn(values ...interface{}) FilterApplier
- func SettingIdOrderBy(asc bool) FilterApplier
- func SettingUserIdBetween(min, max string) FilterApplier
- func SettingUserIdEq(value string) FilterApplier
- func SettingUserIdGT(value string) FilterApplier
- func SettingUserIdGTE(value string) FilterApplier
- func SettingUserIdIn(values ...interface{}) FilterApplier
- func SettingUserIdLT(value string) FilterApplier
- func SettingUserIdLTE(value string) FilterApplier
- func SettingUserIdLike(value string) FilterApplier
- func SettingUserIdNotEq(value string) FilterApplier
- func SettingUserIdNotIn(values ...interface{}) FilterApplier
- func SettingUserIdNotLike(value string) FilterApplier
- func SettingUserIdOrderBy(asc bool) FilterApplier
- func UserAgeBetween(min, max int32) FilterApplier
- func UserAgeEq(value int32) FilterApplier
- func UserAgeGT(value int32) FilterApplier
- func UserAgeGTE(value int32) FilterApplier
- func UserAgeIn(values ...interface{}) FilterApplier
- func UserAgeLT(value int32) FilterApplier
- func UserAgeLTE(value int32) FilterApplier
- func UserAgeNotEq(value int32) FilterApplier
- func UserAgeNotIn(values ...interface{}) FilterApplier
- func UserAgeOrderBy(asc bool) FilterApplier
- func UserEmailBetween(min, max string) FilterApplier
- func UserEmailEq(value string) FilterApplier
- func UserEmailGT(value string) FilterApplier
- func UserEmailGTE(value string) FilterApplier
- func UserEmailIn(values ...interface{}) FilterApplier
- func UserEmailLT(value string) FilterApplier
- func UserEmailLTE(value string) FilterApplier
- func UserEmailLike(value string) FilterApplier
- func UserEmailNotEq(value string) FilterApplier
- func UserEmailNotIn(values ...interface{}) FilterApplier
- func UserEmailNotLike(value string) FilterApplier
- func UserEmailOrderBy(asc bool) FilterApplier
- func UserIdBetween(min, max string) FilterApplier
- func UserIdEq(value string) FilterApplier
- func UserIdGT(value string) FilterApplier
- func UserIdGTE(value string) FilterApplier
- func UserIdIn(values ...interface{}) FilterApplier
- func UserIdLT(value string) FilterApplier
- func UserIdLTE(value string) FilterApplier
- func UserIdLike(value string) FilterApplier
- func UserIdNotEq(value string) FilterApplier
- func UserIdNotIn(values ...interface{}) FilterApplier
- func UserIdNotLike(value string) FilterApplier
- func UserIdOrderBy(asc bool) FilterApplier
- func UserNameBetween(min, max string) FilterApplier
- func UserNameEq(value string) FilterApplier
- func UserNameGT(value string) FilterApplier
- func UserNameGTE(value string) FilterApplier
- func UserNameIn(values ...interface{}) FilterApplier
- func UserNameLT(value string) FilterApplier
- func UserNameLTE(value string) FilterApplier
- func UserNameLike(value string) FilterApplier
- func UserNameNotEq(value string) FilterApplier
- func UserNameNotIn(values ...interface{}) FilterApplier
- func UserNameNotLike(value string) FilterApplier
- func UserNameOrderBy(asc bool) FilterApplier
- type GreaterThanCondition
- type GreaterThanOrEqualCondition
- type InCondition
- type IsNotNullCondition
- type IsNullCondition
- type JoinCondition
- type JoinType
- type LessThanCondition
- type LessThanOrEqualCondition
- type LikeCondition
- type NotEqualsCondition
- type NotInCondition
- type NotLikeCondition
- type Option
- type Options
- type OrCondition
- type OrderCondition
- type Pagination
- type Paginator
- type Post
- type PostAdvancedDeletion
- type PostCRUDOperations
- type PostFilters
- type PostPaginationOperations
- type PostRawQueryOperations
- type PostRelationLoading
- type PostSearchOperations
- type PostStorage
- type PostTableManager
- type PostUpdate
- type QueryBuilder
- func FilterBuilder(filterOptions ...FilterApplier) *QueryBuilder
- func LimitBuilder(limit uint64) *QueryBuilder
- func NewQueryBuilder() *QueryBuilder
- func OffsetBuilder(offset uint64) *QueryBuilder
- func PaginateBuilder(limit, offset uint64) *QueryBuilder
- func SortBuilder(sortOptions ...FilterApplier) *QueryBuilder
- type QueryExecer
- type Setting
- type SettingAdvancedDeletion
- type SettingCRUDOperations
- type SettingFilters
- type SettingPaginationOperations
- type SettingRawQueryOperations
- type SettingRelationLoading
- type SettingSearchOperations
- type SettingStorage
- type SettingTableManager
- type SettingUpdate
- type Table
- type TxManager
- func (m *TxManager) Begin(ctx context.Context) (context.Context, error)
- func (m *TxManager) Commit(ctx context.Context) error
- func (m *TxManager) ExecFuncWithTx(ctx context.Context, f func(context.Context) error) error
- func (m *TxManager) IsTxOpen(ctx context.Context) bool
- func (m *TxManager) Rollback(ctx context.Context) error
- type User
- type UserAdvancedDeletion
- type UserBallsRepeated
- type UserCRUDOperations
- type UserComment
- type UserCommentsRepeated
- type UserFilters
- type UserNotificationSetting
- type UserNumr
- type UserNumrsRepeated
- type UserPaginationOperations
- type UserPhonesRepeated
- type UserRawQueryOperations
- type UserRelationLoading
- type UserSearchOperations
- type UserStorage
- type UserTableManager
- type UserUpdate
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned when a record is not found. ErrRowNotFound = errors.New("row not found") // ErrNoTransaction is returned when a transaction is not provided. ErrNoTransaction = errors.New("no transaction provided") // ErrRowAlreadyExist is returned when a row already exist. ErrRowAlreadyExist = errors.New("row already exist") // ErrModelIsNil is returned when a relation model is nil. ErrModelIsNil = errors.New("model is nil") )
Functions ¶
Types ¶
type Address ¶
type Address struct { Id string `db:"id"` Street string `db:"street"` City string `db:"city"` State int32 `db:"state"` Zip int64 `db:"zip"` User *User UserId string `db:"user_id"` CreatedAt string `db:"created_at"` UpdatedAt *string `db:"updated_at"` }
Address is a struct for the "addresses" table.
type AddressAdvancedDeletion ¶
type AddressAdvancedDeletion interface {
DeleteMany(ctx context.Context, builders ...*QueryBuilder) error
}
AddressAdvancedDeletion is an interface for advanced deletion operations.
type AddressCRUDOperations ¶
type AddressCRUDOperations interface { Create(ctx context.Context, model *Address, opts ...Option) (*string, error) Update(ctx context.Context, id string, updateData *AddressUpdate) error DeleteById(ctx context.Context, id string, opts ...Option) error FindById(ctx context.Context, id string, opts ...Option) (*Address, error) }
AddressCRUDOperations is an interface for managing the addresses table.
type AddressFilters ¶
AddressFilters is a struct that holds filters for Address.
type AddressPaginationOperations ¶
type AddressPaginationOperations interface {
FindManyWithPagination(ctx context.Context, limit int, page int, builders ...*QueryBuilder) ([]*Address, *Paginator, error)
}
AddressPaginationOperations is an interface for pagination operations.
type AddressRawQueryOperations ¶
type AddressRawQueryOperations interface { Query(ctx context.Context, query string, args ...interface{}) (sql.Result, error) QueryRow(ctx context.Context, query string, args ...interface{}) *sql.Row QueryRows(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) }
AddressRawQueryOperations is an interface for executing raw queries.
type AddressRelationLoading ¶
type AddressRelationLoading interface { LoadUser(ctx context.Context, model *Address, builders ...*QueryBuilder) error LoadBatchUser(ctx context.Context, items []*Address, builders ...*QueryBuilder) error }
AddressRelationLoading is an interface for loading relations.
type AddressSearchOperations ¶
type AddressSearchOperations interface { FindMany(ctx context.Context, builder ...*QueryBuilder) ([]*Address, error) FindOne(ctx context.Context, builders ...*QueryBuilder) (*Address, error) Count(ctx context.Context, builders ...*QueryBuilder) (int64, error) SelectForUpdate(ctx context.Context, builders ...*QueryBuilder) (*Address, error) }
AddressSearchOperations is an interface for searching the addresses table.
type AddressStorage ¶
type AddressStorage interface { AddressTableManager AddressCRUDOperations AddressSearchOperations AddressPaginationOperations AddressRelationLoading AddressAdvancedDeletion AddressRawQueryOperations }
AddressStorage is a struct for the "addresses" table.
func NewAddressStorage ¶
func NewAddressStorage(db *sql.DB) AddressStorage
NewAddressStorage returns a new addressStorage.
type AddressTableManager ¶
type AddressTableManager interface { CreateTable(ctx context.Context) error DropTable(ctx context.Context) error TruncateTable(ctx context.Context) error UpgradeTable(ctx context.Context) error }
AddressTableManager is an interface for managing the addresses table.
type AddressUpdate ¶
type AddressUpdate struct { Street *string City *string State *int32 Zip *int64 UserId *string CreatedAt *string UpdatedAt *string }
AddressUpdate is used to update an existing Address.
type AndCondition ¶
type AndCondition struct {
Where []FilterApplier
}
And returns a condition that combines the given conditions with AND.
func (AndCondition) Apply ¶
func (c AndCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
And returns a condition that combines the given conditions with AND.
func (AndCondition) ApplyDelete ¶
func (c AndCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
And returns a condition that combines the given conditions with AND.
type BetweenCondition ¶
type BetweenCondition struct { Field string Min interface{} Max interface{} }
BetweenCondition
func (BetweenCondition) Apply ¶
func (c BetweenCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
Apply applies the condition to the query.
func (BetweenCondition) ApplyDelete ¶
func (c BetweenCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
ApplyDelete applies the condition to the query.
type BlogDatabaseClientOption ¶
type BlogDatabaseClientOption func(*BlogDatabaseClientOptions)
Option is a function that configures the BlogDatabaseClient.
func WithConnMaxIdleTime ¶
func WithConnMaxIdleTime(connMaxIdleTime time.Duration) BlogDatabaseClientOption
WithConnMaxIdleTime sets the maximum amount of time a connection may be idle.
func WithMaxIdleConns ¶
func WithMaxIdleConns(maxIdleConns int) BlogDatabaseClientOption
WithMaxIdleConns sets the maximum number of idle connections to the database.
func WithMaxLifetime ¶
func WithMaxLifetime(maxLifetime time.Duration) BlogDatabaseClientOption
WithMaxLifetime sets the maximum amount of time a connection may be reused.
func WithMaxOpenConns ¶
func WithMaxOpenConns(maxOpenConns int) BlogDatabaseClientOption
WithMaxOpenConns sets the maximum number of open connections to the database.
type BlogDatabaseClientOptions ¶
type BlogDatabaseClientOptions struct { MaxOpenConns int MaxIdleConns int ConnMaxIdleTime time.Duration MaxLifetime time.Duration }
BlogDatabaseClientOptions are the options for the BlogDatabaseClient.
type BlogStorages ¶
type BlogStorages interface { // GetDeviceStorage returns the DeviceStorage store. GetDeviceStorage() DeviceStorage // GetPostStorage returns the PostStorage store. GetPostStorage() PostStorage // GetUserStorage returns the UserStorage store. GetUserStorage() UserStorage // GetSettingStorage returns the SettingStorage store. GetSettingStorage() SettingStorage // GetAddressStorage returns the AddressStorage store. GetAddressStorage() AddressStorage // TxManager returns the transaction manager. TxManager() *TxManager // CreateTables creates the tables for all the stores. CreateTables(ctx context.Context) error // DropTables drops the tables for all the stores. DropTables(ctx context.Context) error // TruncateTables truncates the tables for all the stores. TruncateTables(ctx context.Context) error // UpgradeTables upgrades the tables for all the stores. UpgradeTables(ctx context.Context) error }
BlogStorages is the interface for the BlogStorages.
func NewBlogStorages ¶
func NewBlogStorages(db *sql.DB) BlogStorages
NewBlogStorages returns a new BlogStorages.
type CommentMeta ¶
type CommentMeta struct { Ip string `json:"ip"` Browser string `json:"browser"` Os string `json:"os"` }
Meta is a JSON type nested in another message.
func (*CommentMeta) Scan ¶
func (m *CommentMeta) Scan(src interface{}) error
Scan implements the sql.Scanner interface for JSON.
type Device ¶
type Device struct { Name string `db:"name"` Value string `db:"value"` UserId string `db:"user_id"` }
Device is a struct for the "devices" table.
type DeviceAdvancedDeletion ¶
type DeviceAdvancedDeletion interface {
DeleteMany(ctx context.Context, builders ...*QueryBuilder) error
}
DeviceAdvancedDeletion is an interface for advanced deletion operations.
type DeviceCRUDOperations ¶
type DeviceCRUDOperations interface { Create(ctx context.Context, model *Device, opts ...Option) error Update(ctx context.Context, id int64, updateData *DeviceUpdate) error }
DeviceCRUDOperations is an interface for managing the devices table.
type DeviceFilters ¶
type DeviceFilters struct {
UserId *string
}
DeviceFilters is a struct that holds filters for Device.
type DevicePaginationOperations ¶
type DevicePaginationOperations interface {
FindManyWithPagination(ctx context.Context, limit int, page int, builders ...*QueryBuilder) ([]*Device, *Paginator, error)
}
DevicePaginationOperations is an interface for pagination operations.
type DeviceRawQueryOperations ¶
type DeviceRawQueryOperations interface { Query(ctx context.Context, query string, args ...interface{}) (sql.Result, error) QueryRow(ctx context.Context, query string, args ...interface{}) *sql.Row QueryRows(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) }
DeviceRawQueryOperations is an interface for executing raw queries.
type DeviceRelationLoading ¶
type DeviceRelationLoading interface { }
DeviceRelationLoading is an interface for loading relations.
type DeviceSearchOperations ¶
type DeviceSearchOperations interface { FindMany(ctx context.Context, builder ...*QueryBuilder) ([]*Device, error) FindOne(ctx context.Context, builders ...*QueryBuilder) (*Device, error) Count(ctx context.Context, builders ...*QueryBuilder) (int64, error) SelectForUpdate(ctx context.Context, builders ...*QueryBuilder) (*Device, error) }
DeviceSearchOperations is an interface for searching the devices table.
type DeviceStorage ¶
type DeviceStorage interface { DeviceTableManager DeviceCRUDOperations DeviceSearchOperations DevicePaginationOperations DeviceRelationLoading DeviceAdvancedDeletion DeviceRawQueryOperations }
DeviceStorage is a struct for the "devices" table.
func NewDeviceStorage ¶
func NewDeviceStorage(db *sql.DB) DeviceStorage
NewDeviceStorage returns a new deviceStorage.
type DeviceTableManager ¶
type DeviceTableManager interface { CreateTable(ctx context.Context) error DropTable(ctx context.Context) error TruncateTable(ctx context.Context) error UpgradeTable(ctx context.Context) error }
DeviceTableManager is an interface for managing the devices table.
type DeviceUpdate ¶
DeviceUpdate is used to update an existing Device.
type EqualsCondition ¶
type EqualsCondition struct { Field string Value interface{} }
EqualsCondition equals condition.
func (EqualsCondition) Apply ¶
func (c EqualsCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
Apply applies the condition to the query.
func (EqualsCondition) ApplyDelete ¶
func (c EqualsCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
type FilterApplier ¶
type FilterApplier interface { Apply(query sq.SelectBuilder) sq.SelectBuilder ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder }
FilterApplier is a condition filters.
func AddressIdBetween ¶
func AddressIdBetween(min, max string) FilterApplier
AddressIdBetween between condition.
func AddressIdEq ¶
func AddressIdEq(value string) FilterApplier
AddressIdEq returns a condition that checks if the field equals the value.
func AddressIdGT ¶
func AddressIdGT(value string) FilterApplier
AddressIdGT greaterThanCondition than condition.
func AddressIdGTE ¶
func AddressIdGTE(value string) FilterApplier
AddressIdGTE greater than or equal condition.
func AddressIdLTE ¶
func AddressIdLTE(value string) FilterApplier
AddressIdLTE less than or equal condition.
func AddressIdNotEq ¶
func AddressIdNotEq(value string) FilterApplier
AddressIdNotEq returns a condition that checks if the field equals the value.
func AddressIdNotIn ¶
func AddressIdNotIn(values ...interface{}) FilterApplier
AddressIdNotIn not in condition
func AddressIdNotLike ¶
func AddressIdNotLike(value string) FilterApplier
AddressIdNotLike not like condition
func AddressIdOrderBy ¶
func AddressIdOrderBy(asc bool) FilterApplier
AddressIdOrderBy sorts the result in ascending order.
func AddressUserIdBetween ¶
func AddressUserIdBetween(min, max string) FilterApplier
AddressUserIdBetween between condition.
func AddressUserIdEq ¶
func AddressUserIdEq(value string) FilterApplier
AddressUserIdEq returns a condition that checks if the field equals the value.
func AddressUserIdGT ¶
func AddressUserIdGT(value string) FilterApplier
AddressUserIdGT greaterThanCondition than condition.
func AddressUserIdGTE ¶
func AddressUserIdGTE(value string) FilterApplier
AddressUserIdGTE greater than or equal condition.
func AddressUserIdIn ¶
func AddressUserIdIn(values ...interface{}) FilterApplier
AddressUserIdIn condition
func AddressUserIdLT ¶
func AddressUserIdLT(value string) FilterApplier
AddressUserIdLT less than condition.
func AddressUserIdLTE ¶
func AddressUserIdLTE(value string) FilterApplier
AddressUserIdLTE less than or equal condition.
func AddressUserIdLike ¶
func AddressUserIdLike(value string) FilterApplier
AddressUserIdLike like condition %
func AddressUserIdNotEq ¶
func AddressUserIdNotEq(value string) FilterApplier
AddressUserIdNotEq returns a condition that checks if the field equals the value.
func AddressUserIdNotIn ¶
func AddressUserIdNotIn(values ...interface{}) FilterApplier
AddressUserIdNotIn not in condition
func AddressUserIdNotLike ¶
func AddressUserIdNotLike(value string) FilterApplier
AddressUserIdNotLike not like condition
func AddressUserIdOrderBy ¶
func AddressUserIdOrderBy(asc bool) FilterApplier
AddressUserIdOrderBy sorts the result in ascending order.
func And ¶
func And(conditions ...FilterApplier) FilterApplier
And returns a condition that combines the given conditions with AND.
func Between ¶
func Between(field string, min, max interface{}) FilterApplier
Between returns a condition that checks if the field is between the min and max values.
func DeviceUserIdBetween ¶
func DeviceUserIdBetween(min, max string) FilterApplier
DeviceUserIdBetween between condition.
func DeviceUserIdEq ¶
func DeviceUserIdEq(value string) FilterApplier
DeviceUserIdEq returns a condition that checks if the field equals the value.
func DeviceUserIdGT ¶
func DeviceUserIdGT(value string) FilterApplier
DeviceUserIdGT greaterThanCondition than condition.
func DeviceUserIdGTE ¶
func DeviceUserIdGTE(value string) FilterApplier
DeviceUserIdGTE greater than or equal condition.
func DeviceUserIdIn ¶
func DeviceUserIdIn(values ...interface{}) FilterApplier
DeviceUserIdIn condition
func DeviceUserIdLT ¶
func DeviceUserIdLT(value string) FilterApplier
DeviceUserIdLT less than condition.
func DeviceUserIdLTE ¶
func DeviceUserIdLTE(value string) FilterApplier
DeviceUserIdLTE less than or equal condition.
func DeviceUserIdLike ¶
func DeviceUserIdLike(value string) FilterApplier
DeviceUserIdLike like condition %
func DeviceUserIdNotEq ¶
func DeviceUserIdNotEq(value string) FilterApplier
DeviceUserIdNotEq returns a condition that checks if the field equals the value.
func DeviceUserIdNotIn ¶
func DeviceUserIdNotIn(values ...interface{}) FilterApplier
DeviceUserIdNotIn not in condition
func DeviceUserIdNotLike ¶
func DeviceUserIdNotLike(value string) FilterApplier
DeviceUserIdNotLike not like condition
func DeviceUserIdOrderBy ¶
func DeviceUserIdOrderBy(asc bool) FilterApplier
DeviceUserIdOrderBy sorts the result in ascending order.
func Eq ¶
func Eq(field string, value interface{}) FilterApplier
Eq returns a condition that checks if the field equals the value.
func GreaterThan ¶
func GreaterThan(field string, value interface{}) FilterApplier
GreaterThan returns a condition that checks if the field equals the value.
func GreaterThanOrEq ¶
func GreaterThanOrEq(field string, value interface{}) FilterApplier
GreaterThanOrEqual returns a condition that checks if the field equals the value.
func In ¶
func In(field string, values ...interface{}) FilterApplier
In returns a condition that checks if the field is in the given values.
func IsNotNull ¶
func IsNotNull(field string) FilterApplier
IsNotNull returns a condition that checks if the field is not null.
func IsNull ¶
func IsNull(field string) FilterApplier
IsNull returns a condition that checks if the field is null.
func Join ¶
func Join(joinType JoinType, table Table, on FilterApplier) FilterApplier
func LessThan ¶
func LessThan(field string, value interface{}) FilterApplier
LessThan returns a condition that checks if the field equals the value.
func LessThanOrEq ¶
func LessThanOrEq(field string, value interface{}) FilterApplier
func Like ¶
func Like(field string, value interface{}) FilterApplier
Like returns a condition that checks if the field equals the value.
func NotEq ¶
func NotEq(field string, value interface{}) FilterApplier
NotEq returns a condition that checks if the field equals the value.
func NotIn ¶
func NotIn(field string, values ...interface{}) FilterApplier
NotIn returns a condition that checks if the field is not in the given values.
func NotLike ¶
func NotLike(field string, value interface{}) FilterApplier
NotLike returns a condition that checks if the field equals the value.
func Or ¶
func Or(conditions ...FilterApplier) FilterApplier
Or returns a condition that checks if any of the conditions are true.
func OrderBy ¶
func OrderBy(column string, asc bool) FilterApplier
Apply applies the condition to the query.
func PostAuthorIdBetween ¶
func PostAuthorIdBetween(min, max string) FilterApplier
PostAuthorIdBetween between condition.
func PostAuthorIdEq ¶
func PostAuthorIdEq(value string) FilterApplier
PostAuthorIdEq returns a condition that checks if the field equals the value.
func PostAuthorIdGT ¶
func PostAuthorIdGT(value string) FilterApplier
PostAuthorIdGT greaterThanCondition than condition.
func PostAuthorIdGTE ¶
func PostAuthorIdGTE(value string) FilterApplier
PostAuthorIdGTE greater than or equal condition.
func PostAuthorIdIn ¶
func PostAuthorIdIn(values ...interface{}) FilterApplier
PostAuthorIdIn condition
func PostAuthorIdLT ¶
func PostAuthorIdLT(value string) FilterApplier
PostAuthorIdLT less than condition.
func PostAuthorIdLTE ¶
func PostAuthorIdLTE(value string) FilterApplier
PostAuthorIdLTE less than or equal condition.
func PostAuthorIdLike ¶
func PostAuthorIdLike(value string) FilterApplier
PostAuthorIdLike like condition %
func PostAuthorIdNotEq ¶
func PostAuthorIdNotEq(value string) FilterApplier
PostAuthorIdNotEq returns a condition that checks if the field equals the value.
func PostAuthorIdNotIn ¶
func PostAuthorIdNotIn(values ...interface{}) FilterApplier
PostAuthorIdNotIn not in condition
func PostAuthorIdNotLike ¶
func PostAuthorIdNotLike(value string) FilterApplier
PostAuthorIdNotLike not like condition
func PostAuthorIdOrderBy ¶
func PostAuthorIdOrderBy(asc bool) FilterApplier
PostAuthorIdOrderBy sorts the result in ascending order.
func PostIdBetween ¶
func PostIdBetween(min, max int32) FilterApplier
PostIdBetween between condition.
func PostIdEq ¶
func PostIdEq(value int32) FilterApplier
PostIdEq returns a condition that checks if the field equals the value.
func PostIdGT ¶
func PostIdGT(value int32) FilterApplier
PostIdGT greaterThanCondition than condition.
func PostIdGTE ¶
func PostIdGTE(value int32) FilterApplier
PostIdGTE greater than or equal condition.
func PostIdNotEq ¶
func PostIdNotEq(value int32) FilterApplier
PostIdNotEq returns a condition that checks if the field equals the value.
func PostIdNotIn ¶
func PostIdNotIn(values ...interface{}) FilterApplier
PostIdNotIn not in condition
func PostIdOrderBy ¶
func PostIdOrderBy(asc bool) FilterApplier
PostIdOrderBy sorts the result in ascending order.
func SettingIdBetween ¶
func SettingIdBetween(min, max int32) FilterApplier
SettingIdBetween between condition.
func SettingIdEq ¶
func SettingIdEq(value int32) FilterApplier
SettingIdEq returns a condition that checks if the field equals the value.
func SettingIdGT ¶
func SettingIdGT(value int32) FilterApplier
SettingIdGT greaterThanCondition than condition.
func SettingIdGTE ¶
func SettingIdGTE(value int32) FilterApplier
SettingIdGTE greater than or equal condition.
func SettingIdLTE ¶
func SettingIdLTE(value int32) FilterApplier
SettingIdLTE less than or equal condition.
func SettingIdNotEq ¶
func SettingIdNotEq(value int32) FilterApplier
SettingIdNotEq returns a condition that checks if the field equals the value.
func SettingIdNotIn ¶
func SettingIdNotIn(values ...interface{}) FilterApplier
SettingIdNotIn not in condition
func SettingIdOrderBy ¶
func SettingIdOrderBy(asc bool) FilterApplier
SettingIdOrderBy sorts the result in ascending order.
func SettingUserIdBetween ¶
func SettingUserIdBetween(min, max string) FilterApplier
SettingUserIdBetween between condition.
func SettingUserIdEq ¶
func SettingUserIdEq(value string) FilterApplier
SettingUserIdEq returns a condition that checks if the field equals the value.
func SettingUserIdGT ¶
func SettingUserIdGT(value string) FilterApplier
SettingUserIdGT greaterThanCondition than condition.
func SettingUserIdGTE ¶
func SettingUserIdGTE(value string) FilterApplier
SettingUserIdGTE greater than or equal condition.
func SettingUserIdIn ¶
func SettingUserIdIn(values ...interface{}) FilterApplier
SettingUserIdIn condition
func SettingUserIdLT ¶
func SettingUserIdLT(value string) FilterApplier
SettingUserIdLT less than condition.
func SettingUserIdLTE ¶
func SettingUserIdLTE(value string) FilterApplier
SettingUserIdLTE less than or equal condition.
func SettingUserIdLike ¶
func SettingUserIdLike(value string) FilterApplier
SettingUserIdLike like condition %
func SettingUserIdNotEq ¶
func SettingUserIdNotEq(value string) FilterApplier
SettingUserIdNotEq returns a condition that checks if the field equals the value.
func SettingUserIdNotIn ¶
func SettingUserIdNotIn(values ...interface{}) FilterApplier
SettingUserIdNotIn not in condition
func SettingUserIdNotLike ¶
func SettingUserIdNotLike(value string) FilterApplier
SettingUserIdNotLike not like condition
func SettingUserIdOrderBy ¶
func SettingUserIdOrderBy(asc bool) FilterApplier
SettingUserIdOrderBy sorts the result in ascending order.
func UserAgeBetween ¶
func UserAgeBetween(min, max int32) FilterApplier
UserAgeBetween between condition.
func UserAgeEq ¶
func UserAgeEq(value int32) FilterApplier
UserAgeEq returns a condition that checks if the field equals the value.
func UserAgeGT ¶
func UserAgeGT(value int32) FilterApplier
UserAgeGT greaterThanCondition than condition.
func UserAgeGTE ¶
func UserAgeGTE(value int32) FilterApplier
UserAgeGTE greater than or equal condition.
func UserAgeLTE ¶
func UserAgeLTE(value int32) FilterApplier
UserAgeLTE less than or equal condition.
func UserAgeNotEq ¶
func UserAgeNotEq(value int32) FilterApplier
UserAgeNotEq returns a condition that checks if the field equals the value.
func UserAgeNotIn ¶
func UserAgeNotIn(values ...interface{}) FilterApplier
UserAgeNotIn not in condition
func UserAgeOrderBy ¶
func UserAgeOrderBy(asc bool) FilterApplier
UserAgeOrderBy sorts the result in ascending order.
func UserEmailBetween ¶
func UserEmailBetween(min, max string) FilterApplier
UserEmailBetween between condition.
func UserEmailEq ¶
func UserEmailEq(value string) FilterApplier
UserEmailEq returns a condition that checks if the field equals the value.
func UserEmailGT ¶
func UserEmailGT(value string) FilterApplier
UserEmailGT greaterThanCondition than condition.
func UserEmailGTE ¶
func UserEmailGTE(value string) FilterApplier
UserEmailGTE greater than or equal condition.
func UserEmailLTE ¶
func UserEmailLTE(value string) FilterApplier
UserEmailLTE less than or equal condition.
func UserEmailNotEq ¶
func UserEmailNotEq(value string) FilterApplier
UserEmailNotEq returns a condition that checks if the field equals the value.
func UserEmailNotIn ¶
func UserEmailNotIn(values ...interface{}) FilterApplier
UserEmailNotIn not in condition
func UserEmailNotLike ¶
func UserEmailNotLike(value string) FilterApplier
UserEmailNotLike not like condition
func UserEmailOrderBy ¶
func UserEmailOrderBy(asc bool) FilterApplier
UserEmailOrderBy sorts the result in ascending order.
func UserIdBetween ¶
func UserIdBetween(min, max string) FilterApplier
UserIdBetween between condition.
func UserIdEq ¶
func UserIdEq(value string) FilterApplier
UserIdEq returns a condition that checks if the field equals the value.
func UserIdGT ¶
func UserIdGT(value string) FilterApplier
UserIdGT greaterThanCondition than condition.
func UserIdGTE ¶
func UserIdGTE(value string) FilterApplier
UserIdGTE greater than or equal condition.
func UserIdNotEq ¶
func UserIdNotEq(value string) FilterApplier
UserIdNotEq returns a condition that checks if the field equals the value.
func UserIdNotIn ¶
func UserIdNotIn(values ...interface{}) FilterApplier
UserIdNotIn not in condition
func UserIdNotLike ¶
func UserIdNotLike(value string) FilterApplier
UserIdNotLike not like condition
func UserIdOrderBy ¶
func UserIdOrderBy(asc bool) FilterApplier
UserIdOrderBy sorts the result in ascending order.
func UserNameBetween ¶
func UserNameBetween(min, max string) FilterApplier
UserNameBetween between condition.
func UserNameEq ¶
func UserNameEq(value string) FilterApplier
UserNameEq returns a condition that checks if the field equals the value.
func UserNameGT ¶
func UserNameGT(value string) FilterApplier
UserNameGT greaterThanCondition than condition.
func UserNameGTE ¶
func UserNameGTE(value string) FilterApplier
UserNameGTE greater than or equal condition.
func UserNameLTE ¶
func UserNameLTE(value string) FilterApplier
UserNameLTE less than or equal condition.
func UserNameNotEq ¶
func UserNameNotEq(value string) FilterApplier
UserNameNotEq returns a condition that checks if the field equals the value.
func UserNameNotIn ¶
func UserNameNotIn(values ...interface{}) FilterApplier
UserNameNotIn not in condition
func UserNameNotLike ¶
func UserNameNotLike(value string) FilterApplier
UserNameNotLike not like condition
func UserNameOrderBy ¶
func UserNameOrderBy(asc bool) FilterApplier
UserNameOrderBy sorts the result in ascending order.
type GreaterThanCondition ¶
type GreaterThanCondition struct { Field string Value interface{} }
GreaterThanCondition greaterThanCondition than condition.
func (GreaterThanCondition) Apply ¶
func (c GreaterThanCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
Apply applies the condition to the query.
func (GreaterThanCondition) ApplyDelete ¶
func (c GreaterThanCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
ApplyDelete applies the condition to the query.
type GreaterThanOrEqualCondition ¶
type GreaterThanOrEqualCondition struct { Field string Value interface{} }
LessThanOrEqualCondition less than or equal condition.
func (GreaterThanOrEqualCondition) Apply ¶
func (c GreaterThanOrEqualCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
Apply applies the condition to the query.
func (GreaterThanOrEqualCondition) ApplyDelete ¶
func (c GreaterThanOrEqualCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
ApplyDelete applies the condition to the query.
type InCondition ¶
type InCondition struct { Field string Values []interface{} }
InCondition represents the IN condition.
func (InCondition) Apply ¶
func (c InCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
Apply applies the condition to the query.
func (InCondition) ApplyDelete ¶
func (c InCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
ApplyDelete applies the condition to the query.
type IsNotNullCondition ¶
type IsNotNullCondition struct {
Field string
}
IsNotNullCondition represents the IS NOT NULL condition.
func (IsNotNullCondition) Apply ¶
func (c IsNotNullCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
Apply applies the condition to the query.
func (IsNotNullCondition) ApplyDelete ¶
func (c IsNotNullCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
ApplyDelete applies the condition to the query.
type IsNullCondition ¶
type IsNullCondition struct {
Field string
}
IsNullCondition represents the IS NULL condition.
func (IsNullCondition) Apply ¶
func (c IsNullCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
Apply applies the condition to the query.
func (IsNullCondition) ApplyDelete ¶
func (c IsNullCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
ApplyDelete applies the condition to the query.
type JoinCondition ¶
type JoinCondition struct { Type JoinType Table Table On FilterApplier }
func (JoinCondition) Apply ¶
func (c JoinCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
func (JoinCondition) ApplyDelete ¶
func (c JoinCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
type LessThanCondition ¶
type LessThanCondition struct { Field string Value interface{} }
LessThanCondition less than condition.
func (LessThanCondition) Apply ¶
func (c LessThanCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
Apply applies the condition to the query.
func (LessThanCondition) ApplyDelete ¶
func (c LessThanCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
ApplyDelete applies the condition to the query.
type LessThanOrEqualCondition ¶
type LessThanOrEqualCondition struct { Field string Value interface{} }
LessThanOrEqualCondition less than or equal condition.
func (LessThanOrEqualCondition) Apply ¶
func (c LessThanOrEqualCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
Apply applies the condition to the query.
func (LessThanOrEqualCondition) ApplyDelete ¶
func (c LessThanOrEqualCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
ApplyDelete applies the condition to the query.
type LikeCondition ¶
type LikeCondition struct { Field string Value interface{} }
LikeCondition like condition.
func (LikeCondition) Apply ¶
func (c LikeCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
Apply applies the condition to the query.
func (LikeCondition) ApplyDelete ¶
func (c LikeCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
ApplyDelete applies the condition to the query.
type NotEqualsCondition ¶
type NotEqualsCondition struct { Field string Value interface{} }
NotEqualsCondition not equals condition.
func (NotEqualsCondition) Apply ¶
func (c NotEqualsCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
Apply applies the condition to the query.
func (NotEqualsCondition) ApplyDelete ¶
func (c NotEqualsCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
ApplyDelete applies the condition to the query.
type NotInCondition ¶
type NotInCondition struct { Field string Values []interface{} }
NotInCondition represents the NOT IN condition.
func (NotInCondition) Apply ¶
func (c NotInCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
Apply applies the condition to the query.
func (NotInCondition) ApplyDelete ¶
func (c NotInCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
ApplyDelete applies the condition to the query.
type NotLikeCondition ¶
type NotLikeCondition struct { Field string Value interface{} }
NotLikeCondition not like condition.
func (NotLikeCondition) Apply ¶
func (c NotLikeCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
Apply applies the condition to the query.
func (NotLikeCondition) ApplyDelete ¶
func (c NotLikeCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
ApplyDelete applies the condition to the query.
type Option ¶
type Option func(*Options)
Option is a function that configures the BlogStorages.
func WithRelations ¶
func WithRelations() Option
WithRelations sets the relations flag. This is used to determine if the relations should be created or updated.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options are the options for the BlogStorages.
type OrCondition ¶
type OrCondition struct {
Conditions []FilterApplier
}
Or returns a condition that checks if any of the conditions are true.
func (OrCondition) Apply ¶
func (c OrCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
Apply applies the condition to the query.
func (OrCondition) ApplyDelete ¶
func (c OrCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
Apply applies the condition to the query.
type OrderCondition ¶
OrderCondition represents the ORDER BY condition.
func (OrderCondition) Apply ¶
func (c OrderCondition) Apply(query sq.SelectBuilder) sq.SelectBuilder
Apply applies the condition to the query.
func (OrderCondition) ApplyDelete ¶
func (c OrderCondition) ApplyDelete(query sq.DeleteBuilder) sq.DeleteBuilder
ApplyDelete applies the condition to the query.
type Pagination ¶
type Pagination struct {
// contains filtered or unexported fields
}
Pagination is the pagination.
func Limit ¶
func Limit(limit uint64) *Pagination
Limit is a helper function to create a new pagination.
func NewPagination ¶
func NewPagination(limit, offset uint64) *Pagination
NewPagination returns a new pagination. If limit or offset are nil, then they will be omitted.
func Offset ¶
func Offset(offset uint64) *Pagination
Offset is a helper function to create a new pagination.
type Post ¶
type Post struct { Id int32 `db:"id"` Title string `db:"title"` Body string `db:"body"` Author *User AuthorId string `db:"author_id"` }
Post is a struct for the "posts" table.
type PostAdvancedDeletion ¶
type PostAdvancedDeletion interface {
DeleteMany(ctx context.Context, builders ...*QueryBuilder) error
}
PostAdvancedDeletion is an interface for advanced deletion operations.
type PostCRUDOperations ¶
type PostCRUDOperations interface { Create(ctx context.Context, model *Post, opts ...Option) (*int32, error) Update(ctx context.Context, id int32, updateData *PostUpdate) error DeleteById(ctx context.Context, id int32, opts ...Option) error FindById(ctx context.Context, id int32, opts ...Option) (*Post, error) }
PostCRUDOperations is an interface for managing the posts table.
type PostFilters ¶
PostFilters is a struct that holds filters for Post.
type PostPaginationOperations ¶
type PostPaginationOperations interface {
FindManyWithPagination(ctx context.Context, limit int, page int, builders ...*QueryBuilder) ([]*Post, *Paginator, error)
}
PostPaginationOperations is an interface for pagination operations.
type PostRawQueryOperations ¶
type PostRawQueryOperations interface { Query(ctx context.Context, query string, args ...interface{}) (sql.Result, error) QueryRow(ctx context.Context, query string, args ...interface{}) *sql.Row QueryRows(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) }
PostRawQueryOperations is an interface for executing raw queries.
type PostRelationLoading ¶
type PostRelationLoading interface { LoadAuthor(ctx context.Context, model *Post, builders ...*QueryBuilder) error LoadBatchAuthor(ctx context.Context, items []*Post, builders ...*QueryBuilder) error }
PostRelationLoading is an interface for loading relations.
type PostSearchOperations ¶
type PostSearchOperations interface { FindMany(ctx context.Context, builder ...*QueryBuilder) ([]*Post, error) FindOne(ctx context.Context, builders ...*QueryBuilder) (*Post, error) Count(ctx context.Context, builders ...*QueryBuilder) (int64, error) SelectForUpdate(ctx context.Context, builders ...*QueryBuilder) (*Post, error) }
PostSearchOperations is an interface for searching the posts table.
type PostStorage ¶
type PostStorage interface { PostTableManager PostCRUDOperations PostSearchOperations PostPaginationOperations PostRelationLoading PostAdvancedDeletion PostRawQueryOperations }
PostStorage is a struct for the "posts" table.
func NewPostStorage ¶
func NewPostStorage(db *sql.DB) PostStorage
NewPostStorage returns a new postStorage.
type PostTableManager ¶
type PostTableManager interface { CreateTable(ctx context.Context) error DropTable(ctx context.Context) error TruncateTable(ctx context.Context) error UpgradeTable(ctx context.Context) error }
PostTableManager is an interface for managing the posts table.
type PostUpdate ¶
PostUpdate is used to update an existing Post.
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
QueryBuilder is a query builder.
func FilterBuilder ¶
func FilterBuilder(filterOptions ...FilterApplier) *QueryBuilder
Filter is a helper function to create a new query builder with filter options.
func LimitBuilder ¶
func LimitBuilder(limit uint64) *QueryBuilder
Options is a helper function to create a new query builder with options.
func NewQueryBuilder ¶
func NewQueryBuilder() *QueryBuilder
NewQueryBuilder returns a new query builder.
func OffsetBuilder ¶
func OffsetBuilder(offset uint64) *QueryBuilder
Offset is a helper function to create a new query builder with options.
func PaginateBuilder ¶
func PaginateBuilder(limit, offset uint64) *QueryBuilder
Paginate is a helper function to create a new query builder with options.
func SortBuilder ¶
func SortBuilder(sortOptions ...FilterApplier) *QueryBuilder
SortBuilder is a helper function to create a new query builder with sort options.
func (*QueryBuilder) WithFilter ¶
func (b *QueryBuilder) WithFilter(filterOptions ...FilterApplier) *QueryBuilder
WithFilterOptions sets the filter options for the query.
func (*QueryBuilder) WithOptions ¶
func (b *QueryBuilder) WithOptions(options ...Option) *QueryBuilder
WithOptions sets the options for the query.
func (*QueryBuilder) WithPagination ¶
func (b *QueryBuilder) WithPagination(pagination *Pagination) *QueryBuilder
WithPagination sets the pagination for the query.
func (*QueryBuilder) WithSort ¶
func (b *QueryBuilder) WithSort(sortOptions ...FilterApplier) *QueryBuilder
WithSort sets the sort options for the query.
type QueryExecer ¶
type QueryExecer interface { QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row }
QueryExecer is an interface that can execute queries.
type Setting ¶
type Setting struct { Id int32 `db:"id"` Name string `db:"name"` Value string `db:"value"` User *User UserId string `db:"user_id"` }
Setting is a struct for the "settings" table.
type SettingAdvancedDeletion ¶
type SettingAdvancedDeletion interface {
DeleteMany(ctx context.Context, builders ...*QueryBuilder) error
}
SettingAdvancedDeletion is an interface for advanced deletion operations.
type SettingCRUDOperations ¶
type SettingCRUDOperations interface { Create(ctx context.Context, model *Setting, opts ...Option) (*int32, error) Update(ctx context.Context, id int32, updateData *SettingUpdate) error DeleteById(ctx context.Context, id int32, opts ...Option) error FindById(ctx context.Context, id int32, opts ...Option) (*Setting, error) }
SettingCRUDOperations is an interface for managing the settings table.
type SettingFilters ¶
SettingFilters is a struct that holds filters for Setting.
type SettingPaginationOperations ¶
type SettingPaginationOperations interface {
FindManyWithPagination(ctx context.Context, limit int, page int, builders ...*QueryBuilder) ([]*Setting, *Paginator, error)
}
SettingPaginationOperations is an interface for pagination operations.
type SettingRawQueryOperations ¶
type SettingRawQueryOperations interface { Query(ctx context.Context, query string, args ...interface{}) (sql.Result, error) QueryRow(ctx context.Context, query string, args ...interface{}) *sql.Row QueryRows(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) }
SettingRawQueryOperations is an interface for executing raw queries.
type SettingRelationLoading ¶
type SettingRelationLoading interface { LoadUser(ctx context.Context, model *Setting, builders ...*QueryBuilder) error LoadBatchUser(ctx context.Context, items []*Setting, builders ...*QueryBuilder) error }
SettingRelationLoading is an interface for loading relations.
type SettingSearchOperations ¶
type SettingSearchOperations interface { FindMany(ctx context.Context, builder ...*QueryBuilder) ([]*Setting, error) FindOne(ctx context.Context, builders ...*QueryBuilder) (*Setting, error) Count(ctx context.Context, builders ...*QueryBuilder) (int64, error) SelectForUpdate(ctx context.Context, builders ...*QueryBuilder) (*Setting, error) }
SettingSearchOperations is an interface for searching the settings table.
type SettingStorage ¶
type SettingStorage interface { SettingTableManager SettingCRUDOperations SettingSearchOperations SettingPaginationOperations SettingRelationLoading SettingAdvancedDeletion SettingRawQueryOperations }
SettingStorage is a struct for the "settings" table.
func NewSettingStorage ¶
func NewSettingStorage(db *sql.DB) SettingStorage
NewSettingStorage returns a new settingStorage.
type SettingTableManager ¶
type SettingTableManager interface { CreateTable(ctx context.Context) error DropTable(ctx context.Context) error TruncateTable(ctx context.Context) error UpgradeTable(ctx context.Context) error }
SettingTableManager is an interface for managing the settings table.
type SettingUpdate ¶
SettingUpdate is used to update an existing Setting.
type TxManager ¶
type TxManager struct {
// contains filtered or unexported fields
}
TxManager is a transaction manager.
func NewTxManager ¶
NewTxManager creates a new transaction manager.
func (*TxManager) ExecFuncWithTx ¶
ExecFuncWithTx executes a function with a transaction.
type User ¶
type User struct { Id string `db:"id"` Name string `db:"name"` Age int32 `db:"age"` Email string `db:"email"` LastName *string `db:"last_name"` Device *Device Settings *Setting Addresses []*Address Posts []*Post CreatedAt string `db:"created_at"` UpdatedAt *string `db:"updated_at"` NotificationSettings *UserNotificationSetting `db:"notification_settings"` Phones UserPhonesRepeated `db:"phones"` Balls UserBallsRepeated `db:"balls"` Numrs UserNumrsRepeated `db:"numrs"` Comments UserCommentsRepeated `db:"comments"` }
User is a struct for the "users" table.
type UserAdvancedDeletion ¶
type UserAdvancedDeletion interface {
DeleteMany(ctx context.Context, builders ...*QueryBuilder) error
}
UserAdvancedDeletion is an interface for advanced deletion operations.
type UserBallsRepeated ¶
type UserBallsRepeated []int32
UserBallsRepeated is a JSON type nested in another message.
func NewBallsField ¶
func NewBallsField(v []int32) UserBallsRepeated
NewBallsField returns a new UserBallsRepeated.
func (UserBallsRepeated) Get ¶
func (m UserBallsRepeated) Get() []int32
Get returns the value of the field.
func (*UserBallsRepeated) Scan ¶
func (m *UserBallsRepeated) Scan(src interface{}) error
Scan implements the sql.Scanner interface for JSON.
func (*UserBallsRepeated) String ¶
func (m *UserBallsRepeated) String() string
type UserCRUDOperations ¶
type UserCRUDOperations interface { Create(ctx context.Context, model *User, opts ...Option) (*string, error) Update(ctx context.Context, id string, updateData *UserUpdate) error DeleteById(ctx context.Context, id string, opts ...Option) error FindById(ctx context.Context, id string, opts ...Option) (*User, error) }
UserCRUDOperations is an interface for managing the users table.
type UserComment ¶
type UserComment struct { Name string `json:"name"` Meta *CommentMeta `json:"meta"` }
Comment is a JSON type nested in another message.
func (*UserComment) Scan ¶
func (m *UserComment) Scan(src interface{}) error
Scan implements the sql.Scanner interface for JSON.
type UserCommentsRepeated ¶
type UserCommentsRepeated []UserComment
UserCommentsRepeated is a JSON type nested in another message.
func NewCommentsField ¶
func NewCommentsField(v []UserComment) UserCommentsRepeated
NewCommentsField returns a new UserCommentsRepeated.
func (UserCommentsRepeated) Get ¶
func (m UserCommentsRepeated) Get() []UserComment
Get returns the value of the field.
func (*UserCommentsRepeated) Scan ¶
func (m *UserCommentsRepeated) Scan(src interface{}) error
Scan implements the sql.Scanner interface for JSON.
func (*UserCommentsRepeated) String ¶
func (m *UserCommentsRepeated) String() string
type UserFilters ¶
UserFilters is a struct that holds filters for User.
type UserNotificationSetting ¶
type UserNotificationSetting struct { RegistrationEmail bool `json:"registration_email"` OrderEmail bool `json:"order_email"` }
NotificationSetting is a JSON type nested in another message.
func (*UserNotificationSetting) Scan ¶
func (m *UserNotificationSetting) Scan(src interface{}) error
Scan implements the sql.Scanner interface for JSON.
type UserNumr ¶
type UserNumr struct { Street string `json:"street"` City string `json:"city"` State int32 `json:"state"` Zip int64 `json:"zip"` }
Numr is a JSON type nested in another message.
type UserNumrsRepeated ¶
type UserNumrsRepeated []UserNumr
UserNumrsRepeated is a JSON type nested in another message.
func NewNumrsField ¶
func NewNumrsField(v []UserNumr) UserNumrsRepeated
NewNumrsField returns a new UserNumrsRepeated.
func (UserNumrsRepeated) Get ¶
func (m UserNumrsRepeated) Get() []UserNumr
Get returns the value of the field.
func (*UserNumrsRepeated) Scan ¶
func (m *UserNumrsRepeated) Scan(src interface{}) error
Scan implements the sql.Scanner interface for JSON.
func (*UserNumrsRepeated) String ¶
func (m *UserNumrsRepeated) String() string
type UserPaginationOperations ¶
type UserPaginationOperations interface {
FindManyWithPagination(ctx context.Context, limit int, page int, builders ...*QueryBuilder) ([]*User, *Paginator, error)
}
UserPaginationOperations is an interface for pagination operations.
type UserPhonesRepeated ¶
type UserPhonesRepeated []string
UserPhonesRepeated is a JSON type nested in another message.
func NewPhonesField ¶
func NewPhonesField(v []string) UserPhonesRepeated
NewPhonesField returns a new UserPhonesRepeated.
func (UserPhonesRepeated) Get ¶
func (m UserPhonesRepeated) Get() []string
Get returns the value of the field.
func (*UserPhonesRepeated) Scan ¶
func (m *UserPhonesRepeated) Scan(src interface{}) error
Scan implements the sql.Scanner interface for JSON.
func (*UserPhonesRepeated) String ¶
func (m *UserPhonesRepeated) String() string
type UserRawQueryOperations ¶
type UserRawQueryOperations interface { Query(ctx context.Context, query string, args ...interface{}) (sql.Result, error) QueryRow(ctx context.Context, query string, args ...interface{}) *sql.Row QueryRows(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) }
UserRawQueryOperations is an interface for executing raw queries.
type UserRelationLoading ¶
type UserRelationLoading interface { LoadDevice(ctx context.Context, model *User, builders ...*QueryBuilder) error LoadSettings(ctx context.Context, model *User, builders ...*QueryBuilder) error LoadAddresses(ctx context.Context, model *User, builders ...*QueryBuilder) error LoadPosts(ctx context.Context, model *User, builders ...*QueryBuilder) error LoadBatchDevice(ctx context.Context, items []*User, builders ...*QueryBuilder) error LoadBatchSettings(ctx context.Context, items []*User, builders ...*QueryBuilder) error LoadBatchAddresses(ctx context.Context, items []*User, builders ...*QueryBuilder) error LoadBatchPosts(ctx context.Context, items []*User, builders ...*QueryBuilder) error }
UserRelationLoading is an interface for loading relations.
type UserSearchOperations ¶
type UserSearchOperations interface { FindMany(ctx context.Context, builder ...*QueryBuilder) ([]*User, error) FindOne(ctx context.Context, builders ...*QueryBuilder) (*User, error) Count(ctx context.Context, builders ...*QueryBuilder) (int64, error) SelectForUpdate(ctx context.Context, builders ...*QueryBuilder) (*User, error) }
UserSearchOperations is an interface for searching the users table.
type UserStorage ¶
type UserStorage interface { UserTableManager UserCRUDOperations UserSearchOperations UserPaginationOperations UserRelationLoading UserAdvancedDeletion UserRawQueryOperations }
UserStorage is a struct for the "users" table.
func NewUserStorage ¶
func NewUserStorage(db *sql.DB) UserStorage
NewUserStorage returns a new userStorage.
type UserTableManager ¶
type UserTableManager interface { CreateTable(ctx context.Context) error DropTable(ctx context.Context) error TruncateTable(ctx context.Context) error UpgradeTable(ctx context.Context) error }
UserTableManager is an interface for managing the users table.
type UserUpdate ¶
type UserUpdate struct { Name *string Age *int32 Email *string LastName *string CreatedAt *string UpdatedAt *string NotificationSettings *UserNotificationSetting Phones *UserPhonesRepeated Balls *UserBallsRepeated Numrs *UserNumrsRepeated Comments *UserCommentsRepeated }
UserUpdate is used to update an existing User.