blog_category.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package fetdata
  2. import (
  3. "golang-fave/engine/wrapper"
  4. "golang-fave/utils"
  5. )
  6. type BlogCategory struct {
  7. wrap *wrapper.Wrapper
  8. object *utils.MySql_blog_category
  9. depth int
  10. user *User
  11. }
  12. func (this *BlogCategory) load() *BlogCategory {
  13. return this
  14. }
  15. func (this *BlogCategory) Id() int {
  16. if this == nil {
  17. return 0
  18. }
  19. return this.object.A_id
  20. }
  21. func (this *BlogCategory) User() *User {
  22. if this == nil {
  23. return nil
  24. }
  25. if this.user != nil {
  26. return this.user
  27. }
  28. this.user = &User{wrap: this.wrap}
  29. this.user.loadById(this.object.A_user)
  30. return this.user
  31. }
  32. func (this *BlogCategory) Name() string {
  33. if this == nil {
  34. return ""
  35. }
  36. return this.object.A_name
  37. }
  38. func (this *BlogCategory) Alias() string {
  39. if this == nil {
  40. return ""
  41. }
  42. return this.object.A_alias
  43. }
  44. func (this *BlogCategory) Left() int {
  45. if this == nil {
  46. return 0
  47. }
  48. return this.object.A_lft
  49. }
  50. func (this *BlogCategory) Right() int {
  51. if this == nil {
  52. return 0
  53. }
  54. return this.object.A_rgt
  55. }
  56. func (this *BlogCategory) Permalink() string {
  57. if this == nil {
  58. return ""
  59. }
  60. return "/blog/category/" + this.object.A_alias + "/"
  61. }
  62. func (this *BlogCategory) Level() int {
  63. if this == nil {
  64. return 0
  65. }
  66. return this.depth
  67. }