xo

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package xo contains generated code for schema 'cloud-run-api-emulator.db'.

Index

Constants

This section is empty.

Variables

View Source
var TimestampFormats = []string{

	"2006-01-02 15:04:05.999999999-07:00",
	"2006-01-02T15:04:05.999999999-07:00",
	"2006-01-02 15:04:05.999999999",
	"2006-01-02T15:04:05.999999999",
	"2006-01-02 15:04:05",
	"2006-01-02T15:04:05",
	"2006-01-02 15:04",
	"2006-01-02T15:04",
	"2006-01-02",
}

TimestampFormats are the timestamp formats used by SQLite3 database drivers to store a time.Time in SQLite3.

The first format in the slice will be used when saving time values into the database. When parsing a string from a timestamp or datetime column, the formats are tried in order.

Functions

func Errorf

func Errorf(s string, v ...interface{})

Errorf logs an error message using the package error logger.

func Logf

func Logf(s string, v ...interface{})

Logf logs a message using the package logger.

func SetErrorLogger

func SetErrorLogger(logger interface{})

SetErrorLogger sets the package error logger. Valid logger types:

io.Writer
func(string, ...interface{}) (int, error) // fmt.Printf
func(string, ...interface{}) // log.Printf

func SetLogger

func SetLogger(logger interface{})

SetLogger sets the package logger. Valid logger types:

io.Writer
func(string, ...interface{}) (int, error) // fmt.Printf
func(string, ...interface{}) // log.Printf

Types

type DB

type DB interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

DB is the common interface for database operations that can be used with types from schema 'cloud-run-api-emulator.db'.

This works with both database/sql.DB and database/sql.Tx.

type ErrInsertFailed

type ErrInsertFailed struct {
	Err error
}

ErrInsertFailed is the insert failed error.

func (*ErrInsertFailed) Error

func (err *ErrInsertFailed) Error() string

Error satisfies the error interface.

func (*ErrInsertFailed) Unwrap

func (err *ErrInsertFailed) Unwrap() error

Unwrap satisfies the unwrap interface.

type ErrInvalidTime

type ErrInvalidTime string

ErrInvalidTime is the invalid Time error.

func (ErrInvalidTime) Error

func (err ErrInvalidTime) Error() string

Error satisfies the error interface.

type ErrUpdateFailed

type ErrUpdateFailed struct {
	Err error
}

ErrUpdateFailed is the update failed error.

func (*ErrUpdateFailed) Error

func (err *ErrUpdateFailed) Error() string

Error satisfies the error interface.

func (*ErrUpdateFailed) Unwrap

func (err *ErrUpdateFailed) Unwrap() error

Unwrap satisfies the unwrap interface.

type ErrUpsertFailed

type ErrUpsertFailed struct {
	Err error
}

ErrUpsertFailed is the upsert failed error.

func (*ErrUpsertFailed) Error

func (err *ErrUpsertFailed) Error() string

Error satisfies the error interface.

func (*ErrUpsertFailed) Unwrap

func (err *ErrUpsertFailed) Unwrap() error

Unwrap satisfies the unwrap interface.

type Error

type Error string

Error is an error.

const (
	// ErrAlreadyExists is the already exists error.
	ErrAlreadyExists Error = "already exists"
	// ErrDoesNotExist is the does not exist error.
	ErrDoesNotExist Error = "does not exist"
	// ErrMarkedForDeletion is the marked for deletion error.
	ErrMarkedForDeletion Error = "marked for deletion"
)

Error values.

func (Error) Error

func (err Error) Error() string

Error satisfies the error interface.

type ListNextServices

type ListNextServices struct {
	Parent      string `json:"parent"`      // parent
	Name        string `json:"name"`        // name
	Description string `json:"description"` // description
	UID         string `json:"uid"`         // uid
	URI         string `json:"uri"`         // uri
	Generation  int64  `json:"generation"`  // generation
	CreatedAt   Time   `json:"created_at"`  // created_at
}

