新增功能: - 新增 TLS 指纹 Profile CRUD 管理(Ent schema + 迁移 + Admin API + 前端管理界面) - 支持账号绑定数据库中的自定义 TLS Profile,或随机选择(profile_id=-1) - HTTPUpstream.DoWithTLS 接口从 bool 改为 *tlsfingerprint.Profile,支持按账号指定 Profile - AccountUsageService 注入 TLSFingerprintProfileService,统一 usage 场景与网关的 Profile 解析逻辑 代码优化: - 删除已被 TLSFingerprintProfileService 完全取代的 registry.go 死代码(418 行) - 提取 3 个 dialer 的重复 TLS 握手逻辑为 performTLSHandshake() 共用函数 - 修复 GetTLSFingerprintProfileID 缺少 json.Number 处理的 bug - gateway_service.Forward 中 ResolveTLSProfile 从重试循环内重复调用改为预解析局部变量 - 删除冗余的 buildClientHelloSpec() 单行 wrapper 和 int64(e.ID) 无效转换 - tls_fingerprint_profile_cache.go 日志从 log.Printf 改为 slog 结构化日志 - dialer_capture_test.go 添加 //go:build integration 标签,防止 CI 失败 - 去重 TestProfileExpectation 类型至共享 test_types_test.go - 修复 9 个测试文件缺少 tlsfingerprint import 的编译错误 - 修复 error_policy_integration_test.go 中 handleError 回调签名被错误替换的问题
1342 lines
46 KiB
Go
1342 lines
46 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
"github.com/Wei-Shaw/sub2api/ent/tlsfingerprintprofile"
|
|
)
|
|
|
|
// TLSFingerprintProfileCreate is the builder for creating a TLSFingerprintProfile entity.
|
|
type TLSFingerprintProfileCreate struct {
|
|
config
|
|
mutation *TLSFingerprintProfileMutation
|
|
hooks []Hook
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_c *TLSFingerprintProfileCreate) SetCreatedAt(v time.Time) *TLSFingerprintProfileCreate {
|
|
_c.mutation.SetCreatedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_c *TLSFingerprintProfileCreate) SetNillableCreatedAt(v *time.Time) *TLSFingerprintProfileCreate {
|
|
if v != nil {
|
|
_c.SetCreatedAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_c *TLSFingerprintProfileCreate) SetUpdatedAt(v time.Time) *TLSFingerprintProfileCreate {
|
|
_c.mutation.SetUpdatedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
|
|
func (_c *TLSFingerprintProfileCreate) SetNillableUpdatedAt(v *time.Time) *TLSFingerprintProfileCreate {
|
|
if v != nil {
|
|
_c.SetUpdatedAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (_c *TLSFingerprintProfileCreate) SetName(v string) *TLSFingerprintProfileCreate {
|
|
_c.mutation.SetName(v)
|
|
return _c
|
|
}
|
|
|
|
// SetDescription sets the "description" field.
|
|
func (_c *TLSFingerprintProfileCreate) SetDescription(v string) *TLSFingerprintProfileCreate {
|
|
_c.mutation.SetDescription(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableDescription sets the "description" field if the given value is not nil.
|
|
func (_c *TLSFingerprintProfileCreate) SetNillableDescription(v *string) *TLSFingerprintProfileCreate {
|
|
if v != nil {
|
|
_c.SetDescription(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetEnableGrease sets the "enable_grease" field.
|
|
func (_c *TLSFingerprintProfileCreate) SetEnableGrease(v bool) *TLSFingerprintProfileCreate {
|
|
_c.mutation.SetEnableGrease(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableEnableGrease sets the "enable_grease" field if the given value is not nil.
|
|
func (_c *TLSFingerprintProfileCreate) SetNillableEnableGrease(v *bool) *TLSFingerprintProfileCreate {
|
|
if v != nil {
|
|
_c.SetEnableGrease(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetCipherSuites sets the "cipher_suites" field.
|
|
func (_c *TLSFingerprintProfileCreate) SetCipherSuites(v []uint16) *TLSFingerprintProfileCreate {
|
|
_c.mutation.SetCipherSuites(v)
|
|
return _c
|
|
}
|
|
|
|
// SetCurves sets the "curves" field.
|
|
func (_c *TLSFingerprintProfileCreate) SetCurves(v []uint16) *TLSFingerprintProfileCreate {
|
|
_c.mutation.SetCurves(v)
|
|
return _c
|
|
}
|
|
|
|
// SetPointFormats sets the "point_formats" field.
|
|
func (_c *TLSFingerprintProfileCreate) SetPointFormats(v []uint16) *TLSFingerprintProfileCreate {
|
|
_c.mutation.SetPointFormats(v)
|
|
return _c
|
|
}
|
|
|
|
// SetSignatureAlgorithms sets the "signature_algorithms" field.
|
|
func (_c *TLSFingerprintProfileCreate) SetSignatureAlgorithms(v []uint16) *TLSFingerprintProfileCreate {
|
|
_c.mutation.SetSignatureAlgorithms(v)
|
|
return _c
|
|
}
|
|
|
|
// SetAlpnProtocols sets the "alpn_protocols" field.
|
|
func (_c *TLSFingerprintProfileCreate) SetAlpnProtocols(v []string) *TLSFingerprintProfileCreate {
|
|
_c.mutation.SetAlpnProtocols(v)
|
|
return _c
|
|
}
|
|
|
|
// SetSupportedVersions sets the "supported_versions" field.
|
|
func (_c *TLSFingerprintProfileCreate) SetSupportedVersions(v []uint16) *TLSFingerprintProfileCreate {
|
|
_c.mutation.SetSupportedVersions(v)
|
|
return _c
|
|
}
|
|
|
|
// SetKeyShareGroups sets the "key_share_groups" field.
|
|
func (_c *TLSFingerprintProfileCreate) SetKeyShareGroups(v []uint16) *TLSFingerprintProfileCreate {
|
|
_c.mutation.SetKeyShareGroups(v)
|
|
return _c
|
|
}
|
|
|
|
// SetPskModes sets the "psk_modes" field.
|
|
func (_c *TLSFingerprintProfileCreate) SetPskModes(v []uint16) *TLSFingerprintProfileCreate {
|
|
_c.mutation.SetPskModes(v)
|
|
return _c
|
|
}
|
|
|
|
// SetExtensions sets the "extensions" field.
|
|
func (_c *TLSFingerprintProfileCreate) SetExtensions(v []uint16) *TLSFingerprintProfileCreate {
|
|
_c.mutation.SetExtensions(v)
|
|
return _c
|
|
}
|
|
|
|
// Mutation returns the TLSFingerprintProfileMutation object of the builder.
|
|
func (_c *TLSFingerprintProfileCreate) Mutation() *TLSFingerprintProfileMutation {
|
|
return _c.mutation
|
|
}
|
|
|
|
// Save creates the TLSFingerprintProfile in the database.
|
|
func (_c *TLSFingerprintProfileCreate) Save(ctx context.Context) (*TLSFingerprintProfile, error) {
|
|
_c.defaults()
|
|
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
|
}
|
|
|
|
// SaveX calls Save and panics if Save returns an error.
|
|
func (_c *TLSFingerprintProfileCreate) SaveX(ctx context.Context) *TLSFingerprintProfile {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *TLSFingerprintProfileCreate) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *TLSFingerprintProfileCreate) ExecX(ctx context.Context) {
|
|
if err := _c.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// defaults sets the default values of the builder before save.
|
|
func (_c *TLSFingerprintProfileCreate) defaults() {
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
v := tlsfingerprintprofile.DefaultCreatedAt()
|
|
_c.mutation.SetCreatedAt(v)
|
|
}
|
|
if _, ok := _c.mutation.UpdatedAt(); !ok {
|
|
v := tlsfingerprintprofile.DefaultUpdatedAt()
|
|
_c.mutation.SetUpdatedAt(v)
|
|
}
|
|
if _, ok := _c.mutation.EnableGrease(); !ok {
|
|
v := tlsfingerprintprofile.DefaultEnableGrease
|
|
_c.mutation.SetEnableGrease(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_c *TLSFingerprintProfileCreate) check() error {
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "TLSFingerprintProfile.created_at"`)}
|
|
}
|
|
if _, ok := _c.mutation.UpdatedAt(); !ok {
|
|
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "TLSFingerprintProfile.updated_at"`)}
|
|
}
|
|
if _, ok := _c.mutation.Name(); !ok {
|
|
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "TLSFingerprintProfile.name"`)}
|
|
}
|
|
if v, ok := _c.mutation.Name(); ok {
|
|
if err := tlsfingerprintprofile.NameValidator(v); err != nil {
|
|
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "TLSFingerprintProfile.name": %w`, err)}
|
|
}
|
|
}
|
|
if _, ok := _c.mutation.EnableGrease(); !ok {
|
|
return &ValidationError{Name: "enable_grease", err: errors.New(`ent: missing required field "TLSFingerprintProfile.enable_grease"`)}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_c *TLSFingerprintProfileCreate) sqlSave(ctx context.Context) (*TLSFingerprintProfile, error) {
|
|
if err := _c.check(); err != nil {
|
|
return nil, err
|
|
}
|
|
_node, _spec := _c.createSpec()
|
|
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
|
if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
id := _spec.ID.Value.(int64)
|
|
_node.ID = int64(id)
|
|
_c.mutation.id = &_node.ID
|
|
_c.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
func (_c *TLSFingerprintProfileCreate) createSpec() (*TLSFingerprintProfile, *sqlgraph.CreateSpec) {
|
|
var (
|
|
_node = &TLSFingerprintProfile{config: _c.config}
|
|
_spec = sqlgraph.NewCreateSpec(tlsfingerprintprofile.Table, sqlgraph.NewFieldSpec(tlsfingerprintprofile.FieldID, field.TypeInt64))
|
|
)
|
|
_spec.OnConflict = _c.conflict
|
|
if value, ok := _c.mutation.CreatedAt(); ok {
|
|
_spec.SetField(tlsfingerprintprofile.FieldCreatedAt, field.TypeTime, value)
|
|
_node.CreatedAt = value
|
|
}
|
|
if value, ok := _c.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(tlsfingerprintprofile.FieldUpdatedAt, field.TypeTime, value)
|
|
_node.UpdatedAt = value
|
|
}
|
|
if value, ok := _c.mutation.Name(); ok {
|
|
_spec.SetField(tlsfingerprintprofile.FieldName, field.TypeString, value)
|
|
_node.Name = value
|
|
}
|
|
if value, ok := _c.mutation.Description(); ok {
|
|
_spec.SetField(tlsfingerprintprofile.FieldDescription, field.TypeString, value)
|
|
_node.Description = &value
|
|
}
|
|
if value, ok := _c.mutation.EnableGrease(); ok {
|
|
_spec.SetField(tlsfingerprintprofile.FieldEnableGrease, field.TypeBool, value)
|
|
_node.EnableGrease = value
|
|
}
|
|
if value, ok := _c.mutation.CipherSuites(); ok {
|
|
_spec.SetField(tlsfingerprintprofile.FieldCipherSuites, field.TypeJSON, value)
|
|
_node.CipherSuites = value
|
|
}
|
|
if value, ok := _c.mutation.Curves(); ok {
|
|
_spec.SetField(tlsfingerprintprofile.FieldCurves, field.TypeJSON, value)
|
|
_node.Curves = value
|
|
}
|
|
if value, ok := _c.mutation.PointFormats(); ok {
|
|
_spec.SetField(tlsfingerprintprofile.FieldPointFormats, field.TypeJSON, value)
|
|
_node.PointFormats = value
|
|
}
|
|
if value, ok := _c.mutation.SignatureAlgorithms(); ok {
|
|
_spec.SetField(tlsfingerprintprofile.FieldSignatureAlgorithms, field.TypeJSON, value)
|
|
_node.SignatureAlgorithms = value
|
|
}
|
|
if value, ok := _c.mutation.AlpnProtocols(); ok {
|
|
_spec.SetField(tlsfingerprintprofile.FieldAlpnProtocols, field.TypeJSON, value)
|
|
_node.AlpnProtocols = value
|
|
}
|
|
if value, ok := _c.mutation.SupportedVersions(); ok {
|
|
_spec.SetField(tlsfingerprintprofile.FieldSupportedVersions, field.TypeJSON, value)
|
|
_node.SupportedVersions = value
|
|
}
|
|
if value, ok := _c.mutation.KeyShareGroups(); ok {
|
|
_spec.SetField(tlsfingerprintprofile.FieldKeyShareGroups, field.TypeJSON, value)
|
|
_node.KeyShareGroups = value
|
|
}
|
|
if value, ok := _c.mutation.PskModes(); ok {
|
|
_spec.SetField(tlsfingerprintprofile.FieldPskModes, field.TypeJSON, value)
|
|
_node.PskModes = value
|
|
}
|
|
if value, ok := _c.mutation.Extensions(); ok {
|
|
_spec.SetField(tlsfingerprintprofile.FieldExtensions, field.TypeJSON, value)
|
|
_node.Extensions = value
|
|
}
|
|
return _node, _spec
|
|
}
|
|
|
|
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
|
|
// of the `INSERT` statement. For example:
|
|
//
|
|
// client.TLSFingerprintProfile.Create().
|
|
// SetCreatedAt(v).
|
|
// OnConflict(
|
|
// // Update the row with the new values
|
|
// // the was proposed for insertion.
|
|
// sql.ResolveWithNewValues(),
|
|
// ).
|
|
// // Override some of the fields with custom
|
|
// // update values.
|
|
// Update(func(u *ent.TLSFingerprintProfileUpsert) {
|
|
// SetCreatedAt(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (_c *TLSFingerprintProfileCreate) OnConflict(opts ...sql.ConflictOption) *TLSFingerprintProfileUpsertOne {
|
|
_c.conflict = opts
|
|
return &TLSFingerprintProfileUpsertOne{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.TLSFingerprintProfile.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (_c *TLSFingerprintProfileCreate) OnConflictColumns(columns ...string) *TLSFingerprintProfileUpsertOne {
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
|
return &TLSFingerprintProfileUpsertOne{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
type (
|
|
// TLSFingerprintProfileUpsertOne is the builder for "upsert"-ing
|
|
// one TLSFingerprintProfile node.
|
|
TLSFingerprintProfileUpsertOne struct {
|
|
create *TLSFingerprintProfileCreate
|
|
}
|
|
|
|
// TLSFingerprintProfileUpsert is the "OnConflict" setter.
|
|
TLSFingerprintProfileUpsert struct {
|
|
*sql.UpdateSet
|
|
}
|
|
)
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (u *TLSFingerprintProfileUpsert) SetUpdatedAt(v time.Time) *TLSFingerprintProfileUpsert {
|
|
u.Set(tlsfingerprintprofile.FieldUpdatedAt, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsert) UpdateUpdatedAt() *TLSFingerprintProfileUpsert {
|
|
u.SetExcluded(tlsfingerprintprofile.FieldUpdatedAt)
|
|
return u
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (u *TLSFingerprintProfileUpsert) SetName(v string) *TLSFingerprintProfileUpsert {
|
|
u.Set(tlsfingerprintprofile.FieldName, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateName sets the "name" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsert) UpdateName() *TLSFingerprintProfileUpsert {
|
|
u.SetExcluded(tlsfingerprintprofile.FieldName)
|
|
return u
|
|
}
|
|
|
|
// SetDescription sets the "description" field.
|
|
func (u *TLSFingerprintProfileUpsert) SetDescription(v string) *TLSFingerprintProfileUpsert {
|
|
u.Set(tlsfingerprintprofile.FieldDescription, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateDescription sets the "description" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsert) UpdateDescription() *TLSFingerprintProfileUpsert {
|
|
u.SetExcluded(tlsfingerprintprofile.FieldDescription)
|
|
return u
|
|
}
|
|
|
|
// ClearDescription clears the value of the "description" field.
|
|
func (u *TLSFingerprintProfileUpsert) ClearDescription() *TLSFingerprintProfileUpsert {
|
|
u.SetNull(tlsfingerprintprofile.FieldDescription)
|
|
return u
|
|
}
|
|
|
|
// SetEnableGrease sets the "enable_grease" field.
|
|
func (u *TLSFingerprintProfileUpsert) SetEnableGrease(v bool) *TLSFingerprintProfileUpsert {
|
|
u.Set(tlsfingerprintprofile.FieldEnableGrease, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateEnableGrease sets the "enable_grease" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsert) UpdateEnableGrease() *TLSFingerprintProfileUpsert {
|
|
u.SetExcluded(tlsfingerprintprofile.FieldEnableGrease)
|
|
return u
|
|
}
|
|
|
|
// SetCipherSuites sets the "cipher_suites" field.
|
|
func (u *TLSFingerprintProfileUpsert) SetCipherSuites(v []uint16) *TLSFingerprintProfileUpsert {
|
|
u.Set(tlsfingerprintprofile.FieldCipherSuites, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateCipherSuites sets the "cipher_suites" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsert) UpdateCipherSuites() *TLSFingerprintProfileUpsert {
|
|
u.SetExcluded(tlsfingerprintprofile.FieldCipherSuites)
|
|
return u
|
|
}
|
|
|
|
// ClearCipherSuites clears the value of the "cipher_suites" field.
|
|
func (u *TLSFingerprintProfileUpsert) ClearCipherSuites() *TLSFingerprintProfileUpsert {
|
|
u.SetNull(tlsfingerprintprofile.FieldCipherSuites)
|
|
return u
|
|
}
|
|
|
|
// SetCurves sets the "curves" field.
|
|
func (u *TLSFingerprintProfileUpsert) SetCurves(v []uint16) *TLSFingerprintProfileUpsert {
|
|
u.Set(tlsfingerprintprofile.FieldCurves, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateCurves sets the "curves" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsert) UpdateCurves() *TLSFingerprintProfileUpsert {
|
|
u.SetExcluded(tlsfingerprintprofile.FieldCurves)
|
|
return u
|
|
}
|
|
|
|
// ClearCurves clears the value of the "curves" field.
|
|
func (u *TLSFingerprintProfileUpsert) ClearCurves() *TLSFingerprintProfileUpsert {
|
|
u.SetNull(tlsfingerprintprofile.FieldCurves)
|
|
return u
|
|
}
|
|
|
|
// SetPointFormats sets the "point_formats" field.
|
|
func (u *TLSFingerprintProfileUpsert) SetPointFormats(v []uint16) *TLSFingerprintProfileUpsert {
|
|
u.Set(tlsfingerprintprofile.FieldPointFormats, v)
|
|
return u
|
|
}
|
|
|
|
// UpdatePointFormats sets the "point_formats" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsert) UpdatePointFormats() *TLSFingerprintProfileUpsert {
|
|
u.SetExcluded(tlsfingerprintprofile.FieldPointFormats)
|
|
return u
|
|
}
|
|
|
|
// ClearPointFormats clears the value of the "point_formats" field.
|
|
func (u *TLSFingerprintProfileUpsert) ClearPointFormats() *TLSFingerprintProfileUpsert {
|
|
u.SetNull(tlsfingerprintprofile.FieldPointFormats)
|
|
return u
|
|
}
|
|
|
|
// SetSignatureAlgorithms sets the "signature_algorithms" field.
|
|
func (u *TLSFingerprintProfileUpsert) SetSignatureAlgorithms(v []uint16) *TLSFingerprintProfileUpsert {
|
|
u.Set(tlsfingerprintprofile.FieldSignatureAlgorithms, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateSignatureAlgorithms sets the "signature_algorithms" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsert) UpdateSignatureAlgorithms() *TLSFingerprintProfileUpsert {
|
|
u.SetExcluded(tlsfingerprintprofile.FieldSignatureAlgorithms)
|
|
return u
|
|
}
|
|
|
|
// ClearSignatureAlgorithms clears the value of the "signature_algorithms" field.
|
|
func (u *TLSFingerprintProfileUpsert) ClearSignatureAlgorithms() *TLSFingerprintProfileUpsert {
|
|
u.SetNull(tlsfingerprintprofile.FieldSignatureAlgorithms)
|
|
return u
|
|
}
|
|
|
|
// SetAlpnProtocols sets the "alpn_protocols" field.
|
|
func (u *TLSFingerprintProfileUpsert) SetAlpnProtocols(v []string) *TLSFingerprintProfileUpsert {
|
|
u.Set(tlsfingerprintprofile.FieldAlpnProtocols, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateAlpnProtocols sets the "alpn_protocols" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsert) UpdateAlpnProtocols() *TLSFingerprintProfileUpsert {
|
|
u.SetExcluded(tlsfingerprintprofile.FieldAlpnProtocols)
|
|
return u
|
|
}
|
|
|
|
// ClearAlpnProtocols clears the value of the "alpn_protocols" field.
|
|
func (u *TLSFingerprintProfileUpsert) ClearAlpnProtocols() *TLSFingerprintProfileUpsert {
|
|
u.SetNull(tlsfingerprintprofile.FieldAlpnProtocols)
|
|
return u
|
|
}
|
|
|
|
// SetSupportedVersions sets the "supported_versions" field.
|
|
func (u *TLSFingerprintProfileUpsert) SetSupportedVersions(v []uint16) *TLSFingerprintProfileUpsert {
|
|
u.Set(tlsfingerprintprofile.FieldSupportedVersions, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateSupportedVersions sets the "supported_versions" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsert) UpdateSupportedVersions() *TLSFingerprintProfileUpsert {
|
|
u.SetExcluded(tlsfingerprintprofile.FieldSupportedVersions)
|
|
return u
|
|
}
|
|
|
|
// ClearSupportedVersions clears the value of the "supported_versions" field.
|
|
func (u *TLSFingerprintProfileUpsert) ClearSupportedVersions() *TLSFingerprintProfileUpsert {
|
|
u.SetNull(tlsfingerprintprofile.FieldSupportedVersions)
|
|
return u
|
|
}
|
|
|
|
// SetKeyShareGroups sets the "key_share_groups" field.
|
|
func (u *TLSFingerprintProfileUpsert) SetKeyShareGroups(v []uint16) *TLSFingerprintProfileUpsert {
|
|
u.Set(tlsfingerprintprofile.FieldKeyShareGroups, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateKeyShareGroups sets the "key_share_groups" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsert) UpdateKeyShareGroups() *TLSFingerprintProfileUpsert {
|
|
u.SetExcluded(tlsfingerprintprofile.FieldKeyShareGroups)
|
|
return u
|
|
}
|
|
|
|
// ClearKeyShareGroups clears the value of the "key_share_groups" field.
|
|
func (u *TLSFingerprintProfileUpsert) ClearKeyShareGroups() *TLSFingerprintProfileUpsert {
|
|
u.SetNull(tlsfingerprintprofile.FieldKeyShareGroups)
|
|
return u
|
|
}
|
|
|
|
// SetPskModes sets the "psk_modes" field.
|
|
func (u *TLSFingerprintProfileUpsert) SetPskModes(v []uint16) *TLSFingerprintProfileUpsert {
|
|
u.Set(tlsfingerprintprofile.FieldPskModes, v)
|
|
return u
|
|
}
|
|
|
|
// UpdatePskModes sets the "psk_modes" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsert) UpdatePskModes() *TLSFingerprintProfileUpsert {
|
|
u.SetExcluded(tlsfingerprintprofile.FieldPskModes)
|
|
return u
|
|
}
|
|
|
|
// ClearPskModes clears the value of the "psk_modes" field.
|
|
func (u *TLSFingerprintProfileUpsert) ClearPskModes() *TLSFingerprintProfileUpsert {
|
|
u.SetNull(tlsfingerprintprofile.FieldPskModes)
|
|
return u
|
|
}
|
|
|
|
// SetExtensions sets the "extensions" field.
|
|
func (u *TLSFingerprintProfileUpsert) SetExtensions(v []uint16) *TLSFingerprintProfileUpsert {
|
|
u.Set(tlsfingerprintprofile.FieldExtensions, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateExtensions sets the "extensions" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsert) UpdateExtensions() *TLSFingerprintProfileUpsert {
|
|
u.SetExcluded(tlsfingerprintprofile.FieldExtensions)
|
|
return u
|
|
}
|
|
|
|
// ClearExtensions clears the value of the "extensions" field.
|
|
func (u *TLSFingerprintProfileUpsert) ClearExtensions() *TLSFingerprintProfileUpsert {
|
|
u.SetNull(tlsfingerprintprofile.FieldExtensions)
|
|
return u
|
|
}
|
|
|
|
// UpdateNewValues updates the mutable fields using the new values that were set on create.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.TLSFingerprintProfile.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *TLSFingerprintProfileUpsertOne) UpdateNewValues() *TLSFingerprintProfileUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
|
|
if _, exists := u.create.mutation.CreatedAt(); exists {
|
|
s.SetIgnore(tlsfingerprintprofile.FieldCreatedAt)
|
|
}
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.TLSFingerprintProfile.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *TLSFingerprintProfileUpsertOne) Ignore() *TLSFingerprintProfileUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
|
|
return u
|
|
}
|
|
|
|
// DoNothing configures the conflict_action to `DO NOTHING`.
|
|
// Supported only by SQLite and PostgreSQL.
|
|
func (u *TLSFingerprintProfileUpsertOne) DoNothing() *TLSFingerprintProfileUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the TLSFingerprintProfileCreate.OnConflict
|
|
// documentation for more info.
|
|
func (u *TLSFingerprintProfileUpsertOne) Update(set func(*TLSFingerprintProfileUpsert)) *TLSFingerprintProfileUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&TLSFingerprintProfileUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) SetUpdatedAt(v time.Time) *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetUpdatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertOne) UpdateUpdatedAt() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateUpdatedAt()
|
|
})
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) SetName(v string) *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetName(v)
|
|
})
|
|
}
|
|
|
|
// UpdateName sets the "name" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertOne) UpdateName() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateName()
|
|
})
|
|
}
|
|
|
|
// SetDescription sets the "description" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) SetDescription(v string) *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetDescription(v)
|
|
})
|
|
}
|
|
|
|
// UpdateDescription sets the "description" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertOne) UpdateDescription() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateDescription()
|
|
})
|
|
}
|
|
|
|
// ClearDescription clears the value of the "description" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) ClearDescription() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearDescription()
|
|
})
|
|
}
|
|
|
|
// SetEnableGrease sets the "enable_grease" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) SetEnableGrease(v bool) *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetEnableGrease(v)
|
|
})
|
|
}
|
|
|
|
// UpdateEnableGrease sets the "enable_grease" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertOne) UpdateEnableGrease() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateEnableGrease()
|
|
})
|
|
}
|
|
|
|
// SetCipherSuites sets the "cipher_suites" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) SetCipherSuites(v []uint16) *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetCipherSuites(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCipherSuites sets the "cipher_suites" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertOne) UpdateCipherSuites() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateCipherSuites()
|
|
})
|
|
}
|
|
|
|
// ClearCipherSuites clears the value of the "cipher_suites" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) ClearCipherSuites() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearCipherSuites()
|
|
})
|
|
}
|
|
|
|
// SetCurves sets the "curves" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) SetCurves(v []uint16) *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetCurves(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCurves sets the "curves" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertOne) UpdateCurves() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateCurves()
|
|
})
|
|
}
|
|
|
|
// ClearCurves clears the value of the "curves" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) ClearCurves() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearCurves()
|
|
})
|
|
}
|
|
|
|
// SetPointFormats sets the "point_formats" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) SetPointFormats(v []uint16) *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetPointFormats(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePointFormats sets the "point_formats" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertOne) UpdatePointFormats() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdatePointFormats()
|
|
})
|
|
}
|
|
|
|
// ClearPointFormats clears the value of the "point_formats" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) ClearPointFormats() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearPointFormats()
|
|
})
|
|
}
|
|
|
|
// SetSignatureAlgorithms sets the "signature_algorithms" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) SetSignatureAlgorithms(v []uint16) *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetSignatureAlgorithms(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSignatureAlgorithms sets the "signature_algorithms" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertOne) UpdateSignatureAlgorithms() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateSignatureAlgorithms()
|
|
})
|
|
}
|
|
|
|
// ClearSignatureAlgorithms clears the value of the "signature_algorithms" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) ClearSignatureAlgorithms() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearSignatureAlgorithms()
|
|
})
|
|
}
|
|
|
|
// SetAlpnProtocols sets the "alpn_protocols" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) SetAlpnProtocols(v []string) *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetAlpnProtocols(v)
|
|
})
|
|
}
|
|
|
|
// UpdateAlpnProtocols sets the "alpn_protocols" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertOne) UpdateAlpnProtocols() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateAlpnProtocols()
|
|
})
|
|
}
|
|
|
|
// ClearAlpnProtocols clears the value of the "alpn_protocols" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) ClearAlpnProtocols() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearAlpnProtocols()
|
|
})
|
|
}
|
|
|
|
// SetSupportedVersions sets the "supported_versions" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) SetSupportedVersions(v []uint16) *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetSupportedVersions(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSupportedVersions sets the "supported_versions" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertOne) UpdateSupportedVersions() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateSupportedVersions()
|
|
})
|
|
}
|
|
|
|
// ClearSupportedVersions clears the value of the "supported_versions" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) ClearSupportedVersions() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearSupportedVersions()
|
|
})
|
|
}
|
|
|
|
// SetKeyShareGroups sets the "key_share_groups" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) SetKeyShareGroups(v []uint16) *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetKeyShareGroups(v)
|
|
})
|
|
}
|
|
|
|
// UpdateKeyShareGroups sets the "key_share_groups" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertOne) UpdateKeyShareGroups() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateKeyShareGroups()
|
|
})
|
|
}
|
|
|
|
// ClearKeyShareGroups clears the value of the "key_share_groups" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) ClearKeyShareGroups() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearKeyShareGroups()
|
|
})
|
|
}
|
|
|
|
// SetPskModes sets the "psk_modes" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) SetPskModes(v []uint16) *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetPskModes(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePskModes sets the "psk_modes" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertOne) UpdatePskModes() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdatePskModes()
|
|
})
|
|
}
|
|
|
|
// ClearPskModes clears the value of the "psk_modes" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) ClearPskModes() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearPskModes()
|
|
})
|
|
}
|
|
|
|
// SetExtensions sets the "extensions" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) SetExtensions(v []uint16) *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetExtensions(v)
|
|
})
|
|
}
|
|
|
|
// UpdateExtensions sets the "extensions" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertOne) UpdateExtensions() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateExtensions()
|
|
})
|
|
}
|
|
|
|
// ClearExtensions clears the value of the "extensions" field.
|
|
func (u *TLSFingerprintProfileUpsertOne) ClearExtensions() *TLSFingerprintProfileUpsertOne {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearExtensions()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *TLSFingerprintProfileUpsertOne) Exec(ctx context.Context) error {
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("ent: missing options for TLSFingerprintProfileCreate.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *TLSFingerprintProfileUpsertOne) ExecX(ctx context.Context) {
|
|
if err := u.create.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// Exec executes the UPSERT query and returns the inserted/updated ID.
|
|
func (u *TLSFingerprintProfileUpsertOne) ID(ctx context.Context) (id int64, err error) {
|
|
node, err := u.create.Save(ctx)
|
|
if err != nil {
|
|
return id, err
|
|
}
|
|
return node.ID, nil
|
|
}
|
|
|
|
// IDX is like ID, but panics if an error occurs.
|
|
func (u *TLSFingerprintProfileUpsertOne) IDX(ctx context.Context) int64 {
|
|
id, err := u.ID(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return id
|
|
}
|
|
|
|
// TLSFingerprintProfileCreateBulk is the builder for creating many TLSFingerprintProfile entities in bulk.
|
|
type TLSFingerprintProfileCreateBulk struct {
|
|
config
|
|
err error
|
|
builders []*TLSFingerprintProfileCreate
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// Save creates the TLSFingerprintProfile entities in the database.
|
|
func (_c *TLSFingerprintProfileCreateBulk) Save(ctx context.Context) ([]*TLSFingerprintProfile, error) {
|
|
if _c.err != nil {
|
|
return nil, _c.err
|
|
}
|
|
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
|
nodes := make([]*TLSFingerprintProfile, len(_c.builders))
|
|
mutators := make([]Mutator, len(_c.builders))
|
|
for i := range _c.builders {
|
|
func(i int, root context.Context) {
|
|
builder := _c.builders[i]
|
|
builder.defaults()
|
|
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
|
mutation, ok := m.(*TLSFingerprintProfileMutation)
|
|
if !ok {
|
|
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
|
}
|
|
if err := builder.check(); err != nil {
|
|
return nil, err
|
|
}
|
|
builder.mutation = mutation
|
|
var err error
|
|
nodes[i], specs[i] = builder.createSpec()
|
|
if i < len(mutators)-1 {
|
|
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
|
} else {
|
|
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
|
spec.OnConflict = _c.conflict
|
|
// Invoke the actual operation on the latest mutation in the chain.
|
|
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
|
if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
}
|
|
}
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
mutation.id = &nodes[i].ID
|
|
if specs[i].ID.Value != nil {
|
|
id := specs[i].ID.Value.(int64)
|
|
nodes[i].ID = int64(id)
|
|
}
|
|
mutation.done = true
|
|
return nodes[i], nil
|
|
})
|
|
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
|
mut = builder.hooks[i](mut)
|
|
}
|
|
mutators[i] = mut
|
|
}(i, ctx)
|
|
}
|
|
if len(mutators) > 0 {
|
|
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return nodes, nil
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_c *TLSFingerprintProfileCreateBulk) SaveX(ctx context.Context) []*TLSFingerprintProfile {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *TLSFingerprintProfileCreateBulk) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *TLSFingerprintProfileCreateBulk) ExecX(ctx context.Context) {
|
|
if err := _c.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
|
|
// of the `INSERT` statement. For example:
|
|
//
|
|
// client.TLSFingerprintProfile.CreateBulk(builders...).
|
|
// OnConflict(
|
|
// // Update the row with the new values
|
|
// // the was proposed for insertion.
|
|
// sql.ResolveWithNewValues(),
|
|
// ).
|
|
// // Override some of the fields with custom
|
|
// // update values.
|
|
// Update(func(u *ent.TLSFingerprintProfileUpsert) {
|
|
// SetCreatedAt(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (_c *TLSFingerprintProfileCreateBulk) OnConflict(opts ...sql.ConflictOption) *TLSFingerprintProfileUpsertBulk {
|
|
_c.conflict = opts
|
|
return &TLSFingerprintProfileUpsertBulk{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.TLSFingerprintProfile.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (_c *TLSFingerprintProfileCreateBulk) OnConflictColumns(columns ...string) *TLSFingerprintProfileUpsertBulk {
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
|
return &TLSFingerprintProfileUpsertBulk{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// TLSFingerprintProfileUpsertBulk is the builder for "upsert"-ing
|
|
// a bulk of TLSFingerprintProfile nodes.
|
|
type TLSFingerprintProfileUpsertBulk struct {
|
|
create *TLSFingerprintProfileCreateBulk
|
|
}
|
|
|
|
// UpdateNewValues updates the mutable fields using the new values that
|
|
// were set on create. Using this option is equivalent to using:
|
|
//
|
|
// client.TLSFingerprintProfile.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *TLSFingerprintProfileUpsertBulk) UpdateNewValues() *TLSFingerprintProfileUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
|
|
for _, b := range u.create.builders {
|
|
if _, exists := b.mutation.CreatedAt(); exists {
|
|
s.SetIgnore(tlsfingerprintprofile.FieldCreatedAt)
|
|
}
|
|
}
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.TLSFingerprintProfile.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *TLSFingerprintProfileUpsertBulk) Ignore() *TLSFingerprintProfileUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
|
|
return u
|
|
}
|
|
|
|
// DoNothing configures the conflict_action to `DO NOTHING`.
|
|
// Supported only by SQLite and PostgreSQL.
|
|
func (u *TLSFingerprintProfileUpsertBulk) DoNothing() *TLSFingerprintProfileUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the TLSFingerprintProfileCreateBulk.OnConflict
|
|
// documentation for more info.
|
|
func (u *TLSFingerprintProfileUpsertBulk) Update(set func(*TLSFingerprintProfileUpsert)) *TLSFingerprintProfileUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&TLSFingerprintProfileUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) SetUpdatedAt(v time.Time) *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetUpdatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertBulk) UpdateUpdatedAt() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateUpdatedAt()
|
|
})
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) SetName(v string) *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetName(v)
|
|
})
|
|
}
|
|
|
|
// UpdateName sets the "name" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertBulk) UpdateName() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateName()
|
|
})
|
|
}
|
|
|
|
// SetDescription sets the "description" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) SetDescription(v string) *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetDescription(v)
|
|
})
|
|
}
|
|
|
|
// UpdateDescription sets the "description" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertBulk) UpdateDescription() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateDescription()
|
|
})
|
|
}
|
|
|
|
// ClearDescription clears the value of the "description" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) ClearDescription() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearDescription()
|
|
})
|
|
}
|
|
|
|
// SetEnableGrease sets the "enable_grease" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) SetEnableGrease(v bool) *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetEnableGrease(v)
|
|
})
|
|
}
|
|
|
|
// UpdateEnableGrease sets the "enable_grease" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertBulk) UpdateEnableGrease() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateEnableGrease()
|
|
})
|
|
}
|
|
|
|
// SetCipherSuites sets the "cipher_suites" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) SetCipherSuites(v []uint16) *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetCipherSuites(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCipherSuites sets the "cipher_suites" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertBulk) UpdateCipherSuites() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateCipherSuites()
|
|
})
|
|
}
|
|
|
|
// ClearCipherSuites clears the value of the "cipher_suites" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) ClearCipherSuites() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearCipherSuites()
|
|
})
|
|
}
|
|
|
|
// SetCurves sets the "curves" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) SetCurves(v []uint16) *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetCurves(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCurves sets the "curves" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertBulk) UpdateCurves() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateCurves()
|
|
})
|
|
}
|
|
|
|
// ClearCurves clears the value of the "curves" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) ClearCurves() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearCurves()
|
|
})
|
|
}
|
|
|
|
// SetPointFormats sets the "point_formats" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) SetPointFormats(v []uint16) *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetPointFormats(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePointFormats sets the "point_formats" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertBulk) UpdatePointFormats() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdatePointFormats()
|
|
})
|
|
}
|
|
|
|
// ClearPointFormats clears the value of the "point_formats" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) ClearPointFormats() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearPointFormats()
|
|
})
|
|
}
|
|
|
|
// SetSignatureAlgorithms sets the "signature_algorithms" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) SetSignatureAlgorithms(v []uint16) *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetSignatureAlgorithms(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSignatureAlgorithms sets the "signature_algorithms" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertBulk) UpdateSignatureAlgorithms() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateSignatureAlgorithms()
|
|
})
|
|
}
|
|
|
|
// ClearSignatureAlgorithms clears the value of the "signature_algorithms" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) ClearSignatureAlgorithms() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearSignatureAlgorithms()
|
|
})
|
|
}
|
|
|
|
// SetAlpnProtocols sets the "alpn_protocols" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) SetAlpnProtocols(v []string) *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetAlpnProtocols(v)
|
|
})
|
|
}
|
|
|
|
// UpdateAlpnProtocols sets the "alpn_protocols" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertBulk) UpdateAlpnProtocols() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateAlpnProtocols()
|
|
})
|
|
}
|
|
|
|
// ClearAlpnProtocols clears the value of the "alpn_protocols" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) ClearAlpnProtocols() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearAlpnProtocols()
|
|
})
|
|
}
|
|
|
|
// SetSupportedVersions sets the "supported_versions" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) SetSupportedVersions(v []uint16) *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetSupportedVersions(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSupportedVersions sets the "supported_versions" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertBulk) UpdateSupportedVersions() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateSupportedVersions()
|
|
})
|
|
}
|
|
|
|
// ClearSupportedVersions clears the value of the "supported_versions" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) ClearSupportedVersions() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearSupportedVersions()
|
|
})
|
|
}
|
|
|
|
// SetKeyShareGroups sets the "key_share_groups" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) SetKeyShareGroups(v []uint16) *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetKeyShareGroups(v)
|
|
})
|
|
}
|
|
|
|
// UpdateKeyShareGroups sets the "key_share_groups" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertBulk) UpdateKeyShareGroups() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateKeyShareGroups()
|
|
})
|
|
}
|
|
|
|
// ClearKeyShareGroups clears the value of the "key_share_groups" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) ClearKeyShareGroups() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearKeyShareGroups()
|
|
})
|
|
}
|
|
|
|
// SetPskModes sets the "psk_modes" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) SetPskModes(v []uint16) *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetPskModes(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePskModes sets the "psk_modes" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertBulk) UpdatePskModes() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdatePskModes()
|
|
})
|
|
}
|
|
|
|
// ClearPskModes clears the value of the "psk_modes" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) ClearPskModes() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearPskModes()
|
|
})
|
|
}
|
|
|
|
// SetExtensions sets the "extensions" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) SetExtensions(v []uint16) *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.SetExtensions(v)
|
|
})
|
|
}
|
|
|
|
// UpdateExtensions sets the "extensions" field to the value that was provided on create.
|
|
func (u *TLSFingerprintProfileUpsertBulk) UpdateExtensions() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.UpdateExtensions()
|
|
})
|
|
}
|
|
|
|
// ClearExtensions clears the value of the "extensions" field.
|
|
func (u *TLSFingerprintProfileUpsertBulk) ClearExtensions() *TLSFingerprintProfileUpsertBulk {
|
|
return u.Update(func(s *TLSFingerprintProfileUpsert) {
|
|
s.ClearExtensions()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *TLSFingerprintProfileUpsertBulk) Exec(ctx context.Context) error {
|
|
if u.create.err != nil {
|
|
return u.create.err
|
|
}
|
|
for i, b := range u.create.builders {
|
|
if len(b.conflict) != 0 {
|
|
return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the TLSFingerprintProfileCreateBulk instead", i)
|
|
}
|
|
}
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("ent: missing options for TLSFingerprintProfileCreateBulk.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *TLSFingerprintProfileUpsertBulk) ExecX(ctx context.Context) {
|
|
if err := u.create.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|