employee.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. // Code generated by ent, DO NOT EDIT.
  2. package employee
  3. import (
  4. "time"
  5. "entgo.io/ent"
  6. "entgo.io/ent/dialect/sql"
  7. "entgo.io/ent/dialect/sql/sqlgraph"
  8. )
  9. const (
  10. // Label holds the string label denoting the employee type in the database.
  11. Label = "employee"
  12. // FieldID holds the string denoting the id field in the database.
  13. FieldID = "id"
  14. // FieldCreatedAt holds the string denoting the created_at field in the database.
  15. FieldCreatedAt = "created_at"
  16. // FieldUpdatedAt holds the string denoting the updated_at field in the database.
  17. FieldUpdatedAt = "updated_at"
  18. // FieldDeletedAt holds the string denoting the deleted_at field in the database.
  19. FieldDeletedAt = "deleted_at"
  20. // FieldTitle holds the string denoting the title field in the database.
  21. FieldTitle = "title"
  22. // FieldAvatar holds the string denoting the avatar field in the database.
  23. FieldAvatar = "avatar"
  24. // FieldTags holds the string denoting the tags field in the database.
  25. FieldTags = "tags"
  26. // FieldHireCount holds the string denoting the hire_count field in the database.
  27. FieldHireCount = "hire_count"
  28. // FieldServiceCount holds the string denoting the service_count field in the database.
  29. FieldServiceCount = "service_count"
  30. // FieldAchievementCount holds the string denoting the achievement_count field in the database.
  31. FieldAchievementCount = "achievement_count"
  32. // FieldIntro holds the string denoting the intro field in the database.
  33. FieldIntro = "intro"
  34. // FieldEstimate holds the string denoting the estimate field in the database.
  35. FieldEstimate = "estimate"
  36. // FieldSkill holds the string denoting the skill field in the database.
  37. FieldSkill = "skill"
  38. // FieldAbilityType holds the string denoting the ability_type field in the database.
  39. FieldAbilityType = "ability_type"
  40. // FieldScene holds the string denoting the scene field in the database.
  41. FieldScene = "scene"
  42. // FieldSwitchIn holds the string denoting the switch_in field in the database.
  43. FieldSwitchIn = "switch_in"
  44. // FieldVideoURL holds the string denoting the video_url field in the database.
  45. FieldVideoURL = "video_url"
  46. // FieldOrganizationID holds the string denoting the organization_id field in the database.
  47. FieldOrganizationID = "organization_id"
  48. // FieldCategoryID holds the string denoting the category_id field in the database.
  49. FieldCategoryID = "category_id"
  50. // EdgeEmWorkExperiences holds the string denoting the em_work_experiences edge name in mutations.
  51. EdgeEmWorkExperiences = "em_work_experiences"
  52. // EdgeEmTutorial holds the string denoting the em_tutorial edge name in mutations.
  53. EdgeEmTutorial = "em_tutorial"
  54. // Table holds the table name of the employee in the database.
  55. Table = "employee"
  56. // EmWorkExperiencesTable is the table that holds the em_work_experiences relation/edge.
  57. EmWorkExperiencesTable = "work_experience"
  58. // EmWorkExperiencesInverseTable is the table name for the WorkExperience entity.
  59. // It exists in this package in order to avoid circular dependency with the "workexperience" package.
  60. EmWorkExperiencesInverseTable = "work_experience"
  61. // EmWorkExperiencesColumn is the table column denoting the em_work_experiences relation/edge.
  62. EmWorkExperiencesColumn = "employee_id"
  63. // EmTutorialTable is the table that holds the em_tutorial relation/edge.
  64. EmTutorialTable = "tutorial"
  65. // EmTutorialInverseTable is the table name for the Tutorial entity.
  66. // It exists in this package in order to avoid circular dependency with the "tutorial" package.
  67. EmTutorialInverseTable = "tutorial"
  68. // EmTutorialColumn is the table column denoting the em_tutorial relation/edge.
  69. EmTutorialColumn = "employee_id"
  70. )
  71. // Columns holds all SQL columns for employee fields.
  72. var Columns = []string{
  73. FieldID,
  74. FieldCreatedAt,
  75. FieldUpdatedAt,
  76. FieldDeletedAt,
  77. FieldTitle,
  78. FieldAvatar,
  79. FieldTags,
  80. FieldHireCount,
  81. FieldServiceCount,
  82. FieldAchievementCount,
  83. FieldIntro,
  84. FieldEstimate,
  85. FieldSkill,
  86. FieldAbilityType,
  87. FieldScene,
  88. FieldSwitchIn,
  89. FieldVideoURL,
  90. FieldOrganizationID,
  91. FieldCategoryID,
  92. }
  93. // ValidColumn reports if the column name is valid (part of the table columns).
  94. func ValidColumn(column string) bool {
  95. for i := range Columns {
  96. if column == Columns[i] {
  97. return true
  98. }
  99. }
  100. return false
  101. }
  102. // Note that the variables below are initialized by the runtime
  103. // package on the initialization of the application. Therefore,
  104. // it should be imported in the main as follows:
  105. //
  106. // import _ "wechat-api/ent/runtime"
  107. var (
  108. Hooks [1]ent.Hook
  109. Interceptors [1]ent.Interceptor
  110. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  111. DefaultCreatedAt func() time.Time
  112. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  113. DefaultUpdatedAt func() time.Time
  114. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  115. UpdateDefaultUpdatedAt func() time.Time
  116. // TitleValidator is a validator for the "title" field. It is called by the builders before save.
  117. TitleValidator func(string) error
  118. // AvatarValidator is a validator for the "avatar" field. It is called by the builders before save.
  119. AvatarValidator func(string) error
  120. // TagsValidator is a validator for the "tags" field. It is called by the builders before save.
  121. TagsValidator func(string) error
  122. // DefaultHireCount holds the default value on creation for the "hire_count" field.
  123. DefaultHireCount int
  124. // HireCountValidator is a validator for the "hire_count" field. It is called by the builders before save.
  125. HireCountValidator func(int) error
  126. // DefaultServiceCount holds the default value on creation for the "service_count" field.
  127. DefaultServiceCount int
  128. // ServiceCountValidator is a validator for the "service_count" field. It is called by the builders before save.
  129. ServiceCountValidator func(int) error
  130. // DefaultAchievementCount holds the default value on creation for the "achievement_count" field.
  131. DefaultAchievementCount int
  132. // AchievementCountValidator is a validator for the "achievement_count" field. It is called by the builders before save.
  133. AchievementCountValidator func(int) error
  134. // DefaultIntro holds the default value on creation for the "intro" field.
  135. DefaultIntro string
  136. // IntroValidator is a validator for the "intro" field. It is called by the builders before save.
  137. IntroValidator func(string) error
  138. // DefaultEstimate holds the default value on creation for the "estimate" field.
  139. DefaultEstimate string
  140. // EstimateValidator is a validator for the "estimate" field. It is called by the builders before save.
  141. EstimateValidator func(string) error
  142. // DefaultSkill holds the default value on creation for the "skill" field.
  143. DefaultSkill string
  144. // SkillValidator is a validator for the "skill" field. It is called by the builders before save.
  145. SkillValidator func(string) error
  146. // DefaultAbilityType holds the default value on creation for the "ability_type" field.
  147. DefaultAbilityType string
  148. // DefaultScene holds the default value on creation for the "scene" field.
  149. DefaultScene string
  150. // DefaultSwitchIn holds the default value on creation for the "switch_in" field.
  151. DefaultSwitchIn string
  152. // DefaultVideoURL holds the default value on creation for the "video_url" field.
  153. DefaultVideoURL string
  154. // VideoURLValidator is a validator for the "video_url" field. It is called by the builders before save.
  155. VideoURLValidator func(string) error
  156. // OrganizationIDValidator is a validator for the "organization_id" field. It is called by the builders before save.
  157. OrganizationIDValidator func(uint64) error
  158. // CategoryIDValidator is a validator for the "category_id" field. It is called by the builders before save.
  159. CategoryIDValidator func(uint64) error
  160. )
  161. // OrderOption defines the ordering options for the Employee queries.
  162. type OrderOption func(*sql.Selector)
  163. // ByID orders the results by the id field.
  164. func ByID(opts ...sql.OrderTermOption) OrderOption {
  165. return sql.OrderByField(FieldID, opts...).ToFunc()
  166. }
  167. // ByCreatedAt orders the results by the created_at field.
  168. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  169. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  170. }
  171. // ByUpdatedAt orders the results by the updated_at field.
  172. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  173. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  174. }
  175. // ByDeletedAt orders the results by the deleted_at field.
  176. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  177. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  178. }
  179. // ByTitle orders the results by the title field.
  180. func ByTitle(opts ...sql.OrderTermOption) OrderOption {
  181. return sql.OrderByField(FieldTitle, opts...).ToFunc()
  182. }
  183. // ByAvatar orders the results by the avatar field.
  184. func ByAvatar(opts ...sql.OrderTermOption) OrderOption {
  185. return sql.OrderByField(FieldAvatar, opts...).ToFunc()
  186. }
  187. // ByTags orders the results by the tags field.
  188. func ByTags(opts ...sql.OrderTermOption) OrderOption {
  189. return sql.OrderByField(FieldTags, opts...).ToFunc()
  190. }
  191. // ByHireCount orders the results by the hire_count field.
  192. func ByHireCount(opts ...sql.OrderTermOption) OrderOption {
  193. return sql.OrderByField(FieldHireCount, opts...).ToFunc()
  194. }
  195. // ByServiceCount orders the results by the service_count field.
  196. func ByServiceCount(opts ...sql.OrderTermOption) OrderOption {
  197. return sql.OrderByField(FieldServiceCount, opts...).ToFunc()
  198. }
  199. // ByAchievementCount orders the results by the achievement_count field.
  200. func ByAchievementCount(opts ...sql.OrderTermOption) OrderOption {
  201. return sql.OrderByField(FieldAchievementCount, opts...).ToFunc()
  202. }
  203. // ByIntro orders the results by the intro field.
  204. func ByIntro(opts ...sql.OrderTermOption) OrderOption {
  205. return sql.OrderByField(FieldIntro, opts...).ToFunc()
  206. }
  207. // ByEstimate orders the results by the estimate field.
  208. func ByEstimate(opts ...sql.OrderTermOption) OrderOption {
  209. return sql.OrderByField(FieldEstimate, opts...).ToFunc()
  210. }
  211. // BySkill orders the results by the skill field.
  212. func BySkill(opts ...sql.OrderTermOption) OrderOption {
  213. return sql.OrderByField(FieldSkill, opts...).ToFunc()
  214. }
  215. // ByAbilityType orders the results by the ability_type field.
  216. func ByAbilityType(opts ...sql.OrderTermOption) OrderOption {
  217. return sql.OrderByField(FieldAbilityType, opts...).ToFunc()
  218. }
  219. // ByScene orders the results by the scene field.
  220. func ByScene(opts ...sql.OrderTermOption) OrderOption {
  221. return sql.OrderByField(FieldScene, opts...).ToFunc()
  222. }
  223. // BySwitchIn orders the results by the switch_in field.
  224. func BySwitchIn(opts ...sql.OrderTermOption) OrderOption {
  225. return sql.OrderByField(FieldSwitchIn, opts...).ToFunc()
  226. }
  227. // ByVideoURL orders the results by the video_url field.
  228. func ByVideoURL(opts ...sql.OrderTermOption) OrderOption {
  229. return sql.OrderByField(FieldVideoURL, opts...).ToFunc()
  230. }
  231. // ByOrganizationID orders the results by the organization_id field.
  232. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  233. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  234. }
  235. // ByCategoryID orders the results by the category_id field.
  236. func ByCategoryID(opts ...sql.OrderTermOption) OrderOption {
  237. return sql.OrderByField(FieldCategoryID, opts...).ToFunc()
  238. }
  239. // ByEmWorkExperiencesCount orders the results by em_work_experiences count.
  240. func ByEmWorkExperiencesCount(opts ...sql.OrderTermOption) OrderOption {
  241. return func(s *sql.Selector) {
  242. sqlgraph.OrderByNeighborsCount(s, newEmWorkExperiencesStep(), opts...)
  243. }
  244. }
  245. // ByEmWorkExperiences orders the results by em_work_experiences terms.
  246. func ByEmWorkExperiences(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  247. return func(s *sql.Selector) {
  248. sqlgraph.OrderByNeighborTerms(s, newEmWorkExperiencesStep(), append([]sql.OrderTerm{term}, terms...)...)
  249. }
  250. }
  251. // ByEmTutorialCount orders the results by em_tutorial count.
  252. func ByEmTutorialCount(opts ...sql.OrderTermOption) OrderOption {
  253. return func(s *sql.Selector) {
  254. sqlgraph.OrderByNeighborsCount(s, newEmTutorialStep(), opts...)
  255. }
  256. }
  257. // ByEmTutorial orders the results by em_tutorial terms.
  258. func ByEmTutorial(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  259. return func(s *sql.Selector) {
  260. sqlgraph.OrderByNeighborTerms(s, newEmTutorialStep(), append([]sql.OrderTerm{term}, terms...)...)
  261. }
  262. }
  263. func newEmWorkExperiencesStep() *sqlgraph.Step {
  264. return sqlgraph.NewStep(
  265. sqlgraph.From(Table, FieldID),
  266. sqlgraph.To(EmWorkExperiencesInverseTable, FieldID),
  267. sqlgraph.Edge(sqlgraph.O2M, false, EmWorkExperiencesTable, EmWorkExperiencesColumn),
  268. )
  269. }
  270. func newEmTutorialStep() *sqlgraph.Step {
  271. return sqlgraph.NewStep(
  272. sqlgraph.From(Table, FieldID),
  273. sqlgraph.To(EmTutorialInverseTable, FieldID),
  274. sqlgraph.Edge(sqlgraph.O2M, false, EmTutorialTable, EmTutorialColumn),
  275. )
  276. }