github.com/ngocphuongnb/tetua@v0.0.7-alpha/packages/entrepository/ent/post/post.go (about)

     1  // Code generated by entc, DO NOT EDIT.
     2  
     3  package post
     4  
     5  import (
     6  	"time"
     7  )
     8  
     9  const (
    10  	// Label holds the string label denoting the post type in the database.
    11  	Label = "post"
    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  	// FieldName holds the string denoting the name field in the database.
    21  	FieldName = "name"
    22  	// FieldSlug holds the string denoting the slug field in the database.
    23  	FieldSlug = "slug"
    24  	// FieldDescription holds the string denoting the description field in the database.
    25  	FieldDescription = "description"
    26  	// FieldContent holds the string denoting the content field in the database.
    27  	FieldContent = "content"
    28  	// FieldContentHTML holds the string denoting the content_html field in the database.
    29  	FieldContentHTML = "content_html"
    30  	// FieldViewCount holds the string denoting the view_count field in the database.
    31  	FieldViewCount = "view_count"
    32  	// FieldCommentCount holds the string denoting the comment_count field in the database.
    33  	FieldCommentCount = "comment_count"
    34  	// FieldRatingCount holds the string denoting the rating_count field in the database.
    35  	FieldRatingCount = "rating_count"
    36  	// FieldRatingTotal holds the string denoting the rating_total field in the database.
    37  	FieldRatingTotal = "rating_total"
    38  	// FieldDraft holds the string denoting the draft field in the database.
    39  	FieldDraft = "draft"
    40  	// FieldApproved holds the string denoting the approved field in the database.
    41  	FieldApproved = "approved"
    42  	// FieldFeaturedImageID holds the string denoting the featured_image_id field in the database.
    43  	FieldFeaturedImageID = "featured_image_id"
    44  	// FieldUserID holds the string denoting the user_id field in the database.
    45  	FieldUserID = "user_id"
    46  	// EdgeUser holds the string denoting the user edge name in mutations.
    47  	EdgeUser = "user"
    48  	// EdgeTopics holds the string denoting the topics edge name in mutations.
    49  	EdgeTopics = "topics"
    50  	// EdgeFeaturedImage holds the string denoting the featured_image edge name in mutations.
    51  	EdgeFeaturedImage = "featured_image"
    52  	// EdgeComments holds the string denoting the comments edge name in mutations.
    53  	EdgeComments = "comments"
    54  	// Table holds the table name of the post in the database.
    55  	Table = "posts"
    56  	// UserTable is the table that holds the user relation/edge.
    57  	UserTable = "posts"
    58  	// UserInverseTable is the table name for the User entity.
    59  	// It exists in this package in order to avoid circular dependency with the "user" package.
    60  	UserInverseTable = "users"
    61  	// UserColumn is the table column denoting the user relation/edge.
    62  	UserColumn = "user_id"
    63  	// TopicsTable is the table that holds the topics relation/edge. The primary key declared below.
    64  	TopicsTable = "topic_posts"
    65  	// TopicsInverseTable is the table name for the Topic entity.
    66  	// It exists in this package in order to avoid circular dependency with the "topic" package.
    67  	TopicsInverseTable = "topics"
    68  	// FeaturedImageTable is the table that holds the featured_image relation/edge.
    69  	FeaturedImageTable = "posts"
    70  	// FeaturedImageInverseTable is the table name for the File entity.
    71  	// It exists in this package in order to avoid circular dependency with the "file" package.
    72  	FeaturedImageInverseTable = "files"
    73  	// FeaturedImageColumn is the table column denoting the featured_image relation/edge.
    74  	FeaturedImageColumn = "featured_image_id"
    75  	// CommentsTable is the table that holds the comments relation/edge.
    76  	CommentsTable = "comments"
    77  	// CommentsInverseTable is the table name for the Comment entity.
    78  	// It exists in this package in order to avoid circular dependency with the "comment" package.
    79  	CommentsInverseTable = "comments"
    80  	// CommentsColumn is the table column denoting the comments relation/edge.
    81  	CommentsColumn = "post_id"
    82  )
    83  
    84  // Columns holds all SQL columns for post fields.
    85  var Columns = []string{
    86  	FieldID,
    87  	FieldCreatedAt,
    88  	FieldUpdatedAt,
    89  	FieldDeletedAt,
    90  	FieldName,
    91  	FieldSlug,
    92  	FieldDescription,
    93  	FieldContent,
    94  	FieldContentHTML,
    95  	FieldViewCount,
    96  	FieldCommentCount,
    97  	FieldRatingCount,
    98  	FieldRatingTotal,
    99  	FieldDraft,
   100  	FieldApproved,
   101  	FieldFeaturedImageID,
   102  	FieldUserID,
   103  }
   104  
   105  var (
   106  	// TopicsPrimaryKey and TopicsColumn2 are the table columns denoting the
   107  	// primary key for the topics relation (M2M).
   108  	TopicsPrimaryKey = []string{"topic_id", "post_id"}
   109  )
   110  
   111  // ValidColumn reports if the column name is valid (part of the table columns).
   112  func ValidColumn(column string) bool {
   113  	for i := range Columns {
   114  		if column == Columns[i] {
   115  			return true
   116  		}
   117  	}
   118  	return false
   119  }
   120  
   121  var (
   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  	// DefaultViewCount holds the default value on creation for the "view_count" field.
   129  	DefaultViewCount int64
   130  	// DefaultCommentCount holds the default value on creation for the "comment_count" field.
   131  	DefaultCommentCount int64
   132  	// DefaultRatingCount holds the default value on creation for the "rating_count" field.
   133  	DefaultRatingCount int64
   134  	// DefaultRatingTotal holds the default value on creation for the "rating_total" field.
   135  	DefaultRatingTotal int64
   136  	// DefaultDraft holds the default value on creation for the "draft" field.
   137  	DefaultDraft bool
   138  	// DefaultApproved holds the default value on creation for the "approved" field.
   139  	DefaultApproved bool
   140  )