psequel icon indicating copy to clipboard operation
psequel copied to clipboard

Migrate to go

Open ppvan opened this issue 1 year ago • 1 comments

In the end, I can't deal with fixing endless meson bug and binding C library. This issue list benefits and changes when migrate to Go:

Benefit:

  • Much better ecosystem with a good standard library, no need for csv or json-glib, they are in go std by default
  • Strong library to work with postgresql, native Go binding with SQL types...
  • Better language tooling, dev expriences
  • More reliable complier (I spent countless hours on meson and vala shit)

Challeges

  • Gtk support not strong as Vala (Resource files, translations, icons files, metainfo files, how to embeded app config, blueprint compiler, binding events...)
  • Custom widgets? (psequel custom ListView and friends alot, they may not work)
  • Build flatpak with golang and gtk

Work to do:

  • [ ] Build a simple hello world with gotk4, but with all gtk things (blueprints, metainfo, flatpak)
  • [ ] Bind go function with gtk signal. Implement component communications
  • [ ] Migrate connection view
  • [ ] Migrate schema view
  • [ ] Migrate query view
  • [ ] Consider remove data view
  • [ ] Migrate backup and restore features

ppvan avatar Oct 01 '24 17:10 ppvan

Infomation schema implementation:

type InformationSchema struct {
	metadata.LoggingReader
	pf                  func(int) string
	hasFunctions        bool
	hasSequences        bool
	hasIndexes          bool
	hasConstraints      bool
	hasCheckConstraints bool
	hasTablePrivileges  bool
	hasColumnPrivileges bool
	hasUsagePrivileges  bool
	clauses             map[ClauseName]string
	limit               int
	systemSchemas       []string
	currentSchema       string
	dataTypeFormatter   func(metadata.Column) string
}
type Column struct {
	Catalog         string
	Schema          string
	Table           string
	Name            string
	OrdinalPosition int
	DataType        string
	// ScanType        reflect.Type
	Default         string
	ColumnSize      int
	DecimalDigits   int
	NumPrecRadix    int
	CharOctetLength int
	IsNullable      Bool
}
type Table struct {
	Catalog string
	Schema  string
	Name    string
	Type    string
	Rows    int64
	Size    string
	Comment string
}


type Constraint struct {
	Catalog string
	Schema  string
	Table   string
	Name    string
	Type    string

	IsDeferrable        Bool
	IsInitiallyDeferred Bool

	ForeignCatalog string
	ForeignSchema  string
	ForeignTable   string
	ForeignName    string
	MatchType      string
	UpdateRule     string
	DeleteRule     string

	CheckClause string
}

ppvan avatar Oct 02 '24 10:10 ppvan

I'm lazy...

ppvan avatar Oct 16 '24 02:10 ppvan