Files
zitadel/backend/v3/domain/instance.go

66 lines
1.8 KiB
Go
Raw Normal View History

2025-04-29 06:03:47 +02:00
package domain
import (
"context"
"time"
2025-05-08 07:42:53 +02:00
"github.com/zitadel/zitadel/backend/v3/storage/database"
2025-04-29 06:03:47 +02:00
)
type Instance struct {
ID string `json:"id"`
Name string `json:"name"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
DeletedAt time.Time `json:"-"`
}
// Keys implements the [cache.Entry].
func (i *Instance) Keys(index string) (key []string) {
// TODO: Return the correct keys for the instance cache, e.g., i.ID, i.Domain
return []string{}
}
2025-05-08 07:42:53 +02:00
type instanceColumns interface {
// IDColumn returns the column for the id field.
IDColumn() database.Column
// NameColumn returns the column for the name field.
NameColumn() database.Column
// CreatedAtColumn returns the column for the created at field.
CreatedAtColumn() database.Column
// UpdatedAtColumn returns the column for the updated at field.
UpdatedAtColumn() database.Column
// DeletedAtColumn returns the column for the deleted at field.
DeletedAtColumn() database.Column
}
type instanceConditions interface {
// IDCondition returns an equal filter on the id field.
IDCondition(instanceID string) database.Condition
// NameCondition returns a filter on the name field.
NameCondition(op database.TextOperation, name string) database.Condition
}
type instanceChanges interface {
// SetName sets the name column.
SetName(name string) database.Change
2025-04-29 06:03:47 +02:00
}
2025-05-08 07:42:53 +02:00
type InstanceRepository interface {
instanceColumns
instanceConditions
instanceChanges
Member() MemberRepository
Get(ctx context.Context, opts ...database.QueryOption) (*Instance, error)
Create(ctx context.Context, instance *Instance) error
Update(ctx context.Context, condition database.Condition, changes ...database.Change) error
Delete(ctx context.Context, condition database.Condition) error
2025-04-29 06:03:47 +02:00
}
type CreateInstance struct {
Name string `json:"name"`
}