- Start a Postgres instance, for example
docker run -p 5432:5432 -e POSTGRES_PASSWORD=password -d docker
- Open a psql client shell
psql -h localhost -p 5432 -U postgres -d postgres
Password for user postgres: <enter password>
INSERT INTO tuples VALUES ('document', '1', 'viewer', 'editor', 'document', '1'); |
version: "3" | |
services: | |
postgres: | |
image: postgres | |
ports: | |
- 5432:5432 | |
restart: always | |
environment: | |
POSTGRES_PASSWORD: password | |
command: |
fga index create \ | |
--name group_member_user_index \ | |
--user-type=user \ | |
--relation=member \ | |
--object-type=group \ | |
--out views.sql | |
Output: | |
--- views.sql |
t.Run("dispatch_direct_userset_lookups", func(t *testing.T) { | |
ds := memory.New() | |
ctx := storage.ContextWithRelationshipTupleReader(context.Background(), ds) | |
storeID := ulid.Make().String() | |
model := parser.MustTransformDSLToProto(`model | |
schema 1.1 | |
type user |
package lookup | |
import ( | |
"context" | |
"fmt" | |
"sync/atomic" | |
openfgapb "go.buf.build/openfga/go/openfga/api/openfga/v1" | |
"golang.org/x/sync/errgroup" | |
) |
package lookup | |
import ( | |
"fmt" | |
openfgapb "go.buf.build/openfga/go/openfga/api/openfga/v1" | |
"golang.org/x/sync/errgroup" | |
) | |
func Lookup(req *openfgapb.LookupRequest, srv openfgapb.OpenFGAService_LookupServer) error { |
swagger: "2.0" | |
info: | |
description: | | |
A simple Pubsub messaging API that allows clients to: | |
* Publish messages to a Topic | |
* Create Subscriptions to a Topic | |
* Pull messages from Subscriptions | |
* Acknowledge receipt of the messages delivered to a Subscription. | |
Example: |
int solve(formula* form) | |
{ | |
/* Create the structures to store the state of the | |
* algorithm */ | |
bool *assigned = (bool *) calloc(form->nvars + 1, sizeof(bool)); | |
bool *vals = (bool *) calloc(form->nvars + 1, sizeof(bool)); | |
stack_item **sitems = (stack_item **) malloc(form->nvars * sizeof(stack_item*)); | |
stack s; | |
s.items = sitems; |
// Get a pointer to the literal that needs assignment, if one exists | |
if ((lp = is_unitclause(form->clauses[i], assigned, vals)) != NULL) | |
{ | |
assert_literal(lp, vals, assigned); | |
stack_item si = {lp, i, 0}; | |
push_stack(&s, &si); | |
} | |