examples

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: MIT Imports: 5 Imported by: 0

README

Example

This folder contains examples of implementation of the package.

Environment Variables

The database credentials will be read from the following environment variables:

  • DB_USER: database user
  • DB_PASSWORD: database password
  • DB_HOSTNAME: database hostname
  • DB_PORT: database port
  • DB_SCHEMA: database schema

Running the examples

DB_USER=<user> DB_HOSTNAME=<host> DB_PORT=<port> DB_SCHEMA=<schema> DB_PASSWORD=<pwd> go run ./examples/gin

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RentEventResource = resource.Resource{
	Name:       "rent_events",
	PrimaryKey: "uuid",
	Fields: map[string]resource.Field{
		"uuid":          {Validator: "uuid4"},
		"user_id":       {Validator: "uuid4"},
		"vehicle_id":    {Validator: "uuid4"},
		"starting_time": {},
		"hours":         {},
		"checkin_time":  {},
		"dropoff_time":  {},
		"cancel_time":   {},
		"created_at":    {},
		"deleted_at":    {},
		"updated_at":    {},
	},
	SoftDeleteField: null.NewString("deleted_at", true),
	CreatedAtField:  null.NewString("created_at", true),
	UpdatedAtField:  null.NewString("updated_at", true),
}
View Source
var UserResource = resource.Resource{
	Name:       "users",
	PrimaryKey: "uuid",
	Fields: map[string]resource.Field{
		"uuid":        {Validator: "uuid4"},
		"first_name":  {},
		"last_name":   {},
		"phone":       {},
		"credit_card": {Unsearchable: true},
		"created_at":  {},
		"deleted_at":  {},
		"updated_at":  {},
	},
	SoftDeleteField: null.NewString("deleted_at", true),
	CreatedAtField:  null.NewString("created_at", true),
	UpdatedAtField:  null.NewString("updated_at", true),
}
View Source
var VehicleResource = resource.Resource{
	Name:       "vehicles",
	PrimaryKey: "uuid",
	Fields: map[string]resource.Field{
		"uuid":           {Validator: "uuid4"},
		"license_plate":  {},
		"state":          {},
		"archived":       {},
		"year":           {},
		"price_per_hour": {},
		"lot":            {},
		"created_at":     {},
		"deleted_at":     {},
		"updated_at":     {},
	},
	SoftDeleteField: null.NewString("deleted_at", true),
	CreatedAtField:  null.NewString("created_at", true),
	UpdatedAtField:  null.NewString("updated_at", true),
}

Functions

func LoggingHandler added in v1.2.1

func LoggingHandler(h http.Handler) http.Handler

func LoggingHandlerFunc added in v1.2.1

func LoggingHandlerFunc(h http.Handler) http.HandlerFunc

func NewLoggingResponseWriter added in v1.2.1

func NewLoggingResponseWriter(w http.ResponseWriter) loggingResponseWriter

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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