pbsql

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

README

pbsql

Go Report Card codecov

A reflection-based, lightweight, efficient, and nullsafe query generator for protobufs

Why?

Mostly because our database and current stack heavily utilizes null, and no existing sql library has helped us solve the problem cleanly. By simply tagging protobuf fields as nullable and reading that value during reflection we solve the problem by adding ifnull() (or coalesce()) and some runtime determined default value

Dependencies

Usage

This library assumes that:

  • you are okay with sending and recieving the same message over the wire, e.g.:

    rpc Create(User) returns (User) {}
    rpc Get(User)    returns (User) {}
    rpc Update(User) returns (User) {}
    
  • your proto structure is friendly to simple field masks (i.e. nested messages are not supported):

    map<string, int> field_mask = 1;
    
  • all time values can be represented as string instead of protobuf.Timestamp:

    • this is especially convenient for SQL since a time value of 2019-09-12 08:30:00 can be queried with string literals such as %2019%, %2019-09%, etc

A protobuf message should utilize the tags db:, nullable:, and primary_key:

  • db:
    • behaves exactly like sqlx, should be set to the database column name
  • nullable:
    • set this to any non attempt string to prevent reading null values.
  • primary_key:
    • make sure you denote the primary key to prevent it from being written into insert and update statements
Usage example

Your proto should looke something like this:

service UserSvc{
  rpc Create(User) returns (User) {}
}

message User {
  // @inject-tag: db:"id" primary_key:"y"
  int32 id = 1;
  // @inject-tag: db:"first_name"
  string first_name = 2;
  // @inject-tag: db:"last_name"
  string last_name = 3;
  // @inject-tag: db:"user_phone" nullable:"y"
  string phone = 4;

  map<string, int> field_mask = 5;
}

Implementation:

func (s *Service) Create(ctx context.Context, req *User) (*User, error) {

  // create query string, this also returns a []interface{} slice with each arg in order
  // this query string uses `?` for interpolation (not named vars)
  qry, args, err := pbsql.BuildCreateQuery("user", req)
  if err != nil {
    return nil, status.Errorf(codes.Internal, "failed to create prepared query string %v", err)
  }

  // now simply call the appropriate function and expand the args slice
  // sqlx.DB.Exec is great if you don't need a result set otherwise use
  // sqlx.DB.Queryx or sqlx.DB.QueryRowx
  res, err := s.DB.Exec(qry, args...)
  if err != nil {
    return nil, status.Errorf(codes.Internal, "failed to execute query %v", err)
  }
}
Collation

To force collation of particular field, you can add collation tag with collation name as the value, e.g. collation:"utf8mb4_0900_ai_ci". The internal default collation is utf8mb4_0900_ai_ci so to use that collation we can simply define collation:"default" and the marked field will use utf8mb4_0900_ai_ci.

Example:

type Task struct {
	..... 

	// @inject_tag: db:"date_performed" nullable:"y" collation:"default"
	DatePerformed string `protobuf:"bytes,30,opt,name=date_performed,json=datePerformed,proto3" json:"date_performed,omitempty" db:"date_performed" nullable:"y" collation:"default"`
	// @inject_tag: db:"spiff_tool_id" nullable:"y"
	SpiffToolId string `protobuf:"bytes,31,opt,name=spiff_tool_id,json=spiffToolId,proto3" json:"spiff_tool_id,omitempty" db:"spiff_tool_id" nullable:"y"`
	// @inject_tag: db:"spiff_tool_closeout_date" nullable:"y" collation:"default"
	OwnerName             string   `db:"owner_name" select_func:"name_of_user" func_arg_name:"external_id" collation:"default"`
	.....
}

Caveats

The query builder doesn't handle any sort of limit or offset behavior, but since it returns a plain string this would be simple to implement:

func (s *UserSvc) List(ctx context.Context, req *User) (*User, error) {
  qry, args, err := pbsql.BuildReadQuery("user", req)
  if err != nil {
    return nil, status.Errorf(codes.Internal, "failed to create prepared query string %v", err)
  }

  // add raw SQL to your query string
  limitedQry := qry + " OFFSET ?, LIMIT ?"

  // append the offset and limit to args before expanding
  rows, err := s.DB.Queryx(limitedQry, append(args, 0, 50)...)
  if err != nil {
    return status.Errorf(codes.Internal, "failed to execute query %v", err)
  }
  defer rows.Close()
}

Roadmap

  • Support a default_value tag in favor of guessing the default value at runtime
  • Support including foreign key related entities in query results
  • Support field masks in read queries
  • Support other DBMS

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCountQuery

func BuildCountQuery(target string, source interface{}, fieldMask ...string) (string, []interface{}, error)

BuildCountQuery is a convenience wrapper for getting the result count of a query already generated by pbsql value based, does not affect the initially supplied query string

func BuildCountQuery_OLD

func BuildCountQuery_OLD(selectQry string) string

BuildCountQuery_OLD is deprecated is a convenience wrapper for getting the result count of a query already generated by pbsql value based, does not affect the initially supplied query string

func BuildCreateQuery

func BuildCreateQuery(target string, source interface{}) (string, []interface{}, error)

BuildCreateQuery accepts a target table name and a protobuf message and attempts to build a valid SQL insert statement for use with sqlx.Named, ignoring any struct fields with default values. Fields must be tagged with `db:""` in order to be included in the result string.

func BuildDeleteQuery

func BuildDeleteQuery(target string, source interface{}) (string, []interface{}, error)

BuildDeleteQuery accepts a target table name and a protobuf message and attempts to build a valid SQL delete statement by utilizing struct tags to denote information such as database field names and whether something is a primary key. If successful, returns a SQL statement in the form of a string, a slice of args to interpolate, and a nil error.

This function returns a nullsafe query if nullable struct fields are properly tagged as `nullable:"y"`.

If an IsActive field is detected (is_active), this func returns an update statement that sets is_active to 0, otherwise it returns a delete statement

func BuildReadQuery

func BuildReadQuery(target string, source interface{}, fieldMask ...string) (string, []interface{}, error)

BuildReadQuery accepts a target table name and a protobuf message and attempts to build a valid SQL select statement, ignoring any struct fields with default values when writing predicates. Fields must be tagged with `db:""` in order to be included in the result string.

Returns a SQL statement as a string, a slice of args to interpolate, and an error

func BuildReadQueryWithNotList

func BuildReadQueryWithNotList(target string, source interface{}, notList []string, fieldMask ...string) (string, []interface{}, error)

BuildReadQueryWithNotList accepts a target table name and a protobuf message and attempts to build a valid SQL select statement, ignoring any struct fields with default values when writing predicates. Fields must be tagged with `db:""` in order to be included in the result string.

Returns a SQL statement as a string, a slice of args to interpolate, and an error

func BuildRelatedReadQuery

func BuildRelatedReadQuery(source interface{}, foreignKey string, foreignValue interface{}) string

BuildRelatedReadQuery can be used to quickly build queries for many to one relationships This method is still experimental

func BuildSearchQuery

func BuildSearchQuery(target string, source interface{}, searchPhrase string) (string, []interface{}, error)

BuildSearchQuery builds a search query

func BuildUpdateQuery

func BuildUpdateQuery(target string, source interface{}, fieldMask []string) (string, []interface{}, error)

