storepb

package
v0.4.14 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CurrencyConstraintPkey                 = "currency_pkey"
	UserConstraintPkey                     = "users_pkey"
	UserConstraintEmailKey                 = "users_email_key"
	UserConstraintEmailIdx                 = "idx_users_email"
	ProfileConstraintPkey                  = "profiles_pkey"
	ProfileConstraintUserIdIdx             = "idx_profiles_user_id"
	CategoryConstraintPkey                 = "categories_pkey"
	CategoryConstraintSlugKey              = "categories_slug_key"
	TagConstraintPkey                      = "tags_pkey"
	TagConstraintSlugKey                   = "tags_slug_key"
	ProductConstraintPkey                  = "products_pkey"
	ProductConstraintSkuKey                = "products_sku_key"
	ProductConstraintCheck                 = "products_check"
	OrderConstraintPkey                    = "orders_pkey"
	OrderConstraintCheck                   = "orders_check"
	OrderItemConstraintOrderIdProductIdKey = "order_items_order_id_product_id_key"
	OrderItemConstraintPkey                = "order_items_pkey"
	OrderItemConstraintCheck               = "order_items_check"
	OrderItemConstraintCheck1              = "order_items_check1"
	UserSettingsConstraintPkey             = "user_settings_pkey"
	AuditLogConstraintPkey                 = "audit_logs_pkey"
	UserPreferencesConstraintPkey          = "user_preferences_pkey"
)

Variables

View Source
var (
	ErrCurrencyPrimaryKey              = errors.New("primary key constraint violated: currency_pkey")
	ErrUserPrimaryKey                  = errors.New("primary key constraint violated: users_pkey")
	ErrUserEmailUnique                 = errors.New("unique constraint violated: users_email_key")
	ErrUserEmailUniqueIdx              = errors.New("unique constraint violated: idx_users_email")
	ErrProfilePrimaryKey               = errors.New("primary key constraint violated: profiles_pkey")
	ErrProfileUserIdUniqueIdx          = errors.New("unique constraint violated: idx_profiles_user_id")
	ErrCategoryPrimaryKey              = errors.New("primary key constraint violated: categories_pkey")
	ErrCategorySlugUnique              = errors.New("unique constraint violated: categories_slug_key")
	ErrTagPrimaryKey                   = errors.New("primary key constraint violated: tags_pkey")
	ErrTagSlugUnique                   = errors.New("unique constraint violated: tags_slug_key")
	ErrProductPrimaryKey               = errors.New("primary key constraint violated: products_pkey")
	ErrProductSkuUnique                = errors.New("unique constraint violated: products_sku_key")
	ErrProductCheck                    = errors.New("check constraint violated: products_check")
	ErrOrderPrimaryKey                 = errors.New("primary key constraint violated: orders_pkey")
	ErrOrderCheck                      = errors.New("check constraint violated: orders_check")
	ErrOrderItemOrderIdProductIdUnique = errors.New("unique constraint violated: order_items_order_id_product_id_key")
	ErrOrderItemPrimaryKey             = errors.New("primary key constraint violated: order_items_pkey")
	ErrOrderItemCheck                  = errors.New("check constraint violated: order_items_check")
	ErrOrderItemCheck1                 = errors.New("check constraint violated: order_items_check1")
	ErrUserSettingsPrimaryKey          = errors.New("primary key constraint violated: user_settings_pkey")
	ErrAuditLogPrimaryKey              = errors.New("primary key constraint violated: audit_logs_pkey")
	ErrUserPreferencesPrimaryKey       = errors.New("primary key constraint violated: user_preferences_pkey")
)
View Source
var AdditionalSQL = []ddl.SchemaSqler{
	ddl.RawSQL("CREATE EXTENSION IF NOT EXISTS pg_trgm"),
	ddl.RawSQL("CREATE OR REPLACE FUNCTION store.set_updated_at() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN NEW.updated_at = now(); RETURN NEW; END; $$"),
}

AdditionalSQL contains raw SQL statements declared via additional_code file option. Pass these to ddl.SchemaSQL() alongside table definitions.

View Source
var AuditLogConverter = repository.Converter[*AuditLogScanner, *AuditLog]{
	ToScanner: (*AuditLog).IntoPlain,
	ToProto:   (*AuditLogScanner).IntoPb,
}

AuditLogConverter provides conversion between AuditLog and AuditLogScanner

View Source
var AuditLogs = func() AuditLogsTable {
	idCol := schema.BigSerialColumn(AuditLogColumnId, ddl.WithPrimaryKey[AuditLogColumnAlias]())
	actionCol := schema.TextColumn(AuditLogColumnAction, ddl.WithNotNull[AuditLogColumnAlias]())
	entityTypeCol := schema.TextColumn(AuditLogColumnEntityType, ddl.WithNotNull[AuditLogColumnAlias]())
	entityIdCol := schema.BigIntColumn(AuditLogColumnEntityId, ddl.WithNotNull[AuditLogColumnAlias]())
	tagsCol := schema.TextArrayColumn(AuditLogColumnTags, ddl.WithNotNull[AuditLogColumnAlias]())
	relatedIdsCol := schema.BigIntArrayColumn(AuditLogColumnRelatedIds, ddl.WithNotNull[AuditLogColumnAlias]())
	dbCreatedAtCol := schema.TimestamptzColumn(AuditLogColumnDbCreatedAt, ddl.WithDefault[AuditLogColumnAlias]("now()"), ddl.WithNotNull[AuditLogColumnAlias]())
	dbUpdatedAtCol := schema.TimestamptzColumn(AuditLogColumnDbUpdatedAt, ddl.WithDefault[AuditLogColumnAlias]("now()"), ddl.WithNotNull[AuditLogColumnAlias]())

	return AuditLogsTable{
		Table: schema.NewTable[AuditLogAlias, AuditLogColumnAlias, *AuditLogScanner](
			AuditLogAliasName,
			func() *AuditLogScanner { return &AuditLogScanner{} },
			[]*ddl.ColumnDDL[AuditLogColumnAlias]{
				idCol.DDL(),
				actionCol.DDL(),
				entityTypeCol.DDL(),
				entityIdCol.DDL(),
				tagsCol.DDL(),
				relatedIdsCol.DDL(),
				dbCreatedAtCol.DDL(),
				dbUpdatedAtCol.DDL(),
			},
			ddl.WithSchema[AuditLogAlias, AuditLogColumnAlias]("store"),
		),
		Id:          idCol,
		Action:      actionCol,
		EntityType:  entityTypeCol,
		EntityId:    entityIdCol,
		Tags:        tagsCol,
		RelatedIds:  relatedIdsCol,
		DbCreatedAt: dbCreatedAtCol,
		DbUpdatedAt: dbUpdatedAtCol,
	}
}()

AuditLogs is the global audit_logs table instance

AuditLogsRef is a reference to the audit_logs table for relations

View Source
var CategoryConverter = repository.Converter[*CategoryScanner, *Category]{
	ToScanner: (*Category).IntoPlain,
	ToProto:   (*CategoryScanner).IntoPb,
}

CategoryConverter provides conversion between Category and CategoryScanner

View Source
var Categorys = func() CategorysTable {
	idCol := schema.BigSerialColumn(CategoryColumnId, ddl.WithPrimaryKey[CategoryColumnAlias]())
	createdAtCol := schema.TimestamptzColumn(CategoryColumnCreatedAt, ddl.WithDefault[CategoryColumnAlias]("now()"), ddl.WithNotNull[CategoryColumnAlias]())
	updatedAtCol := schema.TimestamptzColumn(CategoryColumnUpdatedAt, ddl.WithDefault[CategoryColumnAlias]("now()"), ddl.WithNotNull[CategoryColumnAlias]())
	nameCol := schema.TextColumn(CategoryColumnName, ddl.WithNotNull[CategoryColumnAlias]())
	slugCol := schema.TextColumn(CategoryColumnSlug, ddl.WithUnique[CategoryColumnAlias](), ddl.WithNotNull[CategoryColumnAlias]())
	parentIdCol := schema.NullBigIntColumn(CategoryColumnParentId, ddl.WithReferences[CategoryColumnAlias]("\"store\".\"categories\"", "id"), ddl.WithOnDelete[CategoryColumnAlias]("SET NULL"))

	return CategorysTable{
		Table: schema.NewTable[CategoryAlias, CategoryColumnAlias, *CategoryScanner](
			CategoryAliasName,
			func() *CategoryScanner { return &CategoryScanner{} },
			[]*ddl.ColumnDDL[CategoryColumnAlias]{
				idCol.DDL(),
				createdAtCol.DDL(),
				updatedAtCol.DDL(),
				nameCol.DDL(),
				slugCol.DDL(),
				parentIdCol.DDL(),
			},
			ddl.WithSchema[CategoryAlias, CategoryColumnAlias]("store"),
		),
		Id:        idCol,
		CreatedAt: createdAtCol,
		UpdatedAt: updatedAtCol,
		Name:      nameCol,
		Slug:      slugCol,
		ParentId:  parentIdCol,
	}
}()

Categorys is the global categories table instance

CategorysRef is a reference to the categories table for relations

View Source
var CurrencyConverter = repository.Converter[*CurrencyScanner, *Currency]{
	ToScanner: (*Currency).IntoPlain,
	ToProto:   (*CurrencyScanner).IntoPb,
}

CurrencyConverter provides conversion between Currency and CurrencyScanner

Currencys is the global currency table instance

CurrencysRef is a reference to the currency table for relations

View Source
var File_examples_proto_store_proto protoreflect.FileDescriptor
View Source
var OrderConverter = repository.Converter[*OrderScanner, *Order]{
	ToScanner: (*Order).IntoPlain,
	ToProto:   (*OrderScanner).IntoPb,
}

OrderConverter provides conversion between Order and OrderScanner

OrderCurrency defines the belongs-to relationship: Order belongs to Currency

View Source
var OrderItemConverter = repository.Converter[*OrderItemScanner, *OrderItem]{
	ToScanner: (*OrderItem).IntoPlain,
	ToProto:   (*OrderItemScanner).IntoPb,
}

OrderItemConverter provides conversion between OrderItem and OrderItemScanner

OrderItemOrder defines the belongs-to relationship: OrderItem belongs to Order

OrderItemProduct defines the belongs-to relationship: OrderItem belongs to Product

