func (tc *TokenCreate) Save(ctx context.Context) (*Token, error) {
	if tc.created_at == nil {
		v := token.DefaultCreatedAt()
		tc.created_at = &v
	}
	if tc.updated_at == nil {
		v := token.DefaultUpdatedAt()
		tc.updated_at = &v
	}
	if tc.value == nil {
		return nil, errors.New("ent: missing required field \"value\"")
	}
	if err := token.ValueValidator(*tc.value); err != nil {
		return nil, fmt.Errorf("ent: validator failed for field \"value\": %v", err)
	}
	if len(tc.user) > 1 {
		return nil, errors.New("ent: multiple assignments on a unique edge \"user\"")
	}
	if tc.user == nil {
		return nil, errors.New("ent: missing required edge \"user\"")
	}
	return tc.sqlSave(ctx)
}
// Save creates the Token in the database.
Save creates the Token in the database.
// Save creates the Token in the database .
func (tc *TokenCreate) Save(ctx context.Context) (*Token, error) {
	if tc.created_at == nil {
		v := token.DefaultCreatedAt()
		tc.created_at = &v
	}
	if tc.updated_at == nil {
		v := token.DefaultUpdatedAt()
		tc.updated_at = &v
	}
	if tc.value == nil {
		return nil, errors.New("ent: missing required field \"value\"")
	}
	if err := token.ValueValidator(*tc.value); err != nil {
		return nil, fmt.Errorf("ent: validator failed for field \"value\": %v", err)
	}
	if len(tc.user) > 1 {
		return nil, errors.New("ent: multiple assignments on a unique edge \"user\"")
	}
	if tc.user == nil {
		return nil, errors.New("ent: missing required edge \"user\"")
	}
	return tc.sqlSave(ctx)
}
func ( tc * TokenCreate ) Save ( ctx context . Context ) ( * Token , error ) { if tc . created_at == nil { v := token . DefaultCreatedAt ( ) tc . created_at = & v } if tc . updated_at == nil { v := token . DefaultUpdatedAt ( ) tc . updated_at = & v } if tc . value == nil { return nil , errors . New ( " \" \" " ) } if err := token . ValueValidator ( * tc . value ) ; err != nil { return nil , fmt . Errorf ( " \" \" " , err ) } if len ( tc . user ) > 1 { return nil , errors . New ( " \" \" " ) } if tc . user == nil { return nil , errors . New ( " \" \" " ) } return tc . sqlSave ( ctx ) }
Save creates the Token in the database.
Save creates the Token in the database .