BuildUpdateQuery accepts a target table name `target`, a struct `source`, and a list of struct fields `fieldMask` and attempts to build a valid sql update statement for use with sqlx.Named, ignoring any struct fields not present in `fieldMask`. Struct fields must also be tagged with `db:""`, and the primary key should be tagged as `primary_key` otherwise this function will return an invalid query

Types

type DispatchableTech

type DispatchableTech struct {

	// @inject_tag: db:"user_id"
	UserId int32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty" db:"user_id"`
	// @inject_tag: db:"techname" nullable:"y"
	Techname string `protobuf:"bytes,2,opt,name=techname,proto3" json:"techname,omitempty" db:"techname" nullable:"y"`
	// @inject_tag: db:"job_type" nullable:"y"
	JobType string `protobuf:"bytes,3,opt,name=job_type,json=jobType,proto3" json:"job_type,omitempty" db:"job_type" nullable:"y"`
	// @inject_tag: db:"user_phone" nullable:"y"
	UserPhone string `protobuf:"bytes,4,opt,name=user_phone,json=userPhone,proto3" json:"user_phone,omitempty" db:"user_phone" nullable:"y"`
	// @inject_tag: db:"user_email" nullable:"y"
	UserEmail string `protobuf:"bytes,5,opt,name=user_email,json=userEmail,proto3" json:"user_email,omitempty" db:"user_email" nullable:"y"`
	// @inject_tag: db:"event_id" nullable:"y"
	EventId int32 `protobuf:"varint,6,opt,name=event_id,json=eventId,proto3" json:"event_id,omitempty" db:"event_id" nullable:"y"`
	// @inject_tag: db:"property_user_id" nullable:"y"
	PropertyUserId int32 `` /* 141-byte string literal not displayed */
	// @inject_tag: db:"property_id" nullable:"y"
	PropertyId int32 `protobuf:"varint,8,opt,name=property_id,json=propertyId,proto3" json:"property_id,omitempty" db:"property_id" nullable:"y"`
	// @inject_tag: db:"property_city" nullable:"y"
	PropertyCity string `` /* 129-byte string literal not displayed */
	// @inject_tag: db:"geolocation_lat" nullable:"y"
	GeolocationLat float64 `` /* 140-byte string literal not displayed */
	// @inject_tag: db:"geolocation_lng" nullable:"y"
	GeolocationLng float64 `` /* 140-byte string literal not displayed */
	// @inject_tag: db:"activity"
	Activity string `protobuf:"bytes,12,opt,name=activity,proto3" json:"activity,omitempty" db:"activity"`
	// @inject_tag: db:"activity_date" nullable:"y"
	ActivityDate string   `` /* 130-byte string literal not displayed */
	FieldMask    []string `protobuf:"bytes,14,rep,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"`
	PageNumber   int32    `protobuf:"varint,15,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"`
	// contains filtered or unexported fields
}

type Event