View Source
var OrderItems = func() OrderItemsTable {
	orderIdCol := schema.BigIntColumn(OrderItemColumnOrderId, ddl.WithReferences[OrderItemColumnAlias]("\"store\".\"orders\"", "id"), ddl.WithOnDelete[OrderItemColumnAlias]("CASCADE"), ddl.WithNotNull[OrderItemColumnAlias]())
	lineNoCol := schema.IntegerColumn(OrderItemColumnLineNo, ddl.WithNotNull[OrderItemColumnAlias]())
	productIdCol := schema.BigIntColumn(OrderItemColumnProductId, ddl.WithReferences[OrderItemColumnAlias]("\"store\".\"products\"", "id"), ddl.WithOnDelete[OrderItemColumnAlias]("RESTRICT"), ddl.WithNotNull[OrderItemColumnAlias]())
	qtyCol := schema.IntegerColumn(OrderItemColumnQty, ddl.WithNotNull[OrderItemColumnAlias]())
	unitPriceCol := schema.DoublePrecisionColumn(OrderItemColumnUnitPrice, ddl.WithNotNull[OrderItemColumnAlias]())

	return OrderItemsTable{
		Table: schema.NewTable[OrderItemAlias, OrderItemColumnAlias, *OrderItemScanner](
			OrderItemAliasName,
			func() *OrderItemScanner { return &OrderItemScanner{} },
			[]*ddl.ColumnDDL[OrderItemColumnAlias]{
				orderIdCol.DDL(),
				lineNoCol.DDL(),
				productIdCol.DDL(),
				qtyCol.DDL(),
				unitPriceCol.DDL(),
			},
			ddl.WithUniqueColumns[OrderItemAlias, OrderItemColumnAlias](
				[]OrderItemColumnAlias{OrderItemColumnOrderId, OrderItemColumnProductId},
			),
			ddl.WithPrimaryKeyColumns[OrderItemAlias, OrderItemColumnAlias]([]OrderItemColumnAlias{OrderItemColumnOrderId, OrderItemColumnLineNo}),
			ddl.WithSchema[OrderItemAlias, OrderItemColumnAlias]("store"),
			ddl.WithPostStatements[OrderItemAlias, OrderItemColumnAlias](
				"ALTER TABLE {table} ENABLE ROW LEVEL SECURITY",
				"CREATE POLICY order_items_own_data ON {table} FOR ALL USING (order_id IN (SELECT o.id FROM \"store\".\"orders\" o WHERE o.user_id = current_setting('app.current_user_id')::bigint))",
			),
		),
		OrderId:   orderIdCol,
		LineNo:    lineNoCol,
		ProductId: productIdCol,
		Qty:       qtyCol,
		UnitPrice: unitPriceCol,
	}
}()

OrderItems is the global order_items table instance

OrderItemsRef is a reference to the order_items table for relations

OrderOrderItems defines the one-to-many relationship: Order has many OrderItem

OrderUser defines the belongs-to relationship: Order belongs to User

View Source
var Orders = func() OrdersTable {
	idCol := schema.BigSerialColumn(OrderColumnId, ddl.WithPrimaryKey[OrderColumnAlias]())
	createdAtCol := schema.TimestamptzColumn(OrderColumnCreatedAt, ddl.WithDefault[OrderColumnAlias]("now()"), ddl.WithNotNull[OrderColumnAlias]())
	updatedAtCol := schema.TimestamptzColumn(OrderColumnUpdatedAt, ddl.WithDefault[OrderColumnAlias]("now()"), ddl.WithNotNull[OrderColumnAlias]())
	userIdCol := schema.BigIntColumn(OrderColumnUserId, ddl.WithReferences[OrderColumnAlias]("\"store\".\"users\"", "id"), ddl.WithOnDelete[OrderColumnAlias]("CASCADE"), ddl.WithNotNull[OrderColumnAlias]())
	statusCol := schema.TextColumn(OrderColumnStatus, ddl.WithDefault[OrderColumnAlias]("'NEW'"), ddl.WithNotNull[OrderColumnAlias]())
	currencyCol := schema.TextColumn(OrderColumnCurrency, ddl.WithReferences[OrderColumnAlias]("currency", "code"), ddl.WithOnDelete[OrderColumnAlias]("RESTRICT"), ddl.WithNotNull[OrderColumnAlias]())

	idx0 := ddl.NewIndex[OrderAlias, OrderColumnAlias]("idx_orders_user_id", OrderAliasName).OnColumns(OrderColumnUserId)
	idx1 := ddl.NewIndex[OrderAlias, OrderColumnAlias]("idx_orders_status", OrderAliasName).OnColumns(OrderColumnStatus)
	idx2 := ddl.NewIndex[OrderAlias, OrderColumnAlias]("idx_orders_created_at", OrderAliasName).OnColumns(OrderColumnCreatedAt)

	return OrdersTable{
		Table: schema.NewTable[OrderAlias, OrderColumnAlias, *OrderScanner](
			OrderAliasName,
			func() *OrderScanner { return &OrderScanner{} },
			[]*ddl.ColumnDDL[OrderColumnAlias]{
				idCol.DDL(),
				createdAtCol.DDL(),
				updatedAtCol.DDL(),
				userIdCol.DDL(),
				statusCol.DDL(),
				currencyCol.DDL(),
			},
			ddl.WithIndexes[OrderAlias, OrderColumnAlias](
				idx0,
				idx1,
				idx2,
			),
			ddl.WithSchema[OrderAlias, OrderColumnAlias]("store"),
			ddl.WithPostStatements[OrderAlias, OrderColumnAlias](
				"ALTER TABLE {table} ENABLE ROW LEVEL SECURITY",
				"CREATE POLICY orders_own_data ON {table} FOR ALL USING (user_id = current_setting('app.current_user_id')::bigint)",
			),
		),
		Id:        idCol,
		CreatedAt: createdAtCol,
		UpdatedAt: updatedAtCol,
		UserId:    userIdCol,
		Status:    statusCol,
		Currency:  currencyCol,
	}
}()

Orders is the global orders table instance

OrdersRef is a reference to the orders table for relations

View Source
var ProductConverter = repository.Converter[*ProductScanner, *Product]{
	ToScanner: (*Product).IntoPlain,
	ToProto:   (*ProductScanner).IntoPb,
}

ProductConverter provides conversion between Product and ProductScanner

View Source
var Products = func() ProductsTable {
	idCol := schema.BigSerialColumn(ProductColumnId, ddl.WithPrimaryKey[ProductColumnAlias]())
	createdAtCol := schema.TimestamptzColumn(ProductColumnCreatedAt, ddl.WithDefault[ProductColumnAlias]("now()"), ddl.WithNotNull[ProductColumnAlias]())
	updatedAtCol := schema.TimestamptzColumn(ProductColumnUpdatedAt, ddl.WithDefault[ProductColumnAlias]("now()"), ddl.WithNotNull[ProductColumnAlias]())
	skuCol := schema.TextColumn(ProductColumnSku, ddl.WithUnique[ProductColumnAlias](), ddl.WithNotNull[ProductColumnAlias]())
	nameCol := schema.TextColumn(ProductColumnName, ddl.WithNotNull[ProductColumnAlias]())
	priceCol := schema.DoublePrecisionColumn(ProductColumnPrice, ddl.WithNotNull[ProductColumnAlias]())
	currencyCol := schema.TextColumn(ProductColumnCurrency, ddl.WithReferences[ProductColumnAlias]("currency", "code"), ddl.WithOnDelete[ProductColumnAlias]("RESTRICT"), ddl.WithNotNull[ProductColumnAlias]())
	stockQtyCol := schema.IntegerColumn(ProductColumnStockQty, ddl.WithDefault[ProductColumnAlias]("0"), ddl.WithNotNull[ProductColumnAlias]())
	isDeletedCol := schema.BooleanColumn(ProductColumnIsDeleted, ddl.WithDefault[ProductColumnAlias]("false"), ddl.WithNotNull[ProductColumnAlias]())

	idx0 := ddl.NewIndex[ProductAlias, ProductColumnAlias]("idx_products_sku", ProductAliasName).OnColumns(ProductColumnSku)
	idx1 := ddl.NewIndex[ProductAlias, ProductColumnAlias]("idx_products_currency", ProductAliasName).OnColumns(ProductColumnCurrency)
	idx2 := ddl.NewIndex[ProductAlias, ProductColumnAlias]("idx_products_is_deleted_created_at", ProductAliasName).OnColumns(ProductColumnIsDeleted, ProductColumnCreatedAt)
	idx2 = idx2.Where("is_deleted = false")

	return ProductsTable{
		Table: schema.NewTable[ProductAlias, ProductColumnAlias, *ProductScanner](
			ProductAliasName,
			func() *ProductScanner { return &ProductScanner{} },
			[]*ddl.ColumnDDL[ProductColumnAlias]{
				idCol.DDL(),
				createdAtCol.DDL(),
				updatedAtCol.DDL(),
				skuCol.DDL(),
				nameCol.DDL(),
				priceCol.DDL(),
				currencyCol.DDL(),
				stockQtyCol.DDL(),
				isDeletedCol.DDL(),
			},
			ddl.WithIndexes[ProductAlias, ProductColumnAlias](
				idx0,
				idx1,
				idx2,
			),
			ddl.WithSchema[ProductAlias, ProductColumnAlias]("store"),
		),
		Id:        idCol,
		CreatedAt: createdAtCol,
		UpdatedAt: updatedAtCol,
		Sku:       skuCol,
		Name:      nameCol,
		Price:     priceCol,
		Currency:  currencyCol,
		StockQty:  stockQtyCol,
		IsDeleted: isDeletedCol,
	}
}()

Products is the global products table instance

ProductsRef is a reference to the products table for relations

View Source
var ProfileConverter = repository.Converter[*ProfileScanner, *Profile]{
	ToScanner: (*Profile).IntoPlain,
	ToProto:   (*ProfileScanner).IntoPb,
}

ProfileConverter provides conversion between Profile and ProfileScanner

ProfileUser defines the belongs-to relationship: Profile belongs to User

