student_dao.h 871 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2006-2020, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020-03-10 lizhen9880 first version
  9. */
  10. #ifndef __STUDENT_DAO_H__
  11. #define __STUDENT_DAO_H__
  12. #include <rtthread.h>
  13. struct student
  14. {
  15. unsigned int id;
  16. char name[32];
  17. int score;
  18. rt_list_t list;
  19. };
  20. typedef struct student student_t;
  21. /**
  22. * ASC:Ascending
  23. * DESC:Descending
  24. * */
  25. enum order_type
  26. {
  27. ASC = 0,
  28. DESC = 1,
  29. };
  30. int student_get_by_id(student_t *e, int id);
  31. int student_get_by_score(rt_list_t *h, int ls, int hs, enum order_type order);
  32. int student_get_all(rt_list_t *q);
  33. int student_add(rt_list_t *h);
  34. int student_del(int id);
  35. int student_del_all(void);
  36. int student_update(student_t *e);
  37. void student_free_list(rt_list_t *h);
  38. void student_print_list(rt_list_t *q);
  39. #endif