type Event struct {
	// @inject_tag: db:"id" primary_key:"y"
	Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" db:"id" primary_key:"y"`
	// @inject_tag: db:"name"
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty" db:"name"`
	// @inject_tag: db:"description" nullable:"y"
	Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty" db:"description" nullable:"y"`
	// @inject_tag: db:"date_started" nullable:"y"
	DateStarted string `protobuf:"bytes,4,opt,name=date_started,json=dateStarted,proto3" json:"date_started,omitempty" db:"date_started" nullable:"y"`
	// @inject_tag: db:"date_ended" nullable:"y"
	DateEnded string `protobuf:"bytes,5,opt,name=date_ended,json=dateEnded,proto3" json:"date_ended,omitempty" db:"date_ended" nullable:"y"`
	// @inject_tag: db:"time_started" nullable:"y"
	TimeStarted string `protobuf:"bytes,6,opt,name=time_started,json=timeStarted,proto3" json:"time_started,omitempty" db:"time_started" nullable:"y"`
	// @inject_tag: db:"time_ended" nullable:"y"
	TimeEnded string `protobuf:"bytes,7,opt,name=time_ended,json=timeEnded,proto3" json:"time_ended,omitempty" db:"time_ended" nullable:"y"`
	// @inject_tag: db:"is_all_day"
	IsAllDay int32 `protobuf:"varint,8,opt,name=is_all_day,json=isAllDay,proto3" json:"is_all_day,omitempty" db:"is_all_day"`
	// @inject_tag: db:"repeat_type"
	RepeatType int32 `protobuf:"varint,9,opt,name=repeat_type,json=repeatType,proto3" json:"repeat_type,omitempty" db:"repeat_type"`
	// @inject_tag: db:"color"
	Color string `protobuf:"bytes,10,opt,name=color,proto3" json:"color,omitempty" db:"color"`
	// @inject_tag: db:"date_updated"
	DateUpdated string `protobuf:"bytes,11,opt,name=date_updated,json=dateUpdated,proto3" json:"date_updated,omitempty" db:"date_updated"`
	// @inject_tag: db:"date_created"
	DateCreated string `protobuf:"bytes,12,opt,name=date_created,json=dateCreated,proto3" json:"date_created,omitempty" db:"date_created"`
	// @inject_tag: db:"property_id"
	PropertyId int32 `protobuf:"varint,13,opt,name=property_id,json=propertyId,proto3" json:"property_id,omitempty" db:"property_id"`
	// @inject_tag: db:"contract_id" nullable:"y"
	ContractId int32 `protobuf:"varint,14,opt,name=contract_id,json=contractId,proto3" json:"contract_id,omitempty" db:"contract_id" nullable:"y"`
	// @inject_tag: db:"contract_number" nullable:"y"
	ContractNumber string `` /* 138-byte string literal not displayed */
	// @inject_tag: db:"log_jobNumber" nullable:"y"
	LogJobNumber string `` /* 132-byte string literal not displayed */
	// @inject_tag: db:"log_jobStatus" nullable:"y"
	LogJobStatus string `` /* 132-byte string literal not displayed */
	// @inject_tag: db:"log_PO" nullable:"y"
	LogPo string `protobuf:"bytes,18,opt,name=log_po,json=logPo,proto3" json:"log_po,omitempty" db:"log_PO" nullable:"y"`
	// @inject_tag: db:"log_notes" nullable:"y"
	LogNotes string `protobuf:"bytes,19,opt,name=log_notes,json=logNotes,proto3" json:"log_notes,omitempty" db:"log_notes" nullable:"y"`
	// @inject_tag: db:"log_technicianAssigned" nullable:"y"
	LogTechnicianAssigned string `` /* 168-byte string literal not displayed */
	// @inject_tag: db:"log_dateCompleted" nullable:"y"
	LogDateCompleted string `` /* 148-byte string literal not displayed */
	// @inject_tag: db:"log_materialsUsed" nullable:"y"
	LogMaterialsUsed string `` /* 148-byte string literal not displayed */
	// @inject_tag: db:"log_serviceRendered" nullable:"y"
	LogServiceRendered string `` /* 156-byte string literal not displayed */
	// @inject_tag: db:"log_techNotes" nullable:"y"
	LogTechNotes string `` /* 132-byte string literal not displayed */
	// @inject_tag: db:"log_billingDate" nullable:"y"
	LogBillingDate string `` /* 140-byte string literal not displayed */
	// @inject_tag: db:"log_amountCharged" nullable:"y"
	LogAmountCharged string `` /* 148-byte string literal not displayed */
	// @inject_tag: db:"log_payment_type" nullable:"y"
	LogPaymentType string `` /* 141-byte string literal not displayed */
	// @inject_tag: db:"log_paymentStatus" nullable:"y"
	LogPaymentStatus string `` /* 148-byte string literal not displayed */
	// @inject_tag: db:"log_timeIn" nullable:"y"
	LogTimeIn string `protobuf:"bytes,29,opt,name=log_time_in,json=logTimeIn,proto3" json:"log_time_in,omitempty" db:"log_timeIn" nullable:"y"`
	// @inject_tag: db:"log_timeOut" nullable:"y"
	LogTimeOut string `protobuf:"bytes,30,opt,name=log_time_out,json=logTimeOut,proto3" json:"log_time_out,omitempty" db:"log_timeOut" nullable:"y"`
	// @inject_tag: db:"log_type" nullable:"y"
	LogType string `protobuf:"bytes,31,opt,name=log_type,json=logType,proto3" json:"log_type,omitempty" db:"log_type" nullable:"y"`
	// @inject_tag: db:"log_contractNotes" nullable:"y"
	LogContractNotes string `` /* 148-byte string literal not displayed */
	// @inject_tag: db:"invoice_serviceItem" nullable:"y"
	InvoiceServiceItem string `` /* 156-byte string literal not displayed */
	// @inject_tag: db:"tstat_type" nullable:"y"
	TstatType string `protobuf:"bytes,34,opt,name=tstat_type,json=tstatType,proto3" json:"tstat_type,omitempty" db:"tstat_type" nullable:"y"`
	// @inject_tag: db:"tstat_brand" nullable:"y"
	TstatBrand string `protobuf:"bytes,35,opt,name=tstat_brand,json=tstatBrand,proto3" json:"tstat_brand,omitempty" db:"tstat_brand" nullable:"y"`
	// @inject_tag: db:"compressor_amps" nullable:"y"
	CompressorAmps string `` /* 138-byte string literal not displayed */
	// @inject_tag: db:"condensing_fan_amps" nullable:"y"
	CondensingFanAmps string `` /* 153-byte string literal not displayed */
	// @inject_tag: db:"suction_pressure" nullable:"y"
	SuctionPressure string `` /* 142-byte string literal not displayed */
	// @inject_tag: db:"head_pressure" nullable:"y"
	HeadPressure string `` /* 130-byte string literal not displayed */
	// @inject_tag: db:"return_temperature" nullable:"y"
	ReturnTemperature string `` /* 150-byte string literal not displayed */
	// @inject_tag: db:"supply_temperature" nullable:"y"
	SupplyTemperature string `` /* 150-byte string literal not displayed */
	// @inject_tag: db:"subcool" nullable:"y"
	Subcool string `protobuf:"bytes,42,opt,name=subcool,proto3" json:"subcool,omitempty" db:"subcool" nullable:"y"`
	// @inject_tag: db:"superheat" nullable:"y"
	Superheat string `protobuf:"bytes,43,opt,name=superheat,proto3" json:"superheat,omitempty" db:"superheat" nullable:"y"`
	// @inject_tag: db:"notes" nullable:"y"
	Notes string `protobuf:"bytes,44,opt,name=notes,proto3" json:"notes,omitempty" db:"notes" nullable:"y"`
	// @inject_tag: db:"services" nullable:"y"
	Services string `protobuf:"bytes,45,opt,name=services,proto3" json:"services,omitempty" db:"services" nullable:"y"`
	// @inject_tag: db:"servicesperformedrow1" nullable:"y"
	Servicesperformedrow1 string `` /* 136-byte string literal not displayed */
	// @inject_tag: db:"totalamountrow1" nullable:"y"
	Totalamountrow1 string `protobuf:"bytes,47,opt,name=totalamountrow1,proto3" json:"totalamountrow1,omitempty" db:"totalamountrow1" nullable:"y"`
	// @inject_tag: db:"servicesperformedrow2" nullable:"y"
	Servicesperformedrow2 string `` /* 136-byte string literal not displayed */
	// @inject_tag: db:"totalamountrow2" nullable:"y"
	Totalamountrow2 string `protobuf:"bytes,49,opt,name=totalamountrow2,proto3" json:"totalamountrow2,omitempty" db:"totalamountrow2" nullable:"y"`
	// @inject_tag: db:"servicesperformedrow3" nullable:"y"
	Servicesperformedrow3 string `` /* 136-byte string literal not displayed */
	// @inject_tag: db:"totalamountrow3" nullable:"y"
	Totalamountrow3 string `protobuf:"bytes,51,opt,name=totalamountrow3,proto3" json:"totalamountrow3,omitempty" db:"totalamountrow3" nullable:"y"`
	// @inject_tag: db:"servicesperformedrow4" nullable:"y"
	Servicesperformedrow4 string `` /* 136-byte string literal not displayed */
	// @inject_tag: db:"totalamountrow4" nullable:"y"
	Totalamountrow4 string `protobuf:"bytes,53,opt,name=totalamountrow4,proto3" json:"totalamountrow4,omitempty" db:"totalamountrow4" nullable:"y"`
	// @inject_tag: db:"discount" nullable:"y"
	Discount string `protobuf:"bytes,54,opt,name=discount,proto3" json:"discount,omitempty" db:"discount" nullable:"y"`
	// @inject_tag: db:"discountcost" nullable:"y"
	Discountcost string `protobuf:"bytes,55,opt,name=discountcost,proto3" json:"discountcost,omitempty" db:"discountcost" nullable:"y"`
	// @inject_tag: db:"log_notification" nullable:"y"
	LogNotification string `` /* 142-byte string literal not displayed */
	// @inject_tag: db:"diagnosticQuoted"
	DiagnosticQuoted int32 `` /* 133-byte string literal not displayed */
	// @inject_tag: db:"amountQuoted" nullable:"y"
	AmountQuoted string `` /* 129-byte string literal not displayed */
	// @inject_tag: db:"propertyBilling"
	PropertyBilling int32 `` /* 129-byte string literal not displayed */
	// @inject_tag: db:"isCallback" nullable:"y"
	IsCallback int32 `protobuf:"varint,60,opt,name=is_callback,json=isCallback,proto3" json:"is_callback,omitempty" db:"isCallback" nullable:"y"`
	// @inject_tag: db:"log_version"
	LogVersion int32 `protobuf:"varint,61,opt,name=log_version,json=logVersion,proto3" json:"log_version,omitempty" db:"log_version"`
	// @inject_tag: db:"job_type_id" nullable:"y"
	JobTypeId int32 `protobuf:"varint,62,opt,name=job_type_id,json=jobTypeId,proto3" json:"job_type_id,omitempty" db:"job_type_id" nullable:"y"`
	// @inject_tag: db:"job_subtype_id" nullable:"y"
	JobSubtypeId int32 `` /* 134-byte string literal not displayed */
	// @inject_tag: db:"callback_original_id" nullable:"y"
	CallbackOriginalId int32 `` /* 158-byte string literal not displayed */
	// @inject_tag: db:"callback_disposition" nullable:"y"
	CallbackDisposition int32 `` /* 159-byte string literal not displayed */
	// @inject_tag: db:"callback_comments" nullable:"y"
	CallbackComments string `` /* 146-byte string literal not displayed */
	// @inject_tag: db:"callback_technician" nullable:"y"
	CallbackTechnician int32 `` /* 155-byte string literal not displayed */
	// @inject_tag: db:"callback_approval_timestamp" nullable:"y"
	CallbackApprovalTimestamp string `` /* 185-byte string literal not displayed */
	// @inject_tag: db:"callback_comment_by" nullable:"y"
	CallbackCommentBy int32 `` /* 154-byte string literal not displayed */
	// @inject_tag: db:"document_id" nullable:"y"
	DocumentId int32 `protobuf:"varint,70,opt,name=document_id,json=documentId,proto3" json:"document_id,omitempty" db:"document_id" nullable:"y"`
	// @inject_tag: db:"material_used" nullable:"y"
	MaterialUsed string `` /* 130-byte string literal not displayed */
	// @inject_tag: db:"material_total" nullable:"y"
	MaterialTotal float64 `` /* 136-byte string literal not displayed */
	// @inject_tag: db:"isActive" nullable:"y"
	IsActive int32 `protobuf:"varint,73,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty" db:"isActive" nullable:"y"`
	// @inject_tag: db:"parent_id" nullable:"y"
	ParentId int32 `protobuf:"varint,74,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty" db:"parent_id" nullable:"y"`
	// @inject_tag: db:"isLmpc"
	IsLmpc int32 `protobuf:"varint,75,opt,name=is_lmpc,json=isLmpc,proto3" json:"is_lmpc,omitempty" db:"isLmpc"`
	// @inject_tag: db:"highPriority"
	HighPriority int32 `protobuf:"varint,76,opt,name=high_priority,json=highPriority,proto3" json:"high_priority,omitempty" db:"highPriority"`
	// @inject_tag: db:"isResidential"
	IsResidential int32  `protobuf:"varint,77,opt,name=is_residential,json=isResidential,proto3" json:"is_residential,omitempty" db:"isResidential"`
	JobType       string `protobuf:"bytes,78,opt,name=job_type,json=jobType,proto3" json:"job_type,omitempty"`
	JobSubtype    string `protobuf:"bytes,79,opt,name=job_subtype,json=jobSubtype,proto3" json:"job_subtype,omitempty"`
	Customer      *User  `` /* 131-byte string literal not displayed */
	// @inject_tag: foreign_key:"property_id" foreign_table:"properties"
	Property             *Property `` /* 148-byte string literal not displayed */
	FieldMask            []string  `protobuf:"bytes,82,rep,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"`
	PageNumber           int32     `protobuf:"varint,83,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"`
	OrderBy              string    `protobuf:"bytes,84,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"`
	OrderDir             string    `protobuf:"bytes,85,opt,name=order_dir,json=orderDir,proto3" json:"order_dir,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
	DateRange            []string  `date_target:"date_started"`
	DateTarget           string
}

type Property

type Property struct {
	// @inject_tag: db:"property_id" primary_key:"y"
	Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" db:"property_id" primary_key:"y"`
	// @inject_tag: db:"user_id" nullable:"y"
	UserId int32 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty" db:"user_id" nullable:"y"`
	// @inject_tag: db:"contract_id" nullable:"y"
	ContractId int32 `protobuf:"varint,3,opt,name=contract_id,json=contractId,proto3" json:"contract_id,omitempty" db:"contract_id" nullable:"y"`
	// @inject_tag: db:"property_address" nullable:"y"
	Address string `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty" db:"property_address" nullable:"y"`
	// @inject_tag: db:"property_city" nullable:"y"
	City string `protobuf:"bytes,5,opt,name=city,proto3" json:"city,omitempty" db:"property_city" nullable:"y"`
	// @inject_tag: db:"property_state" nullable:"y"
	State string `protobuf:"bytes,6,opt,name=state,proto3" json:"state,omitempty" db:"property_state" nullable:"y"`
	// @inject_tag: db:"property_zip" nullable:"y"
	Zip string `protobuf:"bytes,7,opt,name=zip,proto3" json:"zip,omitempty" db:"property_zip" nullable:"y"`
	// @inject_tag: db:"property_subdivision" nullable:"y"
	Subdivision string `protobuf:"bytes,8,opt,name=subdivision,proto3" json:"subdivision,omitempty" db:"property_subdivision" nullable:"y"`
	// @inject_tag: db:"property_directions" nullable:"y"
	Directions string `protobuf:"bytes,9,opt,name=directions,proto3" json:"directions,omitempty" db:"property_directions" nullable:"y"`
	// @inject_tag: db:"property_notes" nullable:"y"
	Notes string `protobuf:"bytes,10,opt,name=notes,proto3" json:"notes,omitempty" db:"property_notes" nullable:"y"`
	// @inject_tag: db:"property_date_created" nullable:"y"
	DateCreated string `` /* 135-byte string literal not displayed */
	// @inject_tag: db:"property_isActive"
	IsActive int32 `protobuf:"varint,12,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty" db:"property_isActive"`
	// @inject_tag: db:"property_isResidential" nullable:"y"
	IsResidential int32 `` /* 143-byte string literal not displayed */
	// @inject_tag: db:"property_notification" nullable:"y"
	Notification string `protobuf:"bytes,14,opt,name=notification,proto3" json:"notification,omitempty" db:"property_notification" nullable:"y"`
	// @inject_tag: db:"property_firstname" nullable:"y"
	Firstname string `protobuf:"bytes,15,opt,name=firstname,proto3" json:"firstname,omitempty" db:"property_firstname" nullable:"y"`
	// @inject_tag: db:"property_lastname" nullable:"y"
	Lastname string `protobuf:"bytes,16,opt,name=lastname,proto3" json:"lastname,omitempty" db:"property_lastname" nullable:"y"`
	// @inject_tag: db:"property_businessname" nullable:"y"
	Businessname string `protobuf:"bytes,17,opt,name=businessname,proto3" json:"businessname,omitempty" db:"property_businessname" nullable:"y"`
	// @inject_tag: db:"property_phone" nullable:"y"
	Phone string `protobuf:"bytes,18,opt,name=phone,proto3" json:"phone,omitempty" db:"property_phone" nullable:"y"`
	// @inject_tag: db:"property_altphone" nullable:"y"
	Altphone string `protobuf:"bytes,19,opt,name=altphone,proto3" json:"altphone,omitempty" db:"property_altphone" nullable:"y"`
	// @inject_tag: db:"property_email" nullable:"y"
	Email string `protobuf:"bytes,20,opt,name=email,proto3" json:"email,omitempty" db:"property_email" nullable:"y"`
	// @inject_tag: db:"geolocation_lat" nullable:"y"
	GeolocationLat float64 `` /* 140-byte string literal not displayed */
	// @inject_tag: db:"geolocation_lng" nullable:"y"
	GeolocationLng       float64  `` /* 140-byte string literal not displayed */
	FieldMask            []string `protobuf:"bytes,23,rep,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"`
	PageNumber           int32    `protobuf:"varint,24,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

type Query added in v1.0.2

type Query struct {
	Target    string
	Source    interface{}
	NotList   []string
	FieldMask []string
	Collate   bool
}

func (*Query) BuildRead added in v1.0.2

func (q *Query) BuildRead() (string, []interface{}, error)

type ServicesRendered

type ServicesRendered struct {
	// @inject_tag: db:"sr_id" primary_key:"y"
	Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" db:"sr_id" primary_key:"y"`
	// @inject_tag: db:"event_id" nullable:"y"
	EventId int32 `protobuf:"varint,2,opt,name=event_id,json=eventId,proto3" json:"event_id,omitempty" db:"event_id" nullable:"y"`
	// @inject_tag: db:"technician_user_id" nullable:"y"
	TechnicianUserId int32 `` /* 149-byte string literal not displayed */
	// @inject_tag: db:"sr_name"
	Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty" db:"sr_name"`
	// @inject_tag: db:"sr_materialsUsed" nullable:"y"
	MaterialsUsed string `` /* 135-byte string literal not displayed */
	// @inject_tag: db:"sr_serviceRendered" nullable:"y"
	ServiceRendered string `` /* 143-byte string literal not displayed */
	// @inject_tag: db:"sr_techNotes" nullable:"y"
	TechNotes string `protobuf:"bytes,7,opt,name=tech_notes,json=techNotes,proto3" json:"tech_notes,omitempty" db:"sr_techNotes" nullable:"y"`
	// @inject_tag: db:"sr_status"
	Status string `protobuf:"bytes,8,opt,name=status,proto3" json:"status,omitempty" db:"sr_status"`
	// @inject_tag: db:"sr_datetime"
	Datetime string `protobuf:"bytes,9,opt,name=datetime,proto3" json:"datetime,omitempty" db:"sr_datetime"`
	// @inject_tag: db:"time_started" nullable:"y"
	TimeStarted string `` /* 126-byte string literal not displayed */
	// @inject_tag: db:"time_finished" nullable:"y"
	TimeFinished string `` /* 130-byte string literal not displayed */
	// @inject_tag: db:"isactive" nullable:"y"
	IsActive int32 `protobuf:"varint,12,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty" db:"isactive" nullable:"y"`
	// @inject_tag: db:"hide_from_timesheet" nullable:"y"
	HideFromTimesheet int32 `` /* 154-byte string literal not displayed */
	// @inject_tag: db:"signature_id" nullable:"y"
	SignatureId int32 `` /* 127-byte string literal not displayed */
	// @inject_tag: db:"signatureData" nullable:"y"
	SignatureData        string   `` /* 133-byte string literal not displayed */
	FieldMask            []string `protobuf:"bytes,16,rep,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"`
	PageNumber           int32    `protobuf:"varint,17,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"`
	OrderBy              string   `protobuf:"bytes,61,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"`
	OrderDir             string   `protobuf:"bytes,62,opt,name=order_dir,json=orderDir,proto3" json:"order_dir,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

type Task

type Task struct {
	// @inject_tag: db:"task_id " primary_key:"y"
	Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" db:"task_id" primary_key:"y"`
	// @inect_tag: multi_value:"external_id"
	ExternalIds []string `protobuf:"varint,36,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty" multi_value:"external_id"`
	// @inject_tag: db:"external_id"
	ExternalId int32 `protobuf:"varint,2,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty" db:"external_id"`
	// @inject_tag: db:"external_code" nullable:"y"
	ExternalCode string `` /* 129-byte string literal not displayed */
	// @inject_tag: db:"reference_number" nullable:"y"
	ReferenceNumber string `` /* 141-byte string literal not displayed */
	// @inject_tag: db:"creator_user_id"
	CreatorUserId int32 `protobuf:"varint,5,opt,name=creator_user_id,json=creatorUserId,proto3" json:"creator_user_id,omitempty" db:"creator_user_id"`
	// @inject_tag: db:"time_created"
	TimeCreated string `protobuf:"bytes,6,opt,name=time_created,json=timeCreated,proto3" json:"time_created,omitempty" db:"time_created"`
	// @inject_tag: db:"time_due" nullable:"y"
	TimeDue string `protobuf:"bytes,7,opt,name=time_due,json=timeDue,proto3" json:"time_due,omitempty" db:"time_due" nullable:"y"`
	// @inject_tag: db:"brief_description" nullable:"y"
	BriefDescription string `` /* 145-byte string literal not displayed */
	// @inject_tag: db:"details" nullable:"y"
	Details string `protobuf:"bytes,9,opt,name=details,proto3" json:"details,omitempty" db:"details" nullable:"y"`
	// @inject_tag: db:"notes" nullable:"y"
	Notes string `protobuf:"bytes,10,opt,name=notes,proto3" json:"notes,omitempty" db:"notes" nullable:"y"`
	// @inject_tag: db:"status_id"
	StatusId int32 `protobuf:"varint,11,opt,name=status_id,json=statusId,proto3" json:"status_id,omitempty" db:"status_id"`
	// @inject_tag: db:"priority_id"
	PriorityId int32 `protobuf:"varint,12,opt,name=priority_id,json=priorityId,proto3" json:"priority_id,omitempty" db:"priority_id"`
	// @inject_tag: db:"reference_url" nullable:"y"
	ReferenceUrl string `` /* 130-byte string literal not displayed */
	// @inject_tag: db:"isActive" nullable:"y"
	IsActive int32 `protobuf:"varint,14,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty" db:"isActive" nullable:"y"`
	// @inject_tag: db:"billable"
	Billable int32 `protobuf:"varint,15,opt,name=billable,proto3" json:"billable,omitempty" db:"billable"`
	// @inject_tag: db:"task_billable_type" nullable:"y"
	BillableType string `` /* 135-byte string literal not displayed */
	// @inject_tag: db:"flat_rate" nullable:"y"
	FlatRate float64 `protobuf:"fixed64,17,opt,name=flat_rate,json=flatRate,proto3" json:"flat_rate,omitempty" db:"flat_rate" nullable:"y"`
	// @inject_tag: db:"hourly_start" nullable:"y"
	HourlyStart string `` /* 126-byte string literal not displayed */
	// @inject_tag: db:"hourly_end" nullable:"y"
	HourlyEnd string `protobuf:"bytes,19,opt,name=hourly_end,json=hourlyEnd,proto3" json:"hourly_end,omitempty" db:"hourly_end" nullable:"y"`
	// @inject_tag: db:"address" nullable:"y"
	Address string `protobuf:"bytes,20,opt,name=address,proto3" json:"address,omitempty" db:"address" nullable:"y"`
	// @inject_tag: db:"order_num" nullable:"y"
	OrderNum string `protobuf:"bytes,21,opt,name=order_num,json=orderNum,proto3" json:"order_num,omitempty" db:"order_num" nullable:"y"`
	// @inject_tag: db:"spiff_amount"
	SpiffAmount float64 `protobuf:"fixed64,22,opt,name=spiff_amount,json=spiffAmount,proto3" json:"spiff_amount,omitempty" db:"spiff_amount"`
	// @inject_tag: db:"spiff_jobNumber" nullable:"y"
	SpiffJobNumber string `` /* 140-byte string literal not displayed */
	// @inject_tag: db:"spiff_type_id" nullable:"y"
	SpiffTypeId int32 `` /* 130-byte string literal not displayed */
	// @inject_tag: db:"spiff_address" nullable:"y"
	SpiffAddress string `` /* 130-byte string literal not displayed */
	// @inject_tag: db:"toolpurchase_date" nullable:"y"
	ToolpurchaseDate string `` /* 146-byte string literal not displayed */
	// @inject_tag: db:"toolpurchase_cost"
	ToolpurchaseCost float64 `` /* 135-byte string literal not displayed */
	// @inject_tag: db:"toolpurchase_file" nullable:"y"
	ToolpurchaseFile string `` /* 146-byte string literal not displayed */
	// @inject_tag: db:"admin_action_id" nullable:"y"
	AdminActionId int32 `` /* 138-byte string literal not displayed */
	// @inject_tag: db:"date_performed" nullable:"y" collation:"default"
	DatePerformed string `` /* 154-byte string literal not displayed */
	// @inject_tag: db:"spiff_tool_id" nullable:"y"
	SpiffToolId string `` /* 129-byte string literal not displayed */
	// @inject_tag: db:"spiff_tool_closeout_date" nullable:"y" collation:"default"
	OwnerName             string   `db:"owner_name" select_func:"name_of_user" func_arg_name:"external_id" collation:"default"`
	SpiffToolCloseoutDate string   `` /* 172-byte string literal not displayed */
	FieldMask             []string `protobuf:"bytes,33,rep,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"`
	NotEquals             []string `protobuf:"bytes,54,rep,name=not_list,json=notEquals,proto3" json:"not_equals,omitempty"`
	PageNumber            int32    `protobuf:"varint,34,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"`
	// @inject_tag: date_target:"date_performed"
	DateRange            []string `protobuf:"bytes,35,rep,name=date_range,json=dateRange,proto3" json:"date_range,omitempty" date_target:"date_performed"`
	DateTarget           string   `protobuf:"bytes,43,opt,name=date_target,json=dateTarget,proto3" json:"date_target,omitempty"`
	OrderBy              string   `protobuf:"bytes,40,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"`
	OrderDir             string   `protobuf:"bytes,41,opt,name=order_dir,json=orderDir,proto3" json:"order_dir,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
	GroupBy              string
}

type TimesheetLine

type TimesheetLine struct {

	// @inject_tag: db:"id" primary_key:"y"
	Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" db:"id" primary_key:"y"`
	// @inject_tag: db:"event_id" nullable:"y"
	EventId int32 `protobuf:"varint,2,opt,name=event_id,json=eventId,proto3" json:"event_id,omitempty" db:"event_id" nullable:"y"`
	// @inject_tag: db:"services_rendered_id" nullable:"y"
	ServicesRenderedId int32 `` /* 157-byte string literal not displayed */
	// @inject_tag: db:"task_event_id" nullable:"y"
	TaskEventId int32 `` /* 129-byte string literal not displayed */
	// @inject_tag: db:"class_code"
	ClassCodeId int32 `protobuf:"varint,5,opt,name=class_code_id,json=classCodeId,proto3" json:"class_code_id,omitempty" db:"class_code"`
	// @inject_tag: db:"department_code"
	DepartmentCode int32 `protobuf:"varint,6,opt,name=department_code,json=departmentCode,proto3" json:"department_code,omitempty" db:"department_code"`
	// @inject_tag: db:"brief_description" nullable:"y"
	BriefDescription string `` /* 145-byte string literal not displayed */
	// @inject_tag: db:"reference_number" nullable:"y"
	ReferenceNumber string `` /* 141-byte string literal not displayed */
	// @inject_tag: db:"notes" nullable:"y"
	Notes string `protobuf:"bytes,9,opt,name=notes,proto3" json:"notes,omitempty" db:"notes" nullable:"y"`
	// @inject_tag: db:"admin_approval_user_id" nullable:"y"
	AdminApprovalUserId int32 `` /* 165-byte string literal not displayed */
	// @inject_tag: db:"admin_approval_datetime" nullable:"y"
	AdminApprovalDatetime string `` /* 169-byte string literal not displayed */
	// @inject_tag: db:"user_approval_datetime" nullable:"y"
	UserApprovalDatetime string `` /* 165-byte string literal not displayed */
	// @inject_tag: db:"time_started" nullable:"y"
	TimeStarted string `` /* 126-byte string literal not displayed */
	// @inject_tag: db:"time_finished" nullable:"y"
	TimeFinished string `` /* 130-byte string literal not displayed */
	// @inject_tag: db:"technician_user_id"
	TechnicianUserId int32 `` /* 137-byte string literal not displayed */
	// @inject_tag: db:"isactive" nullable:"y"
	IsActive   int32    `protobuf:"varint,16,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty" db:"isactive" nullable:"y"`
	FieldMask  []string `protobuf:"bytes,17,rep,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"`
	PageNumber int32    `protobuf:"varint,18,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"`
	// @inject_tag: date_target:"time_started"
	DateRange  []string `protobuf:"bytes,20,rep,name=date_range,json=dateRange,proto3" json:"date_range,omitempty" date_target:"time_started"`
	DateTarget []string `protobuf:"bytes,21,rep,name=date_target,json=dateTarget,proto3" json:"date_target,omitempty"`
	// @inject_tag: db:"property_id" ignore:"y"
	EventPropertyId int32 `` /* 138-byte string literal not displayed */
	// @inject_tag: db:"user_id" ignore:"y"
	EventUserId int32 `protobuf:"varint,23,opt,name=event_user_id,json=eventUserId,proto3" json:"event_user_id,omitempty" db:"user_id" ignore:"y"`
	// @inject_tag: db:"technician_user_name" select_func:"name_of_user" func_arg_name:"technician_user_id" ignore:"y"
	TechnicianUserName string `` /* 217-byte string literal not displayed */
	// @inject_tag: db:"department_name" select_func:"name_of_department_by_id" func_arg_name:"department_code" ignore:"y"
	DepartmentName     string   `` /* 207-byte string literal not displayed */
	NotEquals          []string `protobuf:"bytes,26,rep,name=not_equals,json=notEquals,proto3" json:"not_equals,omitempty"`
	OrderBy            string   `protobuf:"bytes,27,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"`
	OrderDir           string   `protobuf:"bytes,28,opt,name=order_dir,json=orderDir,proto3" json:"order_dir,omitempty"`
	GroupBy            string   `protobuf:"bytes,29,opt,name=group_by,json=groupBy,proto3" json:"group_by,omitempty"`
	DepartmentCodeList string   `` /* 166-byte string literal not displayed */
	// contains filtered or unexported fields
}