View Source
var Profiles = func() ProfilesTable {
	idCol := schema.BigSerialColumn(ProfileColumnId, ddl.WithPrimaryKey[ProfileColumnAlias]())
	createdAtCol := schema.TimestamptzColumn(ProfileColumnCreatedAt, ddl.WithDefault[ProfileColumnAlias]("now()"), ddl.WithNotNull[ProfileColumnAlias]())
	updatedAtCol := schema.TimestamptzColumn(ProfileColumnUpdatedAt, ddl.WithDefault[ProfileColumnAlias]("now()"), ddl.WithNotNull[ProfileColumnAlias]())
	userIdCol := schema.BigIntColumn(ProfileColumnUserId, ddl.WithReferences[ProfileColumnAlias]("\"store\".\"users\"", "id"), ddl.WithOnDelete[ProfileColumnAlias]("CASCADE"), ddl.WithNotNull[ProfileColumnAlias]())
	bioCol := schema.TextColumn(ProfileColumnBio, ddl.WithNotNull[ProfileColumnAlias]())
	avatarUrlCol := schema.TextColumn(ProfileColumnAvatarUrl, ddl.WithNotNull[ProfileColumnAlias]())

	idx0 := ddl.NewIndex[ProfileAlias, ProfileColumnAlias]("idx_profiles_user_id", ProfileAliasName).OnColumns(ProfileColumnUserId)
	idx0 = idx0.Unique()

	return ProfilesTable{
		Table: schema.NewTable[ProfileAlias, ProfileColumnAlias, *ProfileScanner](
			ProfileAliasName,
			func() *ProfileScanner { return &ProfileScanner{} },
			[]*ddl.ColumnDDL[ProfileColumnAlias]{
				idCol.DDL(),
				createdAtCol.DDL(),
				updatedAtCol.DDL(),
				userIdCol.DDL(),
				bioCol.DDL(),
				avatarUrlCol.DDL(),
			},
			ddl.WithIndexes[ProfileAlias, ProfileColumnAlias](
				idx0,
			),
			ddl.WithSchema[ProfileAlias, ProfileColumnAlias]("store"),
			ddl.WithPostStatements[ProfileAlias, ProfileColumnAlias](
				"ALTER TABLE {table} ENABLE ROW LEVEL SECURITY",
				"CREATE POLICY profiles_own_data ON {table} FOR ALL USING (user_id = current_setting('app.current_user_id')::bigint)",
			),
		),
		Id:        idCol,
		CreatedAt: createdAtCol,
		UpdatedAt: updatedAtCol,
		UserId:    userIdCol,
		Bio:       bioCol,
		AvatarUrl: avatarUrlCol,
	}
}()

Profiles is the global profiles table instance

ProfilesRef is a reference to the profiles table for relations

View Source
var TagConverter = repository.Converter[*TagScanner, *Tag]{
	ToScanner: (*Tag).IntoPlain,
	ToProto:   (*TagScanner).IntoPb,
}

TagConverter provides conversion between Tag and TagScanner

View Source
var Tags = func() TagsTable {
	idCol := schema.BigSerialColumn(TagColumnId, ddl.WithPrimaryKey[TagColumnAlias]())
	createdAtCol := schema.TimestamptzColumn(TagColumnCreatedAt, ddl.WithDefault[TagColumnAlias]("now()"), ddl.WithNotNull[TagColumnAlias]())
	updatedAtCol := schema.TimestamptzColumn(TagColumnUpdatedAt, ddl.WithDefault[TagColumnAlias]("now()"), ddl.WithNotNull[TagColumnAlias]())
	nameCol := schema.TextColumn(TagColumnName, ddl.WithNotNull[TagColumnAlias]())
	slugCol := schema.TextColumn(TagColumnSlug, ddl.WithUnique[TagColumnAlias](), ddl.WithNotNull[TagColumnAlias]())

	return TagsTable{
		Table: schema.NewTable[TagAlias, TagColumnAlias, *TagScanner](
			TagAliasName,
			func() *TagScanner { return &TagScanner{} },
			[]*ddl.ColumnDDL[TagColumnAlias]{
				idCol.DDL(),
				createdAtCol.DDL(),
				updatedAtCol.DDL(),
				nameCol.DDL(),
				slugCol.DDL(),
			},
		),
		Id:        idCol,
		CreatedAt: createdAtCol,
		UpdatedAt: updatedAtCol,
		Name:      nameCol,
		Slug:      slugCol,
	}
}()

Tags is the global tags table instance

TagsRef is a reference to the tags table for relations

View Source
var UserConverter = repository.Converter[*UserScanner, *User]{
	ToScanner: (*User).IntoPlain,
	ToProto:   (*UserScanner).IntoPb,
}

UserConverter provides conversion between User and UserScanner

UserOrders defines the one-to-many relationship: User has many Order

View Source
var UserPreferencesConverter = repository.Converter[*UserPreferencesScanner, *UserPreferences]{
	ToScanner: (*UserPreferences).IntoPlain,
	ToProto:   (*UserPreferencesScanner).IntoPb,
}

UserPreferencesConverter provides conversion between UserPreferences and UserPreferencesScanner

UserPreferencess is the global user_preferences table instance

UserPreferencessRef is a reference to the user_preferences table for relations

UserProfile defines the one-to-one relationship: User has one Profile

View Source
var UserSettingsConverter = repository.Converter[*UserSettingsScanner, *UserSettings]{
	ToScanner: (*UserSettings).IntoPlain,
	ToProto:   (*UserSettingsScanner).IntoPb,
}

UserSettingsConverter provides conversion between UserSettings and UserSettingsScanner

UserSettingss is the global user_settings table instance

UserSettingssRef is a reference to the user_settings table for relations

View Source
var Users = func() UsersTable {
	idCol := schema.BigSerialColumn(UserColumnId, ddl.WithPrimaryKey[UserColumnAlias]())
	createdAtCol := schema.TimestamptzColumn(UserColumnCreatedAt, ddl.WithDefault[UserColumnAlias]("now()"), ddl.WithNotNull[UserColumnAlias]())
	updatedAtCol := schema.TimestamptzColumn(UserColumnUpdatedAt, ddl.WithDefault[UserColumnAlias]("now()"), ddl.WithNotNull[UserColumnAlias]())
	emailCol := schema.TextColumn(UserColumnEmail, ddl.WithUnique[UserColumnAlias](), ddl.WithNotNull[UserColumnAlias]())
	fullNameCol := schema.TextColumn(UserColumnFullName, ddl.WithNotNull[UserColumnAlias]())
	isActiveCol := schema.BooleanColumn(UserColumnIsActive, ddl.WithDefault[UserColumnAlias]("true"), ddl.WithNotNull[UserColumnAlias]())
	emailConfirmedAtCol := schema.NullTimestamptzColumn(UserColumnEmailConfirmedAt)
	nicknameCol := schema.NullTextColumn(UserColumnNickname)
	deletedAtCol := schema.NullTimestamptzColumn(UserColumnDeletedAt)

	idx0 := ddl.NewIndex[UserAlias, UserColumnAlias]("idx_users_email", UserAliasName).OnColumns(UserColumnEmail)
	idx0 = idx0.Unique()
	idx1 := ddl.NewIndex[UserAlias, UserColumnAlias]("idx_users_is_active_created_at", UserAliasName).OnColumns(UserColumnIsActive, UserColumnCreatedAt)

	return UsersTable{
		Table: schema.NewTable[UserAlias, UserColumnAlias, *UserScanner](
			UserAliasName,
			func() *UserScanner { return &UserScanner{} },
			[]*ddl.ColumnDDL[UserColumnAlias]{
				idCol.DDL(),
				createdAtCol.DDL(),
				updatedAtCol.DDL(),
				emailCol.DDL(),
				fullNameCol.DDL(),
				isActiveCol.DDL(),
				emailConfirmedAtCol.DDL(),
				nicknameCol.DDL(),
				deletedAtCol.DDL(),
			},
			ddl.WithIndexes[UserAlias, UserColumnAlias](
				idx0,
				idx1,
			),
			ddl.WithSchema[UserAlias, UserColumnAlias]("store"),
			ddl.WithPostStatements[UserAlias, UserColumnAlias](
				"ALTER TABLE {table} ENABLE ROW LEVEL SECURITY",
				"CREATE POLICY users_own_data ON {table} FOR ALL USING (id = current_setting('app.current_user_id')::bigint)",
				"CREATE POLICY users_insert ON {table} FOR INSERT WITH CHECK (true)",
			),
		),
		Id:               idCol,
		CreatedAt:        createdAtCol,
		UpdatedAt:        updatedAtCol,
		Email:            emailCol,
		FullName:         fullNameCol,
		IsActive:         isActiveCol,
		EmailConfirmedAt: emailConfirmedAtCol,
		Nickname:         nicknameCol,
		DeletedAt:        deletedAtCol,
	}
}()

Users is the global users table instance

UsersRef is a reference to the users table for relations

Functions

func IsAuditLogPrimaryKeyError added in v0.4.8

func IsAuditLogPrimaryKeyError(err error) bool

IsAuditLogPrimaryKeyError checks if the error is a primary_key constraint violation on audit_logs

func IsCategoryPrimaryKeyError added in v0.2.0

func IsCategoryPrimaryKeyError(err error) bool

IsCategoryPrimaryKeyError checks if the error is a primary_key constraint violation on categories

func IsCategorySlugUniqueError added in v0.2.0

func IsCategorySlugUniqueError(err error) bool

IsCategorySlugUniqueError checks if the error is a unique constraint violation on categories

func IsCurrencyPrimaryKeyError added in v0.2.0

func IsCurrencyPrimaryKeyError(err error) bool

IsCurrencyPrimaryKeyError checks if the error is a primary_key constraint violation on currency

func IsOrderCheckError added in v0.2.0

func IsOrderCheckError(err error) bool

IsOrderCheckError checks if the error is a check constraint violation on orders

func IsOrderItemCheck1Error added in v0.2.0

func IsOrderItemCheck1Error(err error) bool

IsOrderItemCheck1Error checks if the error is a check constraint violation on order_items

func IsOrderItemCheckError added in v0.2.0

func IsOrderItemCheckError(err error) bool

IsOrderItemCheckError checks if the error is a check constraint violation on order_items

func IsOrderItemOrderIdProductIdUniqueError added in v0.2.0

func IsOrderItemOrderIdProductIdUniqueError(err error) bool

IsOrderItemOrderIdProductIdUniqueError checks if the error is a unique constraint violation on order_items

func IsOrderItemPrimaryKeyError added in v0.2.0

func IsOrderItemPrimaryKeyError(err error) bool

IsOrderItemPrimaryKeyError checks if the error is a primary_key constraint violation on order_items

func IsOrderPrimaryKeyError added in v0.2.0

func IsOrderPrimaryKeyError(err error) bool

IsOrderPrimaryKeyError checks if the error is a primary_key constraint violation on orders

func IsProductCheckError added in v0.2.0

func IsProductCheckError(err error) bool

IsProductCheckError checks if the error is a check constraint violation on products

func IsProductPrimaryKeyError added in v0.2.0

func IsProductPrimaryKeyError(err error) bool

IsProductPrimaryKeyError checks if the error is a primary_key constraint violation on products

func IsProductSkuUniqueError added in v0.2.0

func IsProductSkuUniqueError(err error) bool

IsProductSkuUniqueError checks if the error is a unique constraint violation on products

func IsProfilePrimaryKeyError added in v0.2.0

func IsProfilePrimaryKeyError(err error) bool

IsProfilePrimaryKeyError checks if the error is a primary_key constraint violation on profiles

func IsProfileUserIdUniqueIdxError added in v0.2.0

func IsProfileUserIdUniqueIdxError(err error) bool

