Skip to content

DatabaseView join query field naming convention #688

Answered by dkaera
pratamatama asked this question in Q&A
Discussion options

You must be logged in to vote

@pratamatama I think we should follow the Dart language naming convention anyway. This means avoid using the possessive forms in naming.
So in your case will be correct:

import 'package:floor/floor.dart';

@DatabaseView(
  'SELECT'
  ' categories.id, categories.name, categories.label_color,'
  ' categories.created_at, categories.updated_at, menus.id,'
  ' menus.name, menus.price, menus.created_at, menus.updated_at '
  'FROM menus'
  'INNER JOIN categories ON categories.id = menus.category_id',
)
class CategoryMenu {
  late int menuId;
  late int categoryId;

  late String menuName;
  late String categoryName;
}

// if I want to use [menuId] instead of [menusId], should I make an alias on

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pratamatama
Comment options

Answer selected by pratamatama
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants