blog_category.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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) Id() int {
  13. if this == nil {
  14. return 0
  15. }
  16. return this.object.A_id
  17. }
  18. func (this *BlogCategory) User() *User {
  19. if this == nil {
  20. return nil
  21. }
  22. if this.user != nil {
  23. return this.user
  24. }
  25. this.user = &User{wrap: this.wrap}
  26. this.user.load(this.object.A_user)
  27. return this.user
  28. }
  29. func (this *BlogCategory) Name() string {
  30. if this == nil {
  31. return ""
  32. }
  33. return this.object.A_name
  34. }
  35. func (this *BlogCategory) Alias() string {
  36. if this == nil {
  37. return ""
  38. }
  39. return this.object.A_alias
  40. }
  41. func (this *BlogCategory) Left() int {
  42. if this == nil {
  43. return 0
  44. }
  45. return this.object.A_lft
  46. }
  47. func (this *BlogCategory) Right() int {
  48. if this == nil {
  49. return 0
  50. }
  51. return this.object.A_rgt
  52. }
  53. func (this *BlogCategory) Permalink() string {
  54. if this == nil {
  55. return ""
  56. }
  57. return "/blog/category/" + this.object.A_alias + "/"
  58. }
  59. func (this *BlogCategory) Level() int {
  60. if this == nil {
  61. return 0
  62. }
  63. return this.depth
  64. }