type Transaction

type Transaction struct {

	// @inject_tag: db:"id" primary_key:"y"
	Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" db:"id" primary_key:"y"`
	// @inject_tag: db:"job_id" nullable:"y"
	JobId int32 `protobuf:"varint,2,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty" db:"job_id" nullable:"y"`
	// @inject_tag: db:"department_id" nullable:"y"
	DepartmentId int32 `` /* 130-byte string literal not displayed */
	// @inject_tag: db:"owner_id" nullable:"y"
	OwnerId int32 `protobuf:"varint,4,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty" db:"owner_id" nullable:"y"`
	// @inject_tag: db:"vendor" nullable:"y"
	Vendor string `protobuf:"bytes,5,opt,name=vendor,proto3" json:"vendor,omitempty" db:"vendor" nullable:"y"`
	// @inject_tag: db:"cost_center_id" nullable:"y"
	CostCenterId int32 `` /* 133-byte string literal not displayed */
	// @inject_tag: db:"description" nullable:"y"
	Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" db:"description" nullable:"y"`
	// @inject_tag: db:"amount" nullable:"y"
	Amount float64 `protobuf:"fixed64,8,opt,name=amount,proto3" json:"amount,omitempty" db:"amount" nullable:"y"`
	// @inject_tag: db:"timestamp" nullable:"y"
	Timestamp string `protobuf:"bytes,9,opt,name=timestamp,proto3" json:"timestamp,omitempty" db:"timestamp" nullable:"y"`
	// @inject_tag: db:"notes" nullable:"y"
	Notes string `protobuf:"bytes,10,opt,name=notes,proto3" json:"notes,omitempty" db:"notes" nullable:"y"`
	// @inject_tag: db:"is_active" nullable:"y"
	IsActive int32 `protobuf:"varint,11,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty" db:"is_active" nullable:"y"`
	// @inject_tag: db:"status_id"
	StatusId int32 `protobuf:"varint,12,opt,name=status_id,json=statusId,proto3" json:"status_id,omitempty" db:"status_id"`
	// @inect_tag: db:"status" select_func:"transaction_status_name" func_arg_name:"status_id" ignore:"y"
	Status string `protobuf:"bytes,13,opt,name=status,proto3" json:"status,omitempty"`
	// @inject_tag: db:"owner_name" select_func:"name_of_user" func_arg_name:"owner_id" ignore:"y"
	OwnerName string `` /* 168-byte string literal not displayed */
	// @inject_tag: db:"card_used" select_func:"card_by_user" func_arg_name:"owner_id" ignore:"y"
	CardUsed   string   `` /* 164-byte string literal not displayed */
	PageNumber int32    `protobuf:"varint,18,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"`
	FieldMask  []string `protobuf:"bytes,19,rep,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"`
	OrderBy    string   `protobuf:"bytes,22,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"`
	OrderDir   string   `protobuf:"bytes,23,opt,name=order_dir,json=orderDir,proto3" json:"order_dir,omitempty"`
	// @inject_tag: db:"is_audited"
	IsAudited bool `protobuf:"varint,24,opt,name=is_audited,json=isAudited,proto3" json:"is_audited,omitempty" db:"is_audited"`
	// @inject_tag: db:"is_recorded"
	IsRecorded   bool   `protobuf:"varint,25,opt,name=is_recorded,json=isRecorded,proto3" json:"is_recorded,omitempty" db:"is_recorded"`
	SearchPhrase string `protobuf:"bytes,26,opt,name=search_phrase,json=searchPhrase,proto3" json:"search_phrase,omitempty"`
	// @inject_tag: db:"artificial_id" nullable:"y"
	ArtificalId string `` /* 127-byte string literal not displayed */
	// @inject_tag: db:"department_string" select_func:"get_department_string" func_arg_name:"department_id" ignore:"y"
	DepartmentString string `` /* 210-byte string literal not displayed */
	// @inject_tag: db:"cost_center_string" select_func:"get_cost_center" func_arg_name:"cost_center_id" ignore:"y"
	CostCenterString string `` /* 208-byte string literal not displayed */
	// @inject_tag: db:"activity_log_string" select_func:"get_txn_activity_string" func_arg_name:"id" ignore:"y"
	ActivityLogString string `` /* 208-byte string literal not displayed */
	// inject_tag: db:"txn_document_string" select_func:"get_txn_document_string" func_arg_name:"id" ignore:"y"
	// string documents_string = 31;
	NotEquals []string `protobuf:"bytes,31,rep,name=not_equals,json=notEquals,proto3" json:"not_equals,omitempty"`
	// @inject_tag: multi_value:"y" name:"department_id" ignore:"y"
	DepartmentIdList string `` /* 160-byte string literal not displayed */
	// @inject_tag: db:"vendor_category" multi_value:"y" nullable:"y"
	VendorCategory string `` /* 154-byte string literal not displayed */
	WithoutLimit   bool   `protobuf:"varint,34,opt,name=without_limit,json=withoutLimit,proto3" json:"without_limit,omitempty"`
	// @inject_tag: db:"assigned_employee_id" nullable:"y"
	AssignedEmployeeId int32 `` /* 158-byte string literal not displayed */
	// @inject_tag: db:"assigned_employee_name" select_func:"name_of_user" func_arg_name:"assigned_employee_id" ignore:"y"
	AssignedEmployeeName string `` /* 227-byte string literal not displayed */
	// contains filtered or unexported fields
}

