apptypes

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DTypeInt = iota
	DTypeReal
	DTypeText
	DTypeID
	DTypeEnum
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ComputedTable

type ComputedTable struct {
	Name          string
	Doc           string
	SQLSelectView string
	SQLInit       string
	SQLDeinit     string
	FeedPair      bool
	CacheOnTables []string
	TableSpec     TableSpec
}

type FeedOpResult added in v0.6.0

type FeedOpResult struct {
	Operation string `json:"operation"` // Name of operation (compute/purge/load)
	Success   bool   `json:"success"`   // Whether the operation was successful
	FeedIDs   []int  `json:"feed_ids"`  // Array of feed IDs matched / performed against
}

FeedOpResult represents the result of a Compute, Purge, or Load request exposing whether the operation was successful and the effected feedIDs.

type LoadColumn

type LoadColumn struct {
	Column        string
	DType         uint
	Required      bool
	Check         string
	Enum          []int
	ConversionSQL string
	ConversionFn  func(s string) (any, error)
}

type LoadSchema

type LoadSchema struct {
	TablesGTFS                  []LoadTable
	TableSystemTracking         TableSpec
	TableSystemGTFSSourceMDB    TableSpec
	TableSystemGTFSSourceCustom TableSpec
	ViewsSystem                 []View
}

type LoadTable

type LoadTable struct {
	File      string
	Doc       string
	TableSpec TableSpec
}

type MobsqlRuntime

type MobsqlRuntime struct {
	DB          *sqlx.DB
	Schema      LoadSchema
	SchemaExtra *SchemaExtra // Extra SQL schema configuration (views & computed tables config)
}

type RuntimeConfig

type RuntimeConfig struct {
	MobilityDBCatalogCSVURI string `json:"mdb_csv,omitempty"`   // URI (file:// or http://) of Mobility Database Catalog CSV URI (use load custom GTFS), default Mobility DB bit.ly
	SQLiteDBPath            string `json:"sqlite_db,omitempty"` // Filesystem path for the SQLite DB, if "" uses default of ~/.cache/mobsql/sqlite.db
	LogInfo                 bool   `json:"log_info,omitempty"`  // Whether to enable info messages
	LogWarn                 bool   `json:"log_warn,omitempty"`  // Whether to enable warning messages
	LogDebug                bool   `json:"log_debug,omitempty"` // Whether to enable debug messages

	Logger      *log.Logger  `json:"-"` // Custom *log.Logger to use instead of default stderr logging
	SchemaExtra *SchemaExtra `json:"-"` // Extra SQL schema configuration (views & computed tables config)
}

RuntimeConfig contains the configuration for the Mobsql application passed on each operation.

type SchemaExtra

type SchemaExtra struct {
	InitExec       string          // Arbitrary SQL to execute at initialization (can be used for pragmas etc.)
	TablesComputed []ComputedTable // Computed table specifications to create
	Views          []View          // SQL views to create
}

SchemaExtra represents extra arbitrary SQL views & computed tables that may build upon the feed GTFS tables.

type TableSpec

type TableSpec struct {
	Table     string
	UniqueSet []string
	Columns   []LoadColumn
	Indexes   [][]string
	Optional  bool
}

type View

type View struct {
	Name               string
	SQLCreateStatement string
	Doc                string
}

Jump to

Keyboard shortcuts

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