supa_query_annotation 0.1.0 copy "supa_query_annotation: ^0.1.0" to clipboard
supa_query_annotation: ^0.1.0 copied to clipboard

Dart annotations for declarative Supabase custom queries. Used with suparepo for code generation.

supa_query_annotation #

Dart annotations for declarative Supabase custom queries. Used with suparepo for code generation.

Installation #

dependencies:
  supa_query_annotation: ^0.1.0

Usage #

Annotate method stubs in .custom.dart extension files:

import 'package:supa_query_annotation/supa_query_annotation.dart';

extension HomeBannersRepositoryCustom on HomeBannersRepository {
  @SupaQuery(
    filters: [
      Filter.eq('is_active', true),
      Filter.lte('started_at', Param.now),
      Filter.gt('ended_at', Param.now),
    ],
    order: [OrderBy('sort_order')],
  )
  Future<List<HomeBanners>> getActive() =>
      throw UnimplementedError();
}

Run dart run suparepo to generate the implementation.

Annotations #

Annotation Description
@SupaQuery Main annotation with filters, order, limit, select, returnMode, resultModel
Filter.eq(col, val) PostgREST filter operators (eq, neq, lt, lte, gt, gte, like, ilike, is_, in_, contains, overlaps)
Param('name') Runtime method parameter injection
Param.now Runtime DateTime.now().toUtc().toIso8601String()
OrderBy('col') / OrderBy.desc('col') Sort clause with optional nullsFirst
ReturnMode.list / .single / .maybeSingle Return type control

License #

MIT

0
likes
150
points
81
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Dart annotations for declarative Supabase custom queries. Used with suparepo for code generation.

Homepage
Repository (GitHub)
View/report issues

Topics

#supabase #annotation #code-generation #query-builder #postgresql

License

MIT (license)

More

Packages that depend on supa_query_annotation