IsProfileUserIdUniqueIdxError checks if the error is a unique constraint violation on profiles

func IsTagPrimaryKeyError added in v0.2.0

func IsTagPrimaryKeyError(err error) bool

IsTagPrimaryKeyError checks if the error is a primary_key constraint violation on tags

func IsTagSlugUniqueError added in v0.2.0

func IsTagSlugUniqueError(err error) bool

IsTagSlugUniqueError checks if the error is a unique constraint violation on tags

func IsUserEmailUniqueError added in v0.2.0

func IsUserEmailUniqueError(err error) bool

IsUserEmailUniqueError checks if the error is a unique constraint violation on users

func IsUserEmailUniqueIdxError added in v0.2.0

func IsUserEmailUniqueIdxError(err error) bool

IsUserEmailUniqueIdxError checks if the error is a unique constraint violation on users

func IsUserPreferencesPrimaryKeyError added in v0.4.7

func IsUserPreferencesPrimaryKeyError(err error) bool

IsUserPreferencesPrimaryKeyError checks if the error is a primary_key constraint violation on user_preferences

func IsUserPrimaryKeyError added in v0.2.0

func IsUserPrimaryKeyError(err error) bool

IsUserPrimaryKeyError checks if the error is a primary_key constraint violation on users

func IsUserSettingsPrimaryKeyError added in v0.4.7

func IsUserSettingsPrimaryKeyError(err error) bool

IsUserSettingsPrimaryKeyError checks if the error is a primary_key constraint violation on user_settings

func OrderItemsWithAllRelations added in v0.2.0

func OrderItemsWithAllRelations() exec.QueryOption[OrderItemColumnAlias, *OrderItemScanner]

OrderItemsWithAllRelations returns a QueryOption to load all relations

func OrderItemsWithOrder added in v0.2.0

func OrderItemsWithOrder() exec.QueryOption[OrderItemColumnAlias, *OrderItemScanner]

OrderItemsWithOrder returns a QueryOption to load Order relation

func OrderItemsWithProduct added in v0.2.0

func OrderItemsWithProduct() exec.QueryOption[OrderItemColumnAlias, *OrderItemScanner]

OrderItemsWithProduct returns a QueryOption to load Product relation

func OrdersWithAllRelations added in v0.2.0

func OrdersWithAllRelations() exec.QueryOption[OrderColumnAlias, *OrderScanner]

OrdersWithAllRelations returns a QueryOption to load all relations

func OrdersWithItems added in v0.2.0

func OrdersWithItems() exec.QueryOption[OrderColumnAlias, *OrderScanner]

OrdersWithItems returns a QueryOption to load Items relation

func OrdersWithMoney added in v0.2.0

func OrdersWithMoney() exec.QueryOption[OrderColumnAlias, *OrderScanner]

OrdersWithMoney returns a QueryOption to load Money relation

func OrdersWithUser added in v0.2.0

func OrdersWithUser() exec.QueryOption[OrderColumnAlias, *OrderScanner]

OrdersWithUser returns a QueryOption to load User relation

func ProfilesWithAllRelations added in v0.2.0

func ProfilesWithAllRelations() exec.QueryOption[ProfileColumnAlias, *ProfileScanner]

ProfilesWithAllRelations returns a QueryOption to load all relations

func ProfilesWithUser added in v0.2.0

func ProfilesWithUser() exec.QueryOption[ProfileColumnAlias, *ProfileScanner]

ProfilesWithUser returns a QueryOption to load User relation

func UsersWithAllRelations added in v0.2.0

func UsersWithAllRelations() exec.QueryOption[UserColumnAlias, *UserScanner]

UsersWithAllRelations returns a QueryOption to load all relations

func UsersWithOrders added in v0.2.0

func UsersWithOrders() exec.QueryOption[UserColumnAlias, *UserScanner]

UsersWithOrders returns a QueryOption to load Orders relation

func UsersWithProfile added in v0.2.0

func UsersWithProfile() exec.QueryOption[UserColumnAlias, *UserScanner]

UsersWithProfile returns a QueryOption to load Profile relation

Types

type AppearanceSettings added in v0.4.7

type AppearanceSettings struct {
	SelectedTheme *ThemeConfig `protobuf:"bytes,1,opt,name=selected_theme,json=selectedTheme,proto3" json:"selected_theme,omitempty"`
	FallbackTheme *ThemeConfig `protobuf:"bytes,2,opt,name=fallback_theme,json=fallbackTheme,proto3" json:"fallback_theme,omitempty"`
	// contains filtered or unexported fields
}

Тест: serialize = true на message поле ВНУТРИ embedded struct

func (*AppearanceSettings) Descriptor deprecated added in v0.4.7

func (*AppearanceSettings) Descriptor() ([]byte, []int)

Deprecated: Use AppearanceSettings.ProtoReflect.Descriptor instead.

func (*AppearanceSettings) GetFallbackTheme added in v0.4.7

func (x *AppearanceSettings) GetFallbackTheme() *ThemeConfig

func (*AppearanceSettings) GetSelectedTheme added in v0.4.7

func (x *AppearanceSettings) GetSelectedTheme() *ThemeConfig

func (*AppearanceSettings) IntoPlain added in v0.4.7

IntoPlain converts protobuf message to plain struct

func (*AppearanceSettings) ProtoMessage added in v0.4.7

func (*AppearanceSettings) ProtoMessage()

func (*AppearanceSettings) ProtoReflect added in v0.4.7

func (x *AppearanceSettings) ProtoReflect() protoreflect.Message

func (*AppearanceSettings) Reset added in v0.4.7

func (x *AppearanceSettings) Reset()

func (*AppearanceSettings) String added in v0.4.7

func (x *AppearanceSettings) String() string

type AppearanceSettingsScanner added in v0.4.7

type AppearanceSettingsScanner struct {
	SelectedTheme []byte `json:"selectedTheme"` // origin: serialized, empath: selected_theme
	FallbackTheme []byte `json:"fallbackTheme"` // origin: serialized, empath: fallback_theme
}

Тест: serialize = true на message поле ВНУТРИ embedded struct

func (*AppearanceSettingsScanner) IntoPb added in v0.4.7

IntoPb converts plain struct to protobuf message

type AuditLog added in v0.4.8

type AuditLog struct {
	Id         int64  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Action     string `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"`
	EntityType string `protobuf:"bytes,3,opt,name=entity_type,json=entityType,proto3" json:"entity_type,omitempty"`
	EntityId   int64  `protobuf:"varint,4,opt,name=entity_id,json=entityId,proto3" json:"entity_id,omitempty"`
	// repeated scalar → TEXT[] in PostgreSQL
	Tags       []string `protobuf:"bytes,5,rep,name=tags,proto3" json:"tags,omitempty"`
	RelatedIds []int64  `protobuf:"varint,6,rep,packed,name=related_ids,json=relatedIds,proto3" json:"related_ids,omitempty"`
	// contains filtered or unexported fields
}

Тест: virtual_columns — колонки без proto field, только DDL

func (*AuditLog) Descriptor deprecated added in v0.4.8

func (*AuditLog) Descriptor() ([]byte, []int)

Deprecated: Use AuditLog.ProtoReflect.Descriptor instead.

func (*AuditLog) GetAction added in v0.4.8

func (x *AuditLog) GetAction() string

func (*AuditLog) GetEntityId added in v0.4.8

func (x *AuditLog) GetEntityId() int64

func (*AuditLog) GetEntityType added in v0.4.8

func (x *AuditLog) GetEntityType() string

func (*AuditLog) GetId added in v0.4.8

func (x *AuditLog) GetId() int64

func (*AuditLog) GetRelatedIds added in v0.4.10

func (x *AuditLog) GetRelatedIds() []int64

func (*AuditLog) GetTags added in v0.4.10

func (x *AuditLog) GetTags() []string

func (*AuditLog) IntoPlain added in v0.4.8

func (pb *AuditLog) IntoPlain() *AuditLogScanner

IntoPlain converts protobuf message to plain struct

func (*AuditLog) ProtoMessage added in v0.4.8

func (*AuditLog) ProtoMessage()

func (*AuditLog) ProtoReflect added in v0.4.8

func (x *AuditLog) ProtoReflect() protoreflect.Message

func (*AuditLog) Reset added in v0.4.8

func (x *AuditLog) Reset()

func (*AuditLog) String added in v0.4.8

func (x *AuditLog) String() string

type AuditLogAlias added in v0.4.8

type AuditLogAlias string

AuditLogAlias is the table alias type for the audit_logs table

const AuditLogAliasName AuditLogAlias = "audit_logs"

func (AuditLogAlias) String added in v0.4.8

func (a AuditLogAlias) String() string

type AuditLogColumnAlias added in v0.4.8

type AuditLogColumnAlias string

AuditLogColumnAlias represents column names for the audit_logs table

const (
	AuditLogColumnId          AuditLogColumnAlias = "id"
	AuditLogColumnAction      AuditLogColumnAlias = "action"
	AuditLogColumnEntityType  AuditLogColumnAlias = "entity_type"
	AuditLogColumnEntityId    AuditLogColumnAlias = "entity_id"
	AuditLogColumnTags        AuditLogColumnAlias = "tags"
	AuditLogColumnRelatedIds  AuditLogColumnAlias = "related_ids"
	AuditLogColumnDbCreatedAt AuditLogColumnAlias = "db_created_at"
	AuditLogColumnDbUpdatedAt AuditLogColumnAlias = "db_updated_at"
)

func (AuditLogColumnAlias) String added in v0.4.8

func (c AuditLogColumnAlias) String() string

type AuditLogScanner added in v0.4.8

type AuditLogScanner struct {
	Id          int64    `json:"id"`
	Action      string   `json:"action"`
	EntityType  string   `json:"entityType"`
	EntityId    int64    `json:"entityId"`
	Tags        []string `json:"tags"`
	RelatedIds  []int64  `json:"relatedIds"`
	DbCreatedAt string   `json:"dbCreatedAt"` // origin: virtual, empath: virtual
	DbUpdatedAt string   `json:"dbUpdatedAt"` // origin: virtual, empath: virtual
}

Тест: virtual_columns — колонки без proto field, только DDL

func (*AuditLogScanner) AllSetters added in v0.4.9

func (*AuditLogScanner) GetSetter added in v0.4.8

func (*AuditLogScanner) GetTarget added in v0.4.8

func (s *AuditLogScanner) GetTarget(col string) func() any

func (*AuditLogScanner) GetValue added in v0.4.8

func (s *AuditLogScanner) GetValue(f AuditLogColumnAlias) func() any

func (*AuditLogScanner) IntoPb added in v0.4.8

func (p *AuditLogScanner) IntoPb() *AuditLog

IntoPb converts plain struct to protobuf message

