Repository
Accessing a Repository
userRepo := client.UserRepo()
postRepo := client.PostRepo()
followsRepo := client.FollowsRepo() // Edge repositoryRepository Interface
type UserRepo interface {
Create(ctx context.Context, user *model.User) error
CreateWithID(ctx context.Context, id string, user *model.User) error
Insert(ctx context.Context, users []*model.User) error
Read(ctx context.Context, id string) (*model.User, bool, error)
Update(ctx context.Context, user *model.User) error
Delete(ctx context.Context, user *model.User) error
Refresh(ctx context.Context, user *model.User) error
Query() query.Builder[model.User]
// Index access (e.g. per-index Rebuild)
Index() *index.User
// Lifecycle hooks
OnBeforeCreate(fn func(ctx context.Context, node *model.User) error) func()
OnAfterCreate(fn func(ctx context.Context, node *model.User) error) func()
OnBeforeUpdate(fn func(ctx context.Context, node *model.User) error) func()
OnAfterUpdate(fn func(ctx context.Context, node *model.User) error) func()
OnBeforeDelete(fn func(ctx context.Context, node *model.User) error) func()
OnAfterDelete(fn func(ctx context.Context, node *model.User) error) func()
}Create
CreateWithID
Insert
Read
Update
Delete
Refresh
Index
Query
Lifecycle Hooks
Hook
When
Edge Repository (Relate)
Complete Example
Error Handling
Last updated