FindLatestAuthorizationModel see [storage.AuthorizationModelReadBackend].FindLatestAuthorizationModel.
(ctx context.Context, store string)
| 930 | |
| 931 | // FindLatestAuthorizationModel see [storage.AuthorizationModelReadBackend].FindLatestAuthorizationModel. |
| 932 | func (s *Datastore) FindLatestAuthorizationModel(ctx context.Context, store string) (*openfgav1.AuthorizationModel, error) { |
| 933 | ctx, span := startTrace(ctx, "FindLatestAuthorizationModel") |
| 934 | defer span.End() |
| 935 | |
| 936 | db := s.getPgxPool(openfgav1.ConsistencyPreference_MINIMIZE_LATENCY) |
| 937 | stmt, args, err := sq.StatementBuilder.PlaceholderFormat(sq.Dollar). |
| 938 | Select("authorization_model_id", "schema_version", "type", "type_definition", "serialized_protobuf"). |
| 939 | From("authorization_model"). |
| 940 | Where(sq.Eq{"store": store}). |
| 941 | OrderBy("authorization_model_id desc").ToSql() |
| 942 | if err != nil { |
| 943 | return nil, HandleSQLError(err) |
| 944 | } |
| 945 | rows, err := db.Query(ctx, stmt, args...) |
| 946 | if err != nil { |
| 947 | return nil, HandleSQLError(err) |
| 948 | } |
| 949 | defer rows.Close() |
| 950 | ret, err := sqlcommon.ConstructAuthorizationModelFromSQLRows(&pgxRowsWrapper{rows}) |
| 951 | if err != nil { |
| 952 | return nil, HandleSQLError(err) |
| 953 | } |
| 954 | |
| 955 | return ret, nil |
| 956 | } |
| 957 | |
| 958 | // MaxTypesPerAuthorizationModel see [storage.TypeDefinitionWriteBackend].MaxTypesPerAuthorizationModel. |
| 959 | func (s *Datastore) MaxTypesPerAuthorizationModel() int { |
nothing calls this directly
no test coverage detected