pcmt/ent/hibp/hibp.go
surtur 6b45213649
All checks were successful
continuous-integration/drone/push Build is passing
go: add user onboarding, HIBP search functionality
* add user onboarding workflow
* fix user editing (no edits of passwords of regular users after
  onboarding)
* refresh HIBP breach cache in DB on app start-up
* display HIBP breach details
* fix request scheduling to prevent panics (this still needs some love..)
* fix middleware auth
* add TODOs
* update head.tmpl
* reword some error messages
2023-08-24 18:43:24 +02:00

218 lines
7.9 KiB
Go

// Code generated by ent, DO NOT EDIT.
package hibp
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/google/uuid"
)
const (
// Label holds the string label denoting the hibp type in the database.
Label = "hibp"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldTitle holds the string denoting the title field in the database.
FieldTitle = "title"
// FieldDomain holds the string denoting the domain field in the database.
FieldDomain = "domain"
// FieldBreachDate holds the string denoting the breach_date field in the database.
FieldBreachDate = "breach_date"
// FieldAddedDate holds the string denoting the added_date field in the database.
FieldAddedDate = "added_date"
// FieldModifiedDate holds the string denoting the modified_date field in the database.
FieldModifiedDate = "modified_date"
// FieldPwnCount holds the string denoting the pwn_count field in the database.
FieldPwnCount = "pwn_count"
// FieldDescription holds the string denoting the description field in the database.
FieldDescription = "description"
// FieldDataclasses holds the string denoting the dataclasses field in the database.
FieldDataclasses = "dataclasses"
// FieldIsVerified holds the string denoting the is_verified field in the database.
FieldIsVerified = "is_verified"
// FieldIsFabricated holds the string denoting the is_fabricated field in the database.
FieldIsFabricated = "is_fabricated"
// FieldIsSensitive holds the string denoting the is_sensitive field in the database.
FieldIsSensitive = "is_sensitive"
// FieldIsRetired holds the string denoting the is_retired field in the database.
FieldIsRetired = "is_retired"
// FieldIsSpamList holds the string denoting the is_spamlist field in the database.
FieldIsSpamList = "is_spam_list"
// FieldIsMalware holds the string denoting the is_malware field in the database.
FieldIsMalware = "is_malware"
// FieldLogoPath holds the string denoting the logo_path field in the database.
FieldLogoPath = "logo_path"
// EdgeTrackedBreaches holds the string denoting the tracked_breaches edge name in mutations.
EdgeTrackedBreaches = "tracked_breaches"
// Table holds the table name of the hibp in the database.
Table = "hib_ps"
// TrackedBreachesTable is the table that holds the tracked_breaches relation/edge.
TrackedBreachesTable = "hib_ps"
// TrackedBreachesInverseTable is the table name for the TrackedBreaches entity.
// It exists in this package in order to avoid circular dependency with the "trackedbreaches" package.
TrackedBreachesInverseTable = "tracked_breaches"
// TrackedBreachesColumn is the table column denoting the tracked_breaches relation/edge.
TrackedBreachesColumn = "tracked_breaches_hibp"
)
// Columns holds all SQL columns for hibp fields.
var Columns = []string{
FieldID,
FieldName,
FieldTitle,
FieldDomain,
FieldBreachDate,
FieldAddedDate,
FieldModifiedDate,
FieldPwnCount,
FieldDescription,
FieldDataclasses,
FieldIsVerified,
FieldIsFabricated,
FieldIsSensitive,
FieldIsRetired,
FieldIsSpamList,
FieldIsMalware,
FieldLogoPath,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "hib_ps"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
"tracked_breaches_hibp",
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
for i := range ForeignKeys {
if column == ForeignKeys[i] {
return true
}
}
return false
}
var (
// NameValidator is a validator for the "name" field. It is called by the builders before save.
NameValidator func(string) error
// DefaultIsVerified holds the default value on creation for the "is_verified" field.
DefaultIsVerified bool
// DefaultIsFabricated holds the default value on creation for the "is_fabricated" field.
DefaultIsFabricated bool
// DefaultIsSensitive holds the default value on creation for the "is_sensitive" field.
DefaultIsSensitive bool
// DefaultIsRetired holds the default value on creation for the "is_retired" field.
DefaultIsRetired bool
// DefaultIsSpamList holds the default value on creation for the "is_spamList" field.
DefaultIsSpamList bool
// DefaultIsMalware holds the default value on creation for the "is_malware" field.
DefaultIsMalware bool
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() uuid.UUID
)
// OrderOption defines the ordering options for the HIBP queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByTitle orders the results by the title field.
func ByTitle(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTitle, opts...).ToFunc()
}
// ByDomain orders the results by the domain field.
func ByDomain(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDomain, opts...).ToFunc()
}
// ByBreachDate orders the results by the breach_date field.
func ByBreachDate(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBreachDate, opts...).ToFunc()
}
// ByAddedDate orders the results by the added_date field.
func ByAddedDate(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAddedDate, opts...).ToFunc()
}
// ByModifiedDate orders the results by the modified_date field.
func ByModifiedDate(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldModifiedDate, opts...).ToFunc()
}
// ByPwnCount orders the results by the pwn_count field.
func ByPwnCount(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPwnCount, opts...).ToFunc()
}
// ByDescription orders the results by the description field.
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDescription, opts...).ToFunc()
}
// ByIsVerified orders the results by the is_verified field.
func ByIsVerified(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIsVerified, opts...).ToFunc()
}
// ByIsFabricated orders the results by the is_fabricated field.
func ByIsFabricated(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIsFabricated, opts...).ToFunc()
}
// ByIsSensitive orders the results by the is_sensitive field.
func ByIsSensitive(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIsSensitive, opts...).ToFunc()
}
// ByIsRetired orders the results by the is_retired field.
func ByIsRetired(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIsRetired, opts...).ToFunc()
}
// ByIsSpamList orders the results by the is_spamList field.
func ByIsSpamList(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIsSpamList, opts...).ToFunc()
}
// ByIsMalware orders the results by the is_malware field.
func ByIsMalware(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIsMalware, opts...).ToFunc()
}
// ByLogoPath orders the results by the logo_path field.
func ByLogoPath(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldLogoPath, opts...).ToFunc()
}
// ByTrackedBreachesField orders the results by tracked_breaches field.
func ByTrackedBreachesField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newTrackedBreachesStep(), sql.OrderByField(field, opts...))
}
}
func newTrackedBreachesStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(TrackedBreachesInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, TrackedBreachesTable, TrackedBreachesColumn),
)
}