func (*AuditLogScanner) Relations added in v0.4.8

Relations returns the relation loaders for the audit_logs table

func (*AuditLogScanner) WithDbCreatedAt added in v0.4.9

func (p *AuditLogScanner) WithDbCreatedAt(v string) *AuditLogScanner

WithDbCreatedAt sets the virtual field DbCreatedAt

func (*AuditLogScanner) WithDbUpdatedAt added in v0.4.9

func (p *AuditLogScanner) WithDbUpdatedAt(v string) *AuditLogScanner

WithDbUpdatedAt sets the virtual field DbUpdatedAt

type BaseEntity

type BaseEntity struct {
	Id         *EntityID   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Timestamps *Timestamps `protobuf:"bytes,2,opt,name=timestamps,proto3" json:"timestamps,omitempty"`
	// contains filtered or unexported fields
}

============================================================================ BaseEntity - базовая сущность с ID и timestamps (nested embed) ============================================================================

func (*BaseEntity) Descriptor deprecated

func (*BaseEntity) Descriptor() ([]byte, []int)

Deprecated: Use BaseEntity.ProtoReflect.Descriptor instead.

func (*BaseEntity) GetId

func (x *BaseEntity) GetId() *EntityID

func (*BaseEntity) GetTimestamps

func (x *BaseEntity) GetTimestamps() *Timestamps

func (*BaseEntity) IntoPlain

func (pb *BaseEntity) IntoPlain() *BaseEntityScanner

IntoPlain converts protobuf message to plain struct

func (*BaseEntity) ProtoMessage

func (*BaseEntity) ProtoMessage()

func (*BaseEntity) ProtoReflect

func (x *BaseEntity) ProtoReflect() protoreflect.Message

func (*BaseEntity) Reset

func (x *BaseEntity) Reset()

func (*BaseEntity) String

func (x *BaseEntity) String() string

type BaseEntityScanner