ListNextServices represents a row from 'list_next_services'.

func ListNextServicesByParentCreatedAtNameLimit

func ListNextServicesByParentCreatedAtNameLimit(ctx context.Context, db DB, parent, created_at, name string, limit int32) ([]*ListNextServices, error)

ListNextServicesByParentCreatedAtNameLimit runs a custom query, returning results as ListNextServices.

type ListServiceAnnotations added in v0.0.2

type ListServiceAnnotations struct {
	ServiceParent string `json:"service_parent"` // service_parent
	ServiceName   string `json:"service_name"`   // service_name
	Key           string `json:"key"`            // key
	Value         string `json:"value"`          // value
}

ListServiceAnnotations represents a row from 'list_service_annotations'.

func ListServiceAnnotationsByParentName added in v0.0.2

func ListServiceAnnotationsByParentName(ctx context.Context, db DB, parent, name string) ([]*ListServiceAnnotations, error)

ListServiceAnnotationsByParentName runs a custom query, returning results as ListServiceAnnotations.

type ListServices

type ListServices struct {
	Parent      string `json:"parent"`      // parent
	Name        string `json:"name"`        // name
	Description string `json:"description"` // description
	UID         string `json:"uid"`         // uid
	URI         string `json:"uri"`         // uri
	Generation  int64  `json:"generation"`  // generation
	CreatedAt   Time   `json:"created_at"`  // created_at
}

ListServices represents a row from 'list_services'.

func ListServicesByParentLimit

func ListServicesByParentLimit(ctx context.Context, db DB, parent string, limit int32) ([]*ListServices, error)

ListServicesByParentLimit runs a custom query, returning results as ListServices.

type Service

type Service struct {
	Parent      string `json:"parent"`      // parent
	Name        string `json:"name"`        // name
	Description string `json:"description"` // description
	UID         string `json:"uid"`         // uid
	Generation  int64  `json:"generation"`  // generation
	URI         string `json:"uri"`         // uri
	CreatedAt   Time   `json:"created_at"`  // created_at
	// contains filtered or unexported fields
}

Service represents a row from 'services'.

func ServiceByParentName

func ServiceByParentName(ctx context.Context, db DB, parent, name string) (*Service, error)

ServiceByParentName retrieves a row from 'services' as a Service.

Generated from index 'sqlite_autoindex_services_1'.

func ServicesByCreatedAt

func ServicesByCreatedAt(ctx context.Context, db DB, createdAt Time) ([]*Service, error)

ServicesByCreatedAt retrieves a row from 'services' as a Service.

Generated from index 'created_at_desc'.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, db DB) error

Delete deletes the Service from the database.

func (*Service) Deleted

func (s *Service) Deleted() bool

Deleted returns true when the Service has been marked for deletion from the database.

func (*Service) Exists

func (s *Service) Exists() bool

Exists returns true when the Service exists in the database.

func (*Service) Insert

func (s *Service) Insert(ctx context.Context, db DB) error

Insert inserts the Service to the database.

func (*Service) Save

func (s *Service) Save(ctx context.Context, db DB) error

Save saves the Service to the database.

func (*Service) Update

func (s *Service) Update(ctx context.Context, db DB) error

Update updates a Service in the database.

func (*Service) Upsert

func (s *Service) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for Service.

type ServiceAnnotation

type ServiceAnnotation struct {
	ServiceParent string `json:"service_parent"` // service_parent
	ServiceName   string `json:"service_name"`   // service_name
	Key           string `json:"key"`            // key
	Value         string `json:"value"`          // value
	// contains filtered or unexported fields
}

ServiceAnnotation represents a row from 'service_annotations'.

func ServiceAnnotationByServiceParentServiceNameKey

func ServiceAnnotationByServiceParentServiceNameKey(ctx context.Context, db DB, serviceParent, serviceName, key string) (*ServiceAnnotation, error)

ServiceAnnotationByServiceParentServiceNameKey retrieves a row from 'service_annotations' as a ServiceAnnotation.