type User

type User struct {
	// @inject_tag: db:"user_id" primary_key:"y"
	Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" db:"user_id" primary_key:"y"`
	// @inject_tag: db:"user_firstname" nullable:"y"
	Firstname string `protobuf:"bytes,2,opt,name=firstname,proto3" json:"firstname,omitempty" db:"user_firstname" nullable:"y"`
	// @inject_tag: db:"user_lastname" nullable:"y"
	Lastname string `protobuf:"bytes,3,opt,name=lastname,proto3" json:"lastname,omitempty" db:"user_lastname" nullable:"y"`
	// @inject_tag: db:"user_businessname" nullable:"y"
	Businessname string `protobuf:"bytes,4,opt,name=businessname,proto3" json:"businessname,omitempty" db:"user_businessname" nullable:"y"`
	// @inject_tag: db:"user_city" nullable:"y"
	City string `protobuf:"bytes,5,opt,name=city,proto3" json:"city,omitempty" db:"user_city" nullable:"y"`
	// @inject_tag: db:"user_state" nullable:"y"
	State string `protobuf:"bytes,6,opt,name=state,proto3" json:"state,omitempty" db:"user_state" nullable:"y"`
	// @inject_tag: db:"user_zip" nullable:"y"
	Zip string `protobuf:"bytes,7,opt,name=zip,proto3" json:"zip,omitempty" db:"user_zip" nullable:"y"`
	// @inject_tag: db:"user_address" nullable:"y"
	Address string `protobuf:"bytes,8,opt,name=address,proto3" json:"address,omitempty" db:"user_address" nullable:"y"`
	// @inject_tag: db:"user_phone" nullable:"y"
	Phone string `protobuf:"bytes,9,opt,name=phone,proto3" json:"phone,omitempty" db:"user_phone" nullable:"y"`
	// @inject_tag: db:"user_altphone" nullable:"y"
	Altphone string `protobuf:"bytes,10,opt,name=altphone,proto3" json:"altphone,omitempty" db:"user_altphone" nullable:"y"`
	// @inject_tag: db:"user_cellphone" nullable:"y"
	Cellphone string `protobuf:"bytes,11,opt,name=cellphone,proto3" json:"cellphone,omitempty" db:"user_cellphone" nullable:"y"`
	// @inject_tag: db:"user_fax" nullable:"y"
	Fax string `protobuf:"bytes,12,opt,name=fax,proto3" json:"fax,omitempty" db:"user_fax" nullable:"y"`
	// @inject_tag: db:"user_email" nullable:"y"
	Email string `protobuf:"bytes,13,opt,name=email,proto3" json:"email,omitempty" db:"user_email" nullable:"y"`
	// @inject_tag: db:"user_alt_email" nullable:"y"
	AltEmail string `protobuf:"bytes,14,opt,name=alt_email,json=altEmail,proto3" json:"alt_email,omitempty" db:"user_alt_email" nullable:"y"`
	// @inject_tag: db:"user_phone_email" nullable:"y"
	PhoneEmail string `` /* 127-byte string literal not displayed */
	// @inject_tag: db:"user_preferredContact" nullable:"y"
	PreferredContact string `` /* 150-byte string literal not displayed */
	// @inject_tag: db:"user_receiveemail" nullable:"y"
	Receiveemail int32 `protobuf:"varint,17,opt,name=receiveemail,proto3" json:"receiveemail,omitempty" db:"user_receiveemail" nullable:"y"`
	// @inject_tag: db:"user_date_created" nullable:"y"
	DateCreated string `` /* 131-byte string literal not displayed */
	// @inject_tag: db:"user_last_login" nullable:"y"
	LastLogin string `protobuf:"bytes,19,opt,name=last_login,json=lastLogin,proto3" json:"last_login,omitempty" db:"user_last_login" nullable:"y"`
	// @inject_tag: db:"annual_hours_pto" nullable:"y"
	AnnualHoursPto float64 `` /* 143-byte string literal not displayed */
	// @inject_tag: db:"bonus_hours_pto" nullable:"y"
	BonusHoursPto float64 `` /* 139-byte string literal not displayed */
	// @inject_tag: db:"user_isActive" nullable:"y"
	IsActive int32 `protobuf:"varint,23,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty" db:"user_isActive" nullable:"y"`
	// @inject_tag: db:"user_isSU" nullable:"y"
	Is_SU int32 `protobuf:"varint,24,opt,name=is_SU,json=isSU,proto3" json:"is_SU,omitempty" db:"user_isSU" nullable:"y"`
	// @inject_tag: db:"user_isAdmin" nullable:"y"
	IsAdmin int32 `protobuf:"varint,25,opt,name=is_admin,json=isAdmin,proto3" json:"is_admin,omitempty" db:"user_isAdmin" nullable:"y"`
	// @inject_tag: db:"is_office_staff" nullable:"y"
	IsOfficeStaff int32 `` /* 138-byte string literal not displayed */
	// @inject_tag: db:"user_office_group" nullable:"y"
	OfficeGroup int32 `` /* 132-byte string literal not displayed */
	// @inject_tag: db:"is_hvac_tech" nullable:"y"
	IsHvacTech int32 `` /* 126-byte string literal not displayed */
	// @inject_tag: db:"tech_assist" nullable:"y"
	TechAssist int32 `protobuf:"varint,29,opt,name=tech_assist,json=techAssist,proto3" json:"tech_assist,omitempty" db:"tech_assist" nullable:"y"`
	// @inject_tag: db:"user_calendarPref" nullable:"y"
	CalendarPref string `` /* 134-byte string literal not displayed */
	// @inject_tag: db:"user_multiProperty" nullable:"y"
	MultiProperty int32 `` /* 139-byte string literal not displayed */
	// @inject_tag: db:"user_isEmployee" nullable:"y"
	IsEmployee int32 `` /* 127-byte string literal not displayed */
	// @inject_tag: db:"employee_function_id" nullable:"y"
	EmployeeFunctionId int32 `` /* 158-byte string literal not displayed */
	// @inject_tag: db:"employee_department_id" nullable:"y"
	EmployeeDepartmentId int32 `` /* 166-byte string literal not displayed */
	// @inject_tag: db:"user_login" nullable:"y"
	Login string `protobuf:"bytes,35,opt,name=login,proto3" json:"login,omitempty" db:"user_login" nullable:"y"`
	// @inject_tag: db:"user_pwd" nullable:"y"
	Pwd string `protobuf:"bytes,36,opt,name=pwd,proto3" json:"pwd,omitempty" db:"user_pwd" nullable:"y"`
	// @inject_tag: db:"user_notes" nullable:"y"
	Notes string `protobuf:"bytes,37,opt,name=notes,proto3" json:"notes,omitempty" db:"user_notes" nullable:"y"`
	// @inject_tag: db:"user_intNotes" nullable:"y"
	IntNotes string `protobuf:"bytes,38,opt,name=int_notes,json=intNotes,proto3" json:"int_notes,omitempty" db:"user_intNotes" nullable:"y"`
	// @inject_tag: db:"user_notification" nullable:"y"
	Notification string `protobuf:"bytes,39,opt,name=notification,proto3" json:"notification,omitempty" db:"user_notification" nullable:"y"`
	// @inject_tag: db:"user_billingTerms" nullable:"y"
	BillingTerms string `` /* 134-byte string literal not displayed */
	// @inject_tag: db:"user_rebate" nullable:"y"
	Rebate int32 `protobuf:"varint,41,opt,name=rebate,proto3" json:"rebate,omitempty" db:"user_rebate" nullable:"y"`
	// @inject_tag: db:"user_discount" nullable:"y"
	Discount int32 `protobuf:"varint,42,opt,name=discount,proto3" json:"discount,omitempty" db:"user_discount" nullable:"y"`
	// @inject_tag: db:"user_managed_by" nullable:"y"
	ManagedBy int32 `protobuf:"varint,43,opt,name=managed_by,json=managedBy,proto3" json:"managed_by,omitempty" db:"user_managed_by" nullable:"y"`
	// @inject_tag: db:"current_status" nullable:"y"
	CurrentStatus string `` /* 134-byte string literal not displayed */
	// @inject_tag: db:"current_status_jobNumber" nullable:"y"
	CurrentStatusJobNumber string `` /* 175-byte string literal not displayed */
	// @inject_tag: db:"current_status_timestamp" nullable:"y"
	CurrentStatusTimestamp string `` /* 173-byte string literal not displayed */
	// @inject_tag: db:"emp_title" nullable:"y"
	EmpTitle string `protobuf:"bytes,47,opt,name=emp_title,json=empTitle,proto3" json:"emp_title,omitempty" db:"emp_title" nullable:"y"`
	// @inject_tag: db:"ext" nullable:"y"
	Ext string `protobuf:"bytes,48,opt,name=ext,proto3" json:"ext,omitempty" db:"ext" nullable:"y"`
	// @inject_tag: db:"image" nullable:"y"
	Image string `protobuf:"bytes,49,opt,name=image,proto3" json:"image,omitempty" db:"image" nullable:"y"`
	// @inject_tag: db:"user_serviceCalls" nullable:"y"
	ServiceCalls int32 `` /* 135-byte string literal not displayed */
	// @inject_tag: db:"user_show_billing" nullable:"y"
	ShowBilling int32 `` /* 132-byte string literal not displayed */
	// @inject_tag: db:"paid_service_call_status" nullable:"y"
	PaidServiceCallStatus int32 `` /* 173-byte string literal not displayed */
	// @inject_tag: db:"is_color_mute" nullable:"y"
	IsColorMute int32 `` /* 130-byte string literal not displayed */
	// @inject_tag: db:"service_call_refresh" nullable:"y"
	ServiceCallRefresh int32 `` /* 158-byte string literal not displayed */
	// @inject_tag: db:"tool_fund" nullable:"y"
	ToolFund float64 `protobuf:"fixed64,55,opt,name=tool_fund,json=toolFund,proto3" json:"tool_fund,omitempty" db:"tool_fund" nullable:"y"`
	// @inject_tag: db:"spiff_fund" nullable:"y"
	SpiffFund float64 `protobuf:"fixed64,56,opt,name=spiff_fund,json=spiffFund,proto3" json:"spiff_fund,omitempty" db:"spiff_fund" nullable:"y"`
	// @inject_tag: db:"geolocation_lat" nullable:"y"
	GeolocationLat float64 `` /* 140-byte string literal not displayed */
	// @inject_tag: db:"geolocation_lng" nullable:"y"
	GeolocationLng float64 `` /* 140-byte string literal not displayed */
	// @inject_tag: foreign_key:"technician_user_id" foreign_table:"services_rendered" local_name:"user_id"
	ServicesRendered     *ServicesRendered `` /* 198-byte string literal not displayed */
	FieldMask            []string          `protobuf:"bytes,59,rep,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"`
	PageNumber           int32             `protobuf:"varint,60,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"`
	OrderBy              string            `protobuf:"bytes,61,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"`
	OrderDir             string            `protobuf:"bytes,62,opt,name=order_dir,json=orderDir,proto3" json:"order_dir,omitempty"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL