(no commit message provided)

This commit is contained in:
Prad Nukala
2024-08-10 17:01:14 -04:00
committed by Prad Nukala (aider)
parent 24db9de0ad
commit 2923b8866b
23 changed files with 9499 additions and 1677 deletions
+13 -13
View File
@@ -17,9 +17,9 @@ type AliasesTable interface {
Has(ctx context.Context, id string) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, id string) (*Aliases, error)
HasByHandle(ctx context.Context, handle string) (found bool, err error)
// GetByHandle returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByHandle(ctx context.Context, handle string) (*Aliases, error)
HasBySubject(ctx context.Context, subject string) (found bool, err error)
// GetBySubject returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetBySubject(ctx context.Context, subject string) (*Aliases, error)
List(ctx context.Context, prefixKey AliasesIndexKey, opts ...ormlist.Option) (AliasesIterator, error)
ListRange(ctx context.Context, from, to AliasesIndexKey, opts ...ormlist.Option) (AliasesIterator, error)
DeleteBy(ctx context.Context, prefixKey AliasesIndexKey) error
@@ -60,16 +60,16 @@ func (this AliasesIdIndexKey) WithId(id string) AliasesIdIndexKey {
return this
}
type AliasesHandleIndexKey struct {
type AliasesSubjectIndexKey struct {
vs []interface{}
}
func (x AliasesHandleIndexKey) id() uint32 { return 1 }
func (x AliasesHandleIndexKey) values() []interface{} { return x.vs }
func (x AliasesHandleIndexKey) aliasesIndexKey() {}
func (x AliasesSubjectIndexKey) id() uint32 { return 1 }
func (x AliasesSubjectIndexKey) values() []interface{} { return x.vs }
func (x AliasesSubjectIndexKey) aliasesIndexKey() {}
func (this AliasesHandleIndexKey) WithHandle(handle string) AliasesHandleIndexKey {
this.vs = []interface{}{handle}
func (this AliasesSubjectIndexKey) WithSubject(subject string) AliasesSubjectIndexKey {
this.vs = []interface{}{subject}
return this
}
@@ -109,16 +109,16 @@ func (this aliasesTable) Get(ctx context.Context, id string) (*Aliases, error) {
return &aliases, nil
}
func (this aliasesTable) HasByHandle(ctx context.Context, handle string) (found bool, err error) {
func (this aliasesTable) HasBySubject(ctx context.Context, subject string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
handle,
subject,
)
}
func (this aliasesTable) GetByHandle(ctx context.Context, handle string) (*Aliases, error) {
func (this aliasesTable) GetBySubject(ctx context.Context, subject string) (*Aliases, error) {
var aliases Aliases
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &aliases,
handle,
subject,
)
if err != nil {
return nil, err