employee.go 14 KB

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