Generated from index 'sqlite_autoindex_service_annotations_1'.

func (*ServiceAnnotation) Delete

func (sa *ServiceAnnotation) Delete(ctx context.Context, db DB) error

Delete deletes the ServiceAnnotation from the database.

func (*ServiceAnnotation) Deleted

func (sa *ServiceAnnotation) Deleted() bool

Deleted returns true when the ServiceAnnotation has been marked for deletion from the database.

func (*ServiceAnnotation) Exists

func (sa *ServiceAnnotation) Exists() bool

Exists returns true when the ServiceAnnotation exists in the database.

func (*ServiceAnnotation) Insert

func (sa *ServiceAnnotation) Insert(ctx context.Context, db DB) error

Insert inserts the ServiceAnnotation to the database.

func (*ServiceAnnotation) Save

func (sa *ServiceAnnotation) Save(ctx context.Context, db DB) error

Save saves the ServiceAnnotation to the database.

func (*ServiceAnnotation) Update

func (sa *ServiceAnnotation) Update(ctx context.Context, db DB) error

Update updates a ServiceAnnotation in the database.

func (*ServiceAnnotation) Upsert

func (sa *ServiceAnnotation) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for ServiceAnnotation.

type ServiceLabel

type ServiceLabel struct {
	ServiceParent string `json:"service_parent"` // service_parent
	ServiceName   string `json:"service_name"`   // service_name
	Key           string `json:"key"`            // key
	Value         string `json:"value"`          // value
	// contains filtered or unexported fields
}

ServiceLabel represents a row from 'service_labels'.

func ServiceLabelByServiceParentServiceNameKey

func ServiceLabelByServiceParentServiceNameKey(ctx context.Context, db DB, serviceParent, serviceName, key string) (*ServiceLabel, error)

ServiceLabelByServiceParentServiceNameKey retrieves a row from 'service_labels' as a ServiceLabel.

Generated from index 'sqlite_autoindex_service_labels_1'.

func (*ServiceLabel) Delete

func (sl *ServiceLabel) Delete(ctx context.Context, db DB) error

Delete deletes the ServiceLabel from the database.

func (*ServiceLabel) Deleted

func (sl *ServiceLabel) Deleted() bool

Deleted returns true when the ServiceLabel has been marked for deletion from the database.

func (*ServiceLabel) Exists

func (sl *ServiceLabel) Exists() bool

Exists returns true when the ServiceLabel exists in the database.

func (*ServiceLabel) Insert

func (sl *ServiceLabel) Insert(ctx context.Context, db DB) error

Insert inserts the ServiceLabel to the database.

func (*ServiceLabel) Save

func (sl *ServiceLabel) Save(ctx context.Context, db DB) error

Save saves the ServiceLabel to the database.

func (*ServiceLabel) Update

func (sl *ServiceLabel) Update(ctx context.Context, db DB) error

Update updates a ServiceLabel in the database.

func (*ServiceLabel) Upsert

func (sl *ServiceLabel) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for ServiceLabel.

type Time

type Time struct {
	// contains filtered or unexported fields
}

Time is a SQLite3 Time that scans for the various timestamps values used by SQLite3 database drivers to store time.Time values.

func NewTime

func NewTime(t time.Time) Time

NewTime creates a time.

func (Time) Format

func (t Time) Format(layout string) string

Format formats the time.

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON satisfies the [json.Marshaler] interface.

func (*Time) Parse

func (t *Time) Parse(s string) error

Parse attempts to Parse string s to t.

func (*Time) Scan

func (t *Time) Scan(v interface{}) error

Scan satisfies the sql.Scanner interface.

func (Time) String

func (t Time) String() string

String satisfies the fmt.Stringer interface.

func (Time) Time

func (t Time) Time() time.Time

Time returns a time.Time.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON satisfies the [json.Unmarshaler] interface.

func (Time) Value

func (t Time) Value() (driver.Value, error)

Value satisfies the sql/driver.Valuer interface.

Jump to

Keyboard shortcuts

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