func (bp *BlogPost) Unwrap() *BlogPost {
	tx, ok := bp.config.driver.(*txDriver)
	if !ok {
		panic("ent: BlogPost is not a transactional entity")
	}
	bp.config.driver = tx.drv
	return bp
}
Unwrap unwraps the BlogPost entity that was returned from a transaction after it was closed,
so that all future queries will be executed through the driver which created the transaction.
package ent
import (
	"fmt"
	"strings"
	"entgo.io/contrib/entproto/internal/entprototest/ent/blogpost"
	"entgo.io/contrib/entproto/internal/entprototest/ent/user"
	"entgo.io/ent/dialect/sql"
)
type BlogPost struct {
	config `json:"-"`
	ID int `json:"id,omitempty"`
	Title string `json:"title,omitempty"`
	Body string `json:"body,omitempty"`
	ExternalID int `json:"external_id,omitempty"`
	Edges            BlogPostEdges `json:"edges"`
	blog_post_author *int
}
type BlogPostEdges struct {
	Author *User `json:"author,omitempty"`
	Categories []*Category `json:"categories,omitempty"`
	loadedTypes [2]bool
}
func (e BlogPostEdges) AuthorOrErr() (*User, error) {
	if e.loadedTypes[0] {
		if e.Author == nil {
			return nil, &NotFoundError{label: user.Label}
		}
		return e.Author, nil
	}
	return nil, &NotLoadedError{edge: "author"}
}
func (e BlogPostEdges) CategoriesOrErr() ([]*Category, error) {
	if e.loadedTypes[1] {
		return e.Categories, nil
	}
	return nil, &NotLoadedError{edge: "categories"}
}
func (*BlogPost) scanValues(columns []string) ([]interface{}, error) {
	values := make([]interface{}, len(columns))
	for i := range columns {
		switch columns[i] {
		case blogpost.FieldID, blogpost.FieldExternalID:
			values[i] = new(sql.NullInt64)
		case blogpost.FieldTitle, blogpost.FieldBody:
			values[i] = new(sql.NullString)
		case blogpost.ForeignKeys[0]:  
			values[i] = new(sql.NullInt64)
		default:
			return nil, fmt.Errorf("unexpected column %q for type BlogPost", columns[i])
		}
	}
	return values, nil
}
func (bp *BlogPost) assignValues(columns []string, values []interface{}) error {
	if m, n := len(values), len(columns); m < n {
		return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
	}
	for i := range columns {
		switch columns[i] {
		case blogpost.FieldID:
			value, ok := values[i].(*sql.NullInt64)
			if !ok {
				return fmt.Errorf("unexpected type %T for field id", value)
			}
			bp.ID = int(value.Int64)
		case blogpost.FieldTitle:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field title", values[i])
			} else if value.Valid {
				bp.Title = value.String
			}
		case blogpost.FieldBody:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field body", values[i])
			} else if value.Valid {
				bp.Body = value.String
			}
		case blogpost.FieldExternalID:
			if value, ok := values[i].(*sql.NullInt64); !ok {
				return fmt.Errorf("unexpected type %T for field external_id", values[i])
			} else if value.Valid {
				bp.ExternalID = int(value.Int64)
			}
		case blogpost.ForeignKeys[0]:
			if value, ok := values[i].(*sql.NullInt64); !ok {
				return fmt.Errorf("unexpected type %T for edge-field blog_post_author", value)
			} else if value.Valid {
				bp.blog_post_author = new(int)
				*bp.blog_post_author = int(value.Int64)
			}
		}
	}
	return nil
}
func (bp *BlogPost) QueryAuthor() *UserQuery {
	return (&BlogPostClient{config: bp.config}).QueryAuthor(bp)
}
func (bp *BlogPost) QueryCategories() *CategoryQuery {
	return (&BlogPostClient{config: bp.config}).QueryCategories(bp)
}
func (bp *BlogPost) Update() *BlogPostUpdateOne {
	return (&BlogPostClient{config: bp.config}).UpdateOne(bp)
}