type BaseEntityScanner struct {
	Id        int64     `json:"id"` // origin: type_alias, empath: id
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

============================================================================

BaseEntity - базовая сущность с ID и timestamps (nested embed)
============================================================================

func (*BaseEntityScanner) IntoPb

func (p *BaseEntityScanner) IntoPb() *BaseEntity

IntoPb converts plain struct to protobuf message

type Category

type Category struct {

	// Embedded BaseEntity (id + timestamps)
	Base     *BaseEntity            `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
	Name     string                 `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Slug     string                 `protobuf:"bytes,3,opt,name=slug,proto3" json:"slug,omitempty"`
	ParentId *wrapperspb.Int64Value `protobuf:"bytes,4,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` // nullable self-referencing FK
	// contains filtered or unexported fields
}

============================================================================ Category - категория товаров (с BaseEntity) ============================================================================

func (*Category) Descriptor deprecated

func (*Category) Descriptor() ([]byte, []int)

Deprecated: Use Category.ProtoReflect.Descriptor instead.

func (*Category) GetBase

func (x *Category) GetBase() *BaseEntity

func (*Category) GetName

func (x *Category) GetName() string

func (*Category) GetParentId

func (x *Category) GetParentId() *wrapperspb.Int64Value

func (*Category) GetSlug

func (x *Category) GetSlug() string

func (*Category) IntoPlain

func (pb *Category) IntoPlain() *CategoryScanner

IntoPlain converts protobuf message to plain struct

func (*Category) ProtoMessage

func (*Category) ProtoMessage()

func (*Category) ProtoReflect

func (x *Category) ProtoReflect() protoreflect.Message

func (*Category) Reset

func (x *Category) Reset()

func (*Category) String

func (x *Category) String() string

type CategoryAlias

type CategoryAlias string

CategoryAlias is the table alias type for the categories table

const CategoryAliasName CategoryAlias = "categories"

func (CategoryAlias) String

func (a CategoryAlias) String() string

type CategoryColumnAlias

type CategoryColumnAlias string

CategoryColumnAlias represents column names for the categories table

const (
	CategoryColumnId        CategoryColumnAlias = "id"
	CategoryColumnCreatedAt CategoryColumnAlias = "created_at"
	CategoryColumnUpdatedAt CategoryColumnAlias = "updated_at"
	CategoryColumnName      CategoryColumnAlias = "name"
	CategoryColumnSlug      CategoryColumnAlias = "slug"
	CategoryColumnParentId  CategoryColumnAlias = "parent_id"
)

func (CategoryColumnAlias) String

func (c CategoryColumnAlias) String() string

type CategoryScanner

type CategoryScanner struct {
	Id        int64     `json:"id"` // origin: embed, empath: id
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
	Name      string    `json:"name"`
	Slug      string    `json:"slug"`
	ParentId  int64     `json:"parentId"`
}

============================================================================

Category - категория товаров (с BaseEntity)
============================================================================

func (*CategoryScanner) AllSetters added in v0.4.9

func (*CategoryScanner) GetSetter

func (*CategoryScanner) GetTarget

func (s *CategoryScanner) GetTarget(col string) func() any

func (*CategoryScanner) GetValue

func (s *CategoryScanner) GetValue(f CategoryColumnAlias) func() any

func (*CategoryScanner) IntoPb

func (p *CategoryScanner) IntoPb() *Category

IntoPb converts plain struct to protobuf message

func (*CategoryScanner) Relations

Relations returns the relation loaders for the categories table

type Currency

type Currency struct {
	Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

============================================================================ Currency - справочник валют (не использует BaseEntity) ============================================================================

func (*Currency) Descriptor deprecated

func (*Currency) Descriptor() ([]byte, []int)

Deprecated: Use Currency.ProtoReflect.Descriptor instead.

func (*Currency) GetCode

func (x *Currency) GetCode() string

func (*Currency) GetName

func (x *Currency) GetName() string

func (*Currency) IntoPlain

func (pb *Currency) IntoPlain() *CurrencyScanner

IntoPlain converts protobuf message to plain struct

func (*Currency) ProtoMessage

func (*Currency) ProtoMessage()

func (*Currency) ProtoReflect

func (x *Currency) ProtoReflect() protoreflect.Message

func (*Currency) Reset

func (x *Currency) Reset()

func (*Currency) String

func (x *Currency) String() string

type CurrencyAlias

type CurrencyAlias string

CurrencyAlias is the table alias type for the currency table

const CurrencyAliasName CurrencyAlias = "currency"

func (CurrencyAlias) String

func (a CurrencyAlias) String() string

type CurrencyColumnAlias

type CurrencyColumnAlias string

CurrencyColumnAlias represents column names for the currency table

const (
	CurrencyColumnCode CurrencyColumnAlias = "code"
	CurrencyColumnName CurrencyColumnAlias = "name"
)

func (CurrencyColumnAlias) String

func (c CurrencyColumnAlias) String() string

type CurrencyScanner

type CurrencyScanner struct {
	Code string `json:"code"`
	Name string `json:"name"`
}

============================================================================

Currency - справочник валют (не использует BaseEntity)
============================================================================

func (*CurrencyScanner) AllSetters added in v0.4.9

func (*CurrencyScanner) GetSetter

func (*CurrencyScanner) GetTarget

func (s *CurrencyScanner) GetTarget(col string) func() any

func (*CurrencyScanner) GetValue

func (s *CurrencyScanner) GetValue(f CurrencyColumnAlias) func() any

func (*CurrencyScanner) IntoPb

func (p *CurrencyScanner) IntoPb() *Currency

IntoPb converts plain struct to protobuf message

func (*CurrencyScanner) Relations

Relations returns the relation loaders for the currency table

type CurrencysTable

CurrencysTable represents the currency table with its columns

type EntityID

type EntityID struct {
	Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

EntityID - базовый type alias для ID сущностей

func (*EntityID) Descriptor deprecated

func (*EntityID) Descriptor() ([]byte, []int)

Deprecated: Use EntityID.ProtoReflect.Descriptor instead.

func (*EntityID) GetValue

func (x *EntityID) GetValue() int64

func (*EntityID) ProtoMessage

func (*EntityID) ProtoMessage()

func (*EntityID) ProtoReflect

func (x *EntityID) ProtoReflect() protoreflect.Message

func (*EntityID) Reset

func (x *EntityID) Reset()

func (*EntityID) String

func (x *EntityID) String() string

type Order

type Order struct {

	// Embedded BaseEntity (id + timestamps)
	Base     *BaseEntity `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
	UserId   *EntityID   `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // FK to users.id
	Status   string      `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
	Currency string      `protobuf:"bytes,4,opt,name=currency,proto3" json:"currency,omitempty"` // FK to currency.code
	// OneToMany: Order has many OrderItems
	Items []*OrderItem `protobuf:"bytes,10,rep,name=items,proto3" json:"items,omitempty"`
	// BelongsTo: Order belongs to User
	User *User `protobuf:"bytes,11,opt,name=user,proto3" json:"user,omitempty"`
	// BelongsTo: Order belongs to Currency
	Money *Currency `protobuf:"bytes,12,opt,name=money,proto3" json:"money,omitempty"`
	// contains filtered or unexported fields
}

============================================================================ Order - заказ (с BaseEntity) ============================================================================

func (*Order) Descriptor deprecated

func (*Order) Descriptor() ([]byte, []int)

Deprecated: Use Order.ProtoReflect.Descriptor instead.

func (*Order) GetBase

func (x *Order) GetBase() *BaseEntity

func (*Order) GetCurrency

func (x *Order) GetCurrency() string

func (*Order) GetItems

func (x *Order) GetItems() []*OrderItem

func (*Order) GetMoney added in v0.2.0

func (x *Order) GetMoney() *Currency

func (*Order) GetStatus

func (x *Order) GetStatus() string

func (*Order) GetUser added in v0.2.0

func (x *Order) GetUser() *User

func (*Order) GetUserId

func (x *Order) GetUserId() *EntityID

func (*Order) IntoPlain

func (pb *Order) IntoPlain() *OrderScanner

IntoPlain converts protobuf message to plain struct

func (*Order) ProtoMessage

func (*Order) ProtoMessage()

func (*Order) ProtoReflect

func (x *Order) ProtoReflect() protoreflect.Message

func (*Order) Reset

func (x *Order) Reset()

func (*Order) String

func (x *Order) String() string

type OrderAlias

type OrderAlias string

OrderAlias is the table alias type for the orders table

const OrderAliasName OrderAlias = "orders"

func (OrderAlias) String

func (a OrderAlias) String() string

type OrderColumnAlias

type OrderColumnAlias string

OrderColumnAlias represents column names for the orders table

const (
	OrderColumnId        OrderColumnAlias = "id"
	OrderColumnCreatedAt OrderColumnAlias = "created_at"
	OrderColumnUpdatedAt OrderColumnAlias = "updated_at"
	OrderColumnUserId    OrderColumnAlias = "user_id"
	OrderColumnStatus    OrderColumnAlias = "status"
	OrderColumnCurrency  OrderColumnAlias = "currency"
)

func (OrderColumnAlias) String

func (c OrderColumnAlias) String() string

type OrderItem

type OrderItem struct {
	OrderId   *EntityID `protobuf:"bytes,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` // FK to orders.id
	LineNo    int32     `protobuf:"varint,2,opt,name=line_no,json=lineNo,proto3" json:"line_no,omitempty"`
	ProductId *EntityID `protobuf:"bytes,3,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` // FK to products.id
	Qty       int32     `protobuf:"varint,4,opt,name=qty,proto3" json:"qty,omitempty"`
	UnitPrice float64   `protobuf:"fixed64,5,opt,name=unit_price,json=unitPrice,proto3" json:"unit_price,omitempty"`
	// BelongsTo: OrderItem belongs to Order
	Order *Order `protobuf:"bytes,10,opt,name=order,proto3" json:"order,omitempty"`
	// BelongsTo: OrderItem belongs to Product
	Product *Product `protobuf:"bytes,11,opt,name=product,proto3" json:"product,omitempty"`
	// contains filtered or unexported fields
}

============================================================================ OrderItem - позиция заказа (без BaseEntity - композитный PK) ============================================================================

func (*OrderItem) Descriptor deprecated

func (*OrderItem) Descriptor() ([]byte, []int)

Deprecated: Use OrderItem.ProtoReflect.Descriptor instead.

func (*OrderItem) GetLineNo

func (x *OrderItem) GetLineNo() int32

func (*OrderItem) GetOrder added in v0.2.0

func (x *OrderItem) GetOrder() *Order

func (*OrderItem) GetOrderId

func (x *OrderItem) GetOrderId() *EntityID

func (*OrderItem) GetProduct added in v0.2.0

func (x *OrderItem) GetProduct() *Product

func (*OrderItem) GetProductId

func (x *OrderItem) GetProductId() *EntityID

func (*OrderItem) GetQty

func (x *OrderItem) GetQty() int32

func (*OrderItem) GetUnitPrice

func (x *OrderItem) GetUnitPrice() float64

func (*OrderItem) IntoPlain

func (pb *OrderItem) IntoPlain() *OrderItemScanner

IntoPlain converts protobuf message to plain struct

func (*OrderItem) ProtoMessage

func (*OrderItem) ProtoMessage()

func (*OrderItem) ProtoReflect

func (x *OrderItem) ProtoReflect() protoreflect.Message

func (*OrderItem) Reset

func (x *OrderItem) Reset()

func (*OrderItem) String

func (x *OrderItem) String() string

type OrderItemAlias

type OrderItemAlias string

OrderItemAlias is the table alias type for the order_items table

const OrderItemAliasName OrderItemAlias = "order_items"

func (OrderItemAlias) String

func (a OrderItemAlias) String() string

type OrderItemColumnAlias

type OrderItemColumnAlias string

OrderItemColumnAlias represents column names for the order_items table

const (
	OrderItemColumnOrderId   OrderItemColumnAlias = "order_id"
	OrderItemColumnLineNo    OrderItemColumnAlias = "line_no"
	OrderItemColumnProductId OrderItemColumnAlias = "product_id"
	OrderItemColumnQty       OrderItemColumnAlias = "qty"
	OrderItemColumnUnitPrice OrderItemColumnAlias = "unit_price"
)

func (OrderItemColumnAlias) String

func (c OrderItemColumnAlias) String() string

type OrderItemScanner

type OrderItemScanner struct {
	OrderId   int64           `json:"orderId"` // origin: type_alias, empath: order_id
	LineNo    int32           `json:"lineNo"`
	ProductId int64           `json:"productId"` // origin: type_alias, empath: product_id
	Qty       int32           `json:"qty"`
	UnitPrice float64         `json:"unitPrice"`
	Order     *OrderScanner   `json:"order"`
	Product   *ProductScanner `json:"product"`
}

============================================================================

OrderItem - позиция заказа (без BaseEntity - композитный PK)
============================================================================

func (*OrderItemScanner) AllSetters added in v0.4.9

func (*OrderItemScanner) GetSetter

func (*OrderItemScanner) GetTarget

func (s *OrderItemScanner) GetTarget(col string) func() any

func (*OrderItemScanner) GetValue

func (s *OrderItemScanner) GetValue(f OrderItemColumnAlias) func() any

func (*OrderItemScanner) IntoPb

func (p *OrderItemScanner) IntoPb() *OrderItem

IntoPb converts plain struct to protobuf message

func (*OrderItemScanner) Relations

Relations returns the relation loaders for the order_items table

type OrderScanner

type OrderScanner struct {
	Id        int64              `json:"id"` // origin: embed, empath: id
	CreatedAt time.Time          `json:"createdAt"`
	UpdatedAt time.Time          `json:"updatedAt"`
	UserId    int64              `json:"userId"` // origin: type_alias, empath: user_id
	Status    string             `json:"status"`
	Currency  string             `json:"currency"`
	Items     []OrderItemScanner `json:"items"`
	User      *UserScanner       `json:"user"`
	Money     *CurrencyScanner   `json:"money"`
}

============================================================================

Order - заказ (с BaseEntity)
============================================================================

func (*OrderScanner) AllSetters added in v0.4.9

func (s *OrderScanner) AllSetters() []set.ValueSetter[OrderColumnAlias]

func (*OrderScanner) GetSetter

func (*OrderScanner) GetTarget

func (s *OrderScanner) GetTarget(col string) func() any

func (*OrderScanner) GetValue

func (s *OrderScanner) GetValue(f OrderColumnAlias) func() any

func (*OrderScanner) IntoPb

func (p *OrderScanner) IntoPb() *Order

IntoPb converts plain struct to protobuf message

func (*OrderScanner) Relations

func (s *OrderScanner) Relations() []exec.RelationLoader[*OrderScanner]

Relations returns the relation loaders for the orders table

type Product

type Product struct {

	// Embedded BaseEntity (id + timestamps)
	Base      *BaseEntity `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
	Sku       string      `protobuf:"bytes,2,opt,name=sku,proto3" json:"sku,omitempty"`
	Name      string      `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	Price     float64     `protobuf:"fixed64,4,opt,name=price,proto3" json:"price,omitempty"`
	Currency  string      `protobuf:"bytes,5,opt,name=currency,proto3" json:"currency,omitempty"` // FK to currency.code
	StockQty  int32       `protobuf:"varint,6,opt,name=stock_qty,json=stockQty,proto3" json:"stock_qty,omitempty"`
	IsDeleted bool        `protobuf:"varint,7,opt,name=is_deleted,json=isDeleted,proto3" json:"is_deleted,omitempty"`
	// ManyToMany: Product has many Categories
	Categories []*Category `protobuf:"bytes,10,rep,name=categories,proto3" json:"categories,omitempty"`
	// ManyToMany: Product has many Tags
	Tags []*Tag `protobuf:"bytes,11,rep,name=tags,proto3" json:"tags,omitempty"`
	// contains filtered or unexported fields
}

============================================================================ Product - товар (с BaseEntity) ============================================================================

func (*Product) Descriptor deprecated

func (*Product) Descriptor() ([]byte, []int)

Deprecated: Use Product.ProtoReflect.Descriptor instead.

func (*Product) GetBase

func (x *Product) GetBase() *BaseEntity

func (*Product) GetCategories

func (x *Product) GetCategories() []*Category

func (*Product) GetCurrency

func (x *Product) GetCurrency() string

func (*Product) GetIsDeleted

func (x *Product) GetIsDeleted() bool

func (*Product) GetName

func (x *Product) GetName() string

func (*Product) GetPrice

func (x *Product) GetPrice() float64

func (*Product) GetSku

func (x *Product) GetSku() string

func (*Product) GetStockQty

func (x *Product) GetStockQty() int32

func (*Product) GetTags

func (x *Product) GetTags() []*Tag

func (*Product) IntoPlain

func (pb *Product) IntoPlain() *ProductScanner

IntoPlain converts protobuf message to plain struct

func (*Product) ProtoMessage

func (*Product) ProtoMessage()

func (*Product) ProtoReflect

func (x *Product) ProtoReflect() protoreflect.Message

func (*Product) Reset

func (x *Product) Reset()

func (*Product) String

func (x *Product) String() string

type ProductAlias

type ProductAlias string

ProductAlias is the table alias type for the products table

const ProductAliasName ProductAlias = "products"

func (ProductAlias) String

func (a ProductAlias) String() string

type ProductColumnAlias

type ProductColumnAlias string

ProductColumnAlias represents column names for the products table

const (
	ProductColumnId        ProductColumnAlias = "id"
	ProductColumnCreatedAt ProductColumnAlias = "created_at"
	ProductColumnUpdatedAt ProductColumnAlias = "updated_at"
	ProductColumnSku       ProductColumnAlias = "sku"
	ProductColumnName      ProductColumnAlias = "name"
	ProductColumnPrice     ProductColumnAlias = "price"
	ProductColumnCurrency  ProductColumnAlias = "currency"
	ProductColumnStockQty  ProductColumnAlias = "stock_qty"
	ProductColumnIsDeleted ProductColumnAlias = "is_deleted"
)

func (ProductColumnAlias) String

func (c ProductColumnAlias) String() string

type ProductScanner

type ProductScanner struct {
	Id         int64             `json:"id"` // origin: embed, empath: id
	CreatedAt  time.Time         `json:"createdAt"`
	UpdatedAt  time.Time         `json:"updatedAt"`
	Sku        string            `json:"sku"`
	Name       string            `json:"name"`
	Price      float64           `json:"price"`
	Currency   string            `json:"currency"`
	StockQty   int32             `json:"stockQty"`
	IsDeleted  bool              `json:"isDeleted"`
	Categories []CategoryScanner `json:"categories"`
	Tags       []TagScanner      `json:"tags"`
}

============================================================================

Product - товар (с BaseEntity)
============================================================================

func (*ProductScanner) AllSetters added in v0.4.9

func (s *ProductScanner) AllSetters() []set.ValueSetter[ProductColumnAlias]

func (*ProductScanner) GetSetter

func (*ProductScanner) GetTarget

func (s *ProductScanner) GetTarget(col string) func() any

func (*ProductScanner) GetValue

func (s *ProductScanner) GetValue(f ProductColumnAlias) func() any

func (*ProductScanner) IntoPb

func (p *ProductScanner) IntoPb() *Product

IntoPb converts plain struct to protobuf message

func (*ProductScanner) Relations

func (s *ProductScanner) Relations() []exec.RelationLoader[*ProductScanner]

Relations returns the relation loaders for the products table

type Profile added in v0.2.0

type Profile struct {

	// Embedded BaseEntity (id + timestamps)
	Base      *BaseEntity `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
	UserId    *EntityID   `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // FK to users.id (unique - one profile per user)
	Bio       string      `protobuf:"bytes,3,opt,name=bio,proto3" json:"bio,omitempty"`
	AvatarUrl string      `protobuf:"bytes,4,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"`
	// BelongsTo: Profile belongs to User
	User *User `protobuf:"bytes,10,opt,name=user,proto3" json:"user,omitempty"`
	// contains filtered or unexported fields
}

============================================================================ Profile - профиль пользователя (один к одному с User) ============================================================================

func (*Profile) Descriptor deprecated added in v0.2.0

func (*Profile) Descriptor() ([]byte, []int)

Deprecated: Use Profile.ProtoReflect.Descriptor instead.

func (*Profile) GetAvatarUrl added in v0.2.0

func (x *Profile) GetAvatarUrl() string

func (*Profile) GetBase added in v0.2.0

func (x *Profile) GetBase() *BaseEntity

func (*Profile) GetBio added in v0.2.0

func (x *Profile) GetBio() string

func (*Profile) GetUser added in v0.2.0

func (x *Profile) GetUser() *User

func (*Profile) GetUserId added in v0.2.0

func (x *Profile) GetUserId() *EntityID

func (*Profile) IntoPlain added in v0.2.0

func (pb *Profile) IntoPlain() *ProfileScanner

IntoPlain converts protobuf message to plain struct

func (*Profile) ProtoMessage added in v0.2.0

func (*Profile) ProtoMessage()

func (*Profile) ProtoReflect added in v0.2.0

func (x *Profile) ProtoReflect() protoreflect.Message

func (*Profile) Reset added in v0.2.0

func (x *Profile) Reset()

func (*Profile) String added in v0.2.0

func (x *Profile) String() string

type ProfileAlias added in v0.2.0

type ProfileAlias string

ProfileAlias is the table alias type for the profiles table

const ProfileAliasName ProfileAlias = "profiles"

func (ProfileAlias) String added in v0.2.0

func (a ProfileAlias) String() string

type ProfileColumnAlias added in v0.2.0

type ProfileColumnAlias string

ProfileColumnAlias represents column names for the profiles table

const (
	ProfileColumnId        ProfileColumnAlias = "id"
	ProfileColumnCreatedAt ProfileColumnAlias = "created_at"
	ProfileColumnUpdatedAt ProfileColumnAlias = "updated_at"
	ProfileColumnUserId    ProfileColumnAlias = "user_id"
	ProfileColumnBio       ProfileColumnAlias = "bio"
	ProfileColumnAvatarUrl ProfileColumnAlias = "avatar_url"
)

func (ProfileColumnAlias) String added in v0.2.0

func (c ProfileColumnAlias) String() string

type ProfileScanner added in v0.2.0

type ProfileScanner struct {
	Id        int64        `json:"id"` // origin: embed, empath: id
	CreatedAt time.Time    `json:"createdAt"`
	UpdatedAt time.Time    `json:"updatedAt"`
	UserId    int64        `json:"userId"` // origin: type_alias, empath: user_id
	Bio       string       `json:"bio"`
	AvatarUrl string       `json:"avatarUrl"`
	User      *UserScanner `json:"user"`
}

============================================================================

Profile - профиль пользователя (один к одному с User)
============================================================================

func (*ProfileScanner) AllSetters added in v0.4.9

func (s *ProfileScanner) AllSetters() []set.ValueSetter[ProfileColumnAlias]

func (*ProfileScanner) GetSetter added in v0.2.0

func (*ProfileScanner) GetTarget added in v0.2.0

func (s *ProfileScanner) GetTarget(col string) func() any

func (*ProfileScanner) GetValue added in v0.2.0

func (s *ProfileScanner) GetValue(f ProfileColumnAlias) func() any

func (*ProfileScanner) IntoPb added in v0.2.0

func (p *ProfileScanner) IntoPb() *Profile

IntoPb converts plain struct to protobuf message

func (*ProfileScanner) Relations added in v0.2.0

func (s *ProfileScanner) Relations() []exec.RelationLoader[*ProfileScanner]

Relations returns the relation loaders for the profiles table

type Tag

type Tag struct {

	// Embedded BaseEntity (id + timestamps)
	Base *BaseEntity `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
	Name string      `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Slug string      `protobuf:"bytes,3,opt,name=slug,proto3" json:"slug,omitempty"`
	// contains filtered or unexported fields
}

============================================================================ Tag - тег для товаров (с BaseEntity) ============================================================================

func (*Tag) Descriptor deprecated

func (*Tag) Descriptor() ([]byte, []int)

Deprecated: Use Tag.ProtoReflect.Descriptor instead.

func (*Tag) GetBase

func (x *Tag) GetBase() *BaseEntity

func (*Tag) GetName

func (x *Tag) GetName() string

func (*Tag) GetSlug

func (x *Tag) GetSlug() string

func (*Tag) IntoPlain

func (pb *Tag) IntoPlain() *TagScanner

IntoPlain converts protobuf message to plain struct

func (*Tag) ProtoMessage

func (*Tag) ProtoMessage()

func (*Tag) ProtoReflect

func (x *Tag) ProtoReflect() protoreflect.Message

func (*Tag) Reset

func (x *Tag) Reset()

func (*Tag) String

func (x *Tag) String() string

type TagAlias

type TagAlias string

TagAlias is the table alias type for the tags table

const TagAliasName TagAlias = "tags"

func (TagAlias) String

func (a TagAlias) String() string

type TagColumnAlias

type TagColumnAlias string

TagColumnAlias represents column names for the tags table

const (
	TagColumnId        TagColumnAlias = "id"
	TagColumnCreatedAt TagColumnAlias = "created_at"
	TagColumnUpdatedAt TagColumnAlias = "updated_at"
	TagColumnName      TagColumnAlias = "name"
	TagColumnSlug      TagColumnAlias = "slug"
)

func (TagColumnAlias) String

func (c TagColumnAlias) String() string

type TagScanner

type TagScanner struct {
	Id        int64     `json:"id"` // origin: embed, empath: id
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
	Name      string    `json:"name"`
	Slug      string    `json:"slug"`
}

============================================================================

Tag - тег для товаров (с BaseEntity)
============================================================================

func (*TagScanner) AllSetters added in v0.4.9

func (s *TagScanner) AllSetters() []set.ValueSetter[TagColumnAlias]

func (*TagScanner) GetSetter

func (s *TagScanner) GetSetter(f TagColumnAlias) func() set.ValueSetter[TagColumnAlias]

func (*TagScanner) GetTarget

func (s *TagScanner) GetTarget(col string) func() any

func (*TagScanner) GetValue

func (s *TagScanner) GetValue(f TagColumnAlias) func() any

func (*TagScanner) IntoPb

func (p *TagScanner) IntoPb() *Tag

IntoPb converts plain struct to protobuf message

func (*TagScanner) Relations

func (s *TagScanner) Relations() []exec.RelationLoader[*TagScanner]

Relations returns the relation loaders for the tags table

type ThemeConfig added in v0.4.7

type ThemeConfig struct {
	PrimaryColor string `protobuf:"bytes,1,opt,name=primary_color,json=primaryColor,proto3" json:"primary_color,omitempty"`
	FontFamily   string `protobuf:"bytes,2,opt,name=font_family,json=fontFamily,proto3" json:"font_family,omitempty"`
	// contains filtered or unexported fields
}

============================================================================ Settings - тест serialize = true на message полях ============================================================================

func (*ThemeConfig) Descriptor deprecated added in v0.4.7

func (*ThemeConfig) Descriptor() ([]byte, []int)

Deprecated: Use ThemeConfig.ProtoReflect.Descriptor instead.

func (*ThemeConfig) GetFontFamily added in v0.4.7

func (x *ThemeConfig) GetFontFamily() string

func (*ThemeConfig) GetPrimaryColor added in v0.4.7

func (x *ThemeConfig) GetPrimaryColor() string

func (*ThemeConfig) ProtoMessage added in v0.4.7

func (*ThemeConfig) ProtoMessage()

func (*ThemeConfig) ProtoReflect added in v0.4.7

func (x *ThemeConfig) ProtoReflect() protoreflect.Message

func (*ThemeConfig) Reset added in v0.4.7

func (x *ThemeConfig) Reset()

func (*ThemeConfig) String added in v0.4.7

func (x *ThemeConfig) String() string

type Timestamps

type Timestamps struct {
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
	// contains filtered or unexported fields
}

============================================================================ Timestamps - embedded message для created_at/updated_at ============================================================================

func (*Timestamps) Descriptor deprecated

func (*Timestamps) Descriptor() ([]byte, []int)

Deprecated: Use Timestamps.ProtoReflect.Descriptor instead.

func (*Timestamps) GetCreatedAt

func (x *Timestamps) GetCreatedAt() *timestamppb.Timestamp

func (*Timestamps) GetUpdatedAt

func (x *Timestamps) GetUpdatedAt() *timestamppb.Timestamp

func (*Timestamps) IntoPlain

func (pb *Timestamps) IntoPlain() *TimestampsScanner

IntoPlain converts protobuf message to plain struct

func (*Timestamps) ProtoMessage

func (*Timestamps) ProtoMessage()

func (*Timestamps) ProtoReflect

func (x *Timestamps) ProtoReflect() protoreflect.Message

func (*Timestamps) Reset

func (x *Timestamps) Reset()

func (*Timestamps) String

func (x *Timestamps) String() string

type TimestampsScanner

type TimestampsScanner struct {
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

============================================================================

Timestamps - embedded message для created_at/updated_at
============================================================================

func (*TimestampsScanner) IntoPb

func (p *TimestampsScanner) IntoPb() *Timestamps

IntoPb converts plain struct to protobuf message

type User

type User struct {

	// Embedded BaseEntity (id + timestamps)
	Base     *BaseEntity `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
	Email    string      `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
	FullName string      `protobuf:"bytes,3,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"`
	IsActive bool        `protobuf:"varint,4,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty"`
	// Nullable via proto3 optional on Timestamp
	EmailConfirmedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=email_confirmed_at,json=emailConfirmedAt,proto3,oneof" json:"email_confirmed_at,omitempty"`
	// Nullable via proto3 optional on scalar
	Nickname *string `protobuf:"bytes,6,opt,name=nickname,proto3,oneof" json:"nickname,omitempty"`
	// Nullable via proto3 optional on Timestamp
	DeletedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=deleted_at,json=deletedAt,proto3,oneof" json:"deleted_at,omitempty"`
	// OneToMany: User has many Orders
	Orders []*Order `protobuf:"bytes,10,rep,name=orders,proto3" json:"orders,omitempty"`
	// HasOne: User has one Profile
	Profile *Profile `protobuf:"bytes,11,opt,name=profile,proto3" json:"profile,omitempty"`
	// contains filtered or unexported fields
}

============================================================================ User - пользователь системы (с BaseEntity) ============================================================================

func (*User) Descriptor deprecated

func (*User) Descriptor() ([]byte, []int)

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetBase

func (x *User) GetBase() *BaseEntity

func (*User) GetDeletedAt added in v0.3.0

func (x *User) GetDeletedAt() *timestamppb.Timestamp

func (*User) GetEmail

func (x *User) GetEmail() string

func (*User) GetEmailConfirmedAt added in v0.3.0

func (x *User) GetEmailConfirmedAt() *timestamppb.Timestamp

func (*User) GetFullName

func (x *User) GetFullName() string

func (*User) GetIsActive

func (x *User) GetIsActive() bool

func (*User) GetNickname added in v0.3.0

func (x *User) GetNickname() string

func (*User) GetOrders

func (x *User) GetOrders() []*Order

func (*User) GetProfile added in v0.2.0

func (x *User) GetProfile() *Profile

func (*User) IntoPlain

func (pb *User) IntoPlain() *UserScanner

IntoPlain converts protobuf message to plain struct

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

func (x *User) ProtoReflect() protoreflect.Message

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

type UserAlias

type UserAlias string

UserAlias is the table alias type for the users table

const UserAliasName UserAlias = "users"

func (UserAlias) String

func (a UserAlias) String() string

type UserColumnAlias

type UserColumnAlias string

UserColumnAlias represents column names for the users table

const (
	UserColumnId               UserColumnAlias = "id"
	UserColumnCreatedAt        UserColumnAlias = "created_at"
	UserColumnUpdatedAt        UserColumnAlias = "updated_at"
	UserColumnEmail            UserColumnAlias = "email"
	UserColumnFullName         UserColumnAlias = "full_name"
	UserColumnIsActive         UserColumnAlias = "is_active"
	UserColumnEmailConfirmedAt UserColumnAlias = "email_confirmed_at"
	UserColumnNickname         UserColumnAlias = "nickname"
	UserColumnDeletedAt        UserColumnAlias = "deleted_at"
)

func (UserColumnAlias) String

func (c UserColumnAlias) String() string

type UserPreferences added in v0.4.7

type UserPreferences struct {
	Id     int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	// embed с serialize полями внутри
	Appearance *AppearanceSettings `protobuf:"bytes,3,opt,name=appearance,proto3" json:"appearance,omitempty"`
	// contains filtered or unexported fields
}

func (*UserPreferences) Descriptor deprecated added in v0.4.7

func (*UserPreferences) Descriptor() ([]byte, []int)

Deprecated: Use UserPreferences.ProtoReflect.Descriptor instead.

func (*UserPreferences) GetAppearance added in v0.4.7

func (x *UserPreferences) GetAppearance() *AppearanceSettings

func (*UserPreferences) GetId added in v0.4.7

func (x *UserPreferences) GetId() int64

func (*UserPreferences) GetUserId added in v0.4.7

func (x *UserPreferences) GetUserId() int64

func (*UserPreferences) IntoPlain added in v0.4.7

func (pb *UserPreferences) IntoPlain() *UserPreferencesScanner

IntoPlain converts protobuf message to plain struct

func (*UserPreferences) ProtoMessage added in v0.4.7

func (*UserPreferences) ProtoMessage()

func (*UserPreferences) ProtoReflect added in v0.4.7

func (x *UserPreferences) ProtoReflect() protoreflect.Message

func (*UserPreferences) Reset added in v0.4.7

func (x *UserPreferences) Reset()

func (*UserPreferences) String added in v0.4.7

func (x *UserPreferences) String() string

type UserPreferencesAlias added in v0.4.7

type UserPreferencesAlias string

UserPreferencesAlias is the table alias type for the user_preferences table

const UserPreferencesAliasName UserPreferencesAlias = "user_preferences"

func (UserPreferencesAlias) String added in v0.4.7

func (a UserPreferencesAlias) String() string

type UserPreferencesColumnAlias added in v0.4.7

type UserPreferencesColumnAlias string

UserPreferencesColumnAlias represents column names for the user_preferences table

const (
	UserPreferencesColumnId            UserPreferencesColumnAlias = "id"
	UserPreferencesColumnUserId        UserPreferencesColumnAlias = "user_id"
	UserPreferencesColumnSelectedTheme UserPreferencesColumnAlias = "selected_theme"
	UserPreferencesColumnFallbackTheme UserPreferencesColumnAlias = "fallback_theme"
)

func (UserPreferencesColumnAlias) String added in v0.4.7

type UserPreferencesScanner added in v0.4.7

type UserPreferencesScanner struct {
	Id            int64  `json:"id"`
	UserId        int64  `json:"userId"`
	SelectedTheme []byte `json:"selectedTheme"` // origin: serialized, empath: selected_theme
	FallbackTheme []byte `json:"fallbackTheme"` // origin: serialized, empath: fallback_theme
}

func (*UserPreferencesScanner) AllSetters added in v0.4.9

func (*UserPreferencesScanner) GetSetter added in v0.4.7

func (*UserPreferencesScanner) GetTarget added in v0.4.7

func (s *UserPreferencesScanner) GetTarget(col string) func() any

func (*UserPreferencesScanner) GetValue added in v0.4.7

func (*UserPreferencesScanner) IntoPb added in v0.4.7

IntoPb converts plain struct to protobuf message

func (*UserPreferencesScanner) Relations added in v0.4.7

Relations returns the relation loaders for the user_preferences table

type UserPreferencessTable added in v0.4.7

UserPreferencessTable represents the user_preferences table with its columns

type UserScanner

type UserScanner struct {
	Id               int64           `json:"id"` // origin: embed, empath: id
	CreatedAt        time.Time       `json:"createdAt"`
	UpdatedAt        time.Time       `json:"updatedAt"`
	Email            string          `json:"email"`
	FullName         string          `json:"fullName"`
	IsActive         bool            `json:"isActive"`
	EmailConfirmedAt *time.Time      `json:"emailConfirmedAt,omitempty"`
	Nickname         *string         `json:"nickname,omitempty"`
	DeletedAt        *time.Time      `json:"deletedAt,omitempty"`
	Orders           []OrderScanner  `json:"orders"`
	Profile          *ProfileScanner `json:"profile"`
}

============================================================================

User - пользователь системы (с BaseEntity)
============================================================================

func (*UserScanner) AllSetters added in v0.4.9

func (s *UserScanner) AllSetters() []set.ValueSetter[UserColumnAlias]

func (*UserScanner) GetSetter

func (s *UserScanner) GetSetter(f UserColumnAlias) func() set.ValueSetter[UserColumnAlias]

func (*UserScanner) GetTarget

func (s *UserScanner) GetTarget(col string) func() any

func (*UserScanner) GetValue

func (s *UserScanner) GetValue(f UserColumnAlias) func() any

func (*UserScanner) IntoPb

func (p *UserScanner) IntoPb() *User

IntoPb converts plain struct to protobuf message

func (*UserScanner) Relations

func (s *UserScanner) Relations() []exec.RelationLoader[*UserScanner]

Relations returns the relation loaders for the users table

type UserSettings added in v0.4.7

type UserSettings struct {
	Id     int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	// serialize = true: message -> []byte via proto.Marshal/Unmarshal
	Theme *ThemeConfig `protobuf:"bytes,3,opt,name=theme,proto3" json:"theme,omitempty"`
	// contains filtered or unexported fields
}

Тест: serialize = true на message поле (прямое — не embedded)

func (*UserSettings) Descriptor deprecated added in v0.4.7

func (*UserSettings) Descriptor() ([]byte, []int)

Deprecated: Use UserSettings.ProtoReflect.Descriptor instead.

func (*UserSettings) GetId added in v0.4.7

func (x *UserSettings) GetId() int64

func (*UserSettings) GetTheme added in v0.4.7

func (x *UserSettings) GetTheme() *ThemeConfig

func (*UserSettings) GetUserId added in v0.4.7

func (x *UserSettings) GetUserId() int64

func (*UserSettings) IntoPlain added in v0.4.7

func (pb *UserSettings) IntoPlain() *UserSettingsScanner

IntoPlain converts protobuf message to plain struct

func (*UserSettings) ProtoMessage added in v0.4.7

func (*UserSettings) ProtoMessage()

func (*UserSettings) ProtoReflect added in v0.4.7

func (x *UserSettings) ProtoReflect() protoreflect.Message

func (*UserSettings) Reset added in v0.4.7

func (x *UserSettings) Reset()

func (*UserSettings) String added in v0.4.7

func (x *UserSettings) String() string

type UserSettingsAlias added in v0.4.7

type UserSettingsAlias string

UserSettingsAlias is the table alias type for the user_settings table

const UserSettingsAliasName UserSettingsAlias = "user_settings"

func (UserSettingsAlias) String added in v0.4.7

func (a UserSettingsAlias) String() string

type UserSettingsColumnAlias added in v0.4.7

type UserSettingsColumnAlias string

UserSettingsColumnAlias represents column names for the user_settings table

const (
	UserSettingsColumnId     UserSettingsColumnAlias = "id"
	UserSettingsColumnUserId UserSettingsColumnAlias = "user_id"
	UserSettingsColumnTheme  UserSettingsColumnAlias = "theme"
)

func (UserSettingsColumnAlias) String added in v0.4.7

func (c UserSettingsColumnAlias) String() string

type UserSettingsScanner added in v0.4.7

type UserSettingsScanner struct {
	Id     int64  `json:"id"`
	UserId int64  `json:"userId"`
	Theme  []byte `json:"theme"` // origin: serialized, empath: theme
}

Тест: serialize = true на message поле (прямое — не embedded)

func (*UserSettingsScanner) AllSetters added in v0.4.9

func (*UserSettingsScanner) GetSetter added in v0.4.7

func (*UserSettingsScanner) GetTarget added in v0.4.7

func (s *UserSettingsScanner) GetTarget(col string) func() any

func (*UserSettingsScanner) GetValue added in v0.4.7

func (s *UserSettingsScanner) GetValue(f UserSettingsColumnAlias) func() any

func (*UserSettingsScanner) IntoPb added in v0.4.7

func (p *UserSettingsScanner) IntoPb() *UserSettings

IntoPb converts plain struct to protobuf message

func (*UserSettingsScanner) Relations added in v0.4.7

Relations returns the relation loaders for the user_settings table

type UserSettingssTable added in v0.4.7

UserSettingssTable represents the user_settings table with its columns

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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