profile
viewpoint
Asdine El Hrychy asdine @sourcegraph Dubai

asdine/storm 1587

Simple and powerful toolkit for BoltDB

genjidb/genji 439

Document-oriented, embedded SQL database, works with Bolt, Badger and memory

asdine/madame 18

RESTful API for MongoDB built on Flask

asdine/lobby 16

Pluggable platform for data delivery

asdine/permission 15

Manage OAuth scopes easily

asdine/atomfiles 5

My personal Atom configuration

genjidb/genji.js 3

Experimental asynchronous Javascript bindings for the Genji database

asdine/brazier 2

JSON storage with command line, HTTP and gRPC support

asdine/structs 1

Utilities for Go structs

startedliljencrantz/crush

started time in 6 hours

PR opened genjidb/genji

Remove convert methods

This PR removes the document.Convert* methods and replaces them by calls to Cast methods. It also removes the plan.go file which is useless since it was replaced by the planner package.

+144 -1343

0 comment

22 changed files

pr created time in a day

create barnchgenjidb/genji

branch : remove-convert-methods

created branch time in a day

delete branch genjidb/genji

delete branch : lazy-value-copy

delete time in a day

push eventgenjidb/genji

Asdine El Hrychy

commit sha 3b73a2e29677e02902c273fff3a7f73d9d7faa03

Add lazilyLoadedDocument

view details

Asdine El Hrychy

commit sha 9511811bf3b84b1fad0a519a19e4e6df4151e5c8

Reuse documentMask

view details

push time in a day

PR merged genjidb/genji

Read values from store lazily

This change adds a few optimizations on how memory is handled during iteration. It removes some unnecessary memory allocations by reusing struct values and buffers between each iteration. It also lazily calls ValueCopy so that it's only called when we want to actually read the document. This is useful for queries that don't necessarily need to read some documents (i.e. SELECT COUNT(*))

+56 -19

0 comment

2 changed files

asdine

pr closed time in a day

Pull request review commentsourcegraph/sourcegraph

external_services: use SQL to get distinct kinds

 func (e *ExternalServicesStore) List(ctx context.Context, opt ExternalServicesLi 	return e.list(ctx, opt.sqlConditions(), opt.LimitOffset) } +// DistinctKinds returns the distinct list of external services kinds that are stored in the database.+func (e *ExternalServicesStore) DistinctKinds(ctx context.Context) ([]string, error) {+	q := sqlf.Sprintf(`+SELECT ARRAY_AGG(DISTINCT(kind)::TEXT)+FROM external_services+WHERE deleted_at IS NULL+`)++	rows, err := dbconn.Global.QueryContext(ctx, q.Query(sqlf.PostgresBindVar), q.Args()...)

Perhaps QueryRowContext would be more appropriate here?

unknwon

comment created time in a day

create barnchsourcegraph/sourcegraph

branch : add_external_services_repos_table

created branch time in 2 days

issue commentsourcegraph/sourcegraph

Race condition having to do with search and SQL

It seems like a good opportunity to switch to pgx 👍

ijt

comment created time in 2 days

issue openedsourcegraph/sourcegraph

New external_service_repos table

Create the external_service_repos table and migrate external_service sources column data to that table. Update stores to read sources data from that new table.

created time in 3 days

push eventsourcegraph/sourcegraph

Asdine El Hrychy

commit sha 6e93c837289ea1d4a51524dec2bfa5af888d985c

Remove cloneInProgress option from the Repositories API (#12560)

view details

push time in 4 days

delete branch sourcegraph/sourcegraph

delete branch : cloud/remove-clone-in-progress-option

delete time in 4 days

issue closedsourcegraph/sourcegraph

Remove cloneInProgress option from Repositories API

The cloneInProgress option has been deprecated in 3.18 (#12043) and must be removed in 3.19. The clone-in-progress flag has been removed from the src-cli https://github.com/sourcegraph/src-cli/pull/246

closed time in 4 days

asdine

PR merged sourcegraph/sourcegraph

Reviewers
Remove cloneInProgress option from the Repositories API

This removes the cloneInProgress option from the site-admin repositories status page. That option has been deprecated on 3.18 and must be removed from 3.19.

Fixes #12090

+26 -38

1 comment

7 changed files

asdine

pr closed time in 4 days

push eventsourcegraph/sourcegraph

davejrt

commit sha 9d471d099db2b99d500957bb67ac5fa70c1ce623

don't enforce bash 5 on linux (#12592) * Change to bash 4. Update error for Darwin and Linux

view details

Keegan Carruthers-Smith

commit sha 7534968805dd883738c2c0b8a17d3a08875b1c1a

tracer: remove support for lightstep (#12654) This was deprecated in 3.15. Note that this is for sending tracing to lightstep and is unrelated to our Sourcegraph Extension which annotates lightstep tracing code.

view details

Keegan Carruthers-Smith

commit sha e842fbd75b978ada23a3d4a42904e17a95c9a02b

tracer: minor changes to initialization (#12655) - tracer: remove racey call to SetGlobalTracer - tracer: remove unneeded mutex around jaegerEnabled - tracer: just pass serviceName to initTracer - tracer: factor out jaeger opts into struct - tracer: factor out creation of tracer

view details

Keegan Carruthers-Smith

commit sha e1fc002ca73135cf2b7c00e7dc8fd295208e700f

tracer: set URL to trace in x-trace header (#12656) This is what we did for lightstep and it is quite convenient. We couldn't do this when we originally added Jaeger since we didn't proxy it. However, now that we do we can provide a direct link.

view details

Asdine El Hrychy

commit sha f4446e0330b86c628d49c192ee361210dd8733da

Merge branch 'master' into cloud/remove-clone-in-progress-option

view details

push time in 4 days

push eventsourcegraph/sourcegraph

Felix Becker

commit sha fa4ea5469043872715574aafaf107baef7e1ebe9

Badge design (#12390)

view details

Felix Becker

commit sha 3cac2fd7a4ddebda6585cb0e6bda0c55a10c28f4

Adopt graphql-code-generator (#12559) Co-authored-by: Simon <twop.sk@gmail.com>

view details

Adam Harvey

commit sha 0a74343cb22d08981ecdacab05f3faf4d77b659b

doc: make webhook configuration consistent (#12529)

view details

TJ Kandala

commit sha 4ffdde482aa64d112dcf5f582f0e2f1b6201db7b

Fix browser extension broken links when branch is specified (#12511) Fix #11057. The Sourcegraph browser extension link used to break on the root directory of a repo when a branch was specified. This happened because we would throw an error when the path structure wasn't exactly: <empty>/<user>/<repo>/(blob | tree)/<commitID>/<path/to/file> The href for the a.js-permalink-shortcut element on the root directory looks like this: "/sourcegraph/sourcegraph/tree/cff20a845c2263deacdcbf18e3b50e2b3c4af94c" (no path). I added a check for page type in getFilePath() in order to allow tree pages to have an empty path. This resulted in a complication in resolveFileInfo() because it prepended all paths with a slash, so I made an exception for falsy strings.

view details

Erik Seliger

commit sha a8a890b684f33696c01644a3873a3192444b4944

Fix filtering by external state and nil panic when state is given in args (#12568)

view details

Robert Lin

commit sha 67cd6a56b98de6b46c965df15f868bad1e7de27e

monitoring: let opsgenie apiurl be optional (#12571)

view details

Erik Seliger

commit sha 004bb0b48d89476a2116dd74ea919733dcc798c2

Fix URL for open on sourcegraph button (#12570)

view details

Robert Lin

commit sha a306f4124906b1103fdb262cdde2e25935813891

monitoring: link alerts back to grafana service dashboard (#12550) Previously, alerts would only provide links to the alert solutions page. This change adds links to the appropriate service dashboard, and also updates more notifiers to leverage built-in capabilities for adding context instead of crowding the message body with links. Other changes: * add owner to notification body * frontend page load latency may not exist * increase Alertmanager retention from 120h to 168h (7d)

view details

Stefan Hengl

commit sha 202ff3793ba887ad9513f6413d5aef5fb14c01e0

search: add annotation to VisitField (#12558)

view details

Stefan Hengl

commit sha 9ce4152e8384264d1bceb20d8ff3a5df2ec78c9d

search: fix count for queries with trailing spaces (#12579)

view details

renovate[bot]

commit sha e92279d4d0b0a8545e3f9b2db083aefce7e3b4e0

Update dependency rxjs to ^6.6.2 (#12582) Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Felix Becker <felix.b@outlook.com>

view details

Erik Seliger

commit sha c5836e3cff6281998444022c2710937152929d3d

Migrate campaigns components to use the new graphql types (#12562)

view details

Eric Fritz

commit sha a048f74c22466207b94d9ceffe49ec701763c5ab

codeintel: Add commit updater utility (#12411)

view details

TJ Kandala

commit sha 3d440e190aefe80c586355043377c0ec77838f9c

Update principles.md (#12578) Replacing a dead link and slightly tweaking the description because "hello world" doesn't print hello world now.

view details

Stefan Hengl

commit sha 7acc13fc86efa5011c25b138902d230e1228d0b5

search: return basic alert for overRepoLimt if globbing is active (#12583)

view details

Eric Fritz

commit sha 3cd7ca975ba0c467fbbd2c0a8ea2603489c2d422

codeintel: Update store to target new nearest upload tables (#12422)

view details

Eric Fritz

commit sha a4006b8c927dea4c2072dd007bab833e778a45aa

codeintel: Remove unused store, gitserver code (#12425)

view details

Eric Fritz

commit sha 5f278c6ce9901f460a766cef7fa9d57aabbad10a

Add index on repo name column (#12591)

view details

Eric Fritz

commit sha 68afed3a2812a197096720c80df928eba0ea0703

Remove committed binary (#12594)

view details

Stephen Gutekanst

commit sha d1a1db31d4f6c2d23ecbeced9da5818d82eacf90

Fix Docker Compose setup instructions (public cloning) (#12595)

view details

push time in 4 days

push eventsourcegraph/sourcegraph

Asdine El Hrychy

commit sha daa575dbba51c5ef71bfe66871b192ac63bae937

Update CHANGELOG.md Co-authored-by: ᴜɴᴋɴᴡᴏɴ <joe@sourcegraph.com>

view details

push time in 4 days

issue commentsourcegraph/sourcegraph

Cloud: 3.19 Tracking issue

Last Week

I worked with @ryanslade on RFC 211.

This week

With @ryanslade and @unknwon , we'll prepare tasks based on the RFC and start working on them.

tsenart

comment created time in 4 days

push eventsourcegraph/sourcegraph

Asdine El Hrychy

commit sha 3da38c5b2295be2d904ceea05e38213bd3c17b37

Add CHANGELOG entry

view details

push time in 4 days

PR opened genjidb/genji

Read values from store lazily

This change adds a few optimizations on how memory is handled during iteration. It removes some unnecessary memory allocations by reusing struct values and buffers between each iteration. It also lazily calls ValueCopy so that it's only called when we want to actually read the document. This is useful for queries that don't necessarily need to read some documents (i.e. SELECT COUNT(*))

+56 -19

0 comment

2 changed files

pr created time in 5 days

create barnchgenjidb/genji

branch : lazy-value-copy

created branch time in 5 days

delete branch sourcegraph/sourcegraph

delete branch : search/resolveRespositoriesSplit

delete time in 8 days

pull request commentsourcegraph/sourcegraph

Split resolveRepositories code

I'm closing this PR as it has become too desynchronised from master and it's painful to rebase. I'm open to any suggestion on a potential improvement of this function

asdine

comment created time in 8 days

PR closed sourcegraph/sourcegraph

Split resolveRepositories code debt estimate/1d team/cloud

With the addition of version contexts, the resolveRepositories function became bloated and hard to read. This PR tries to simplify it by splitting it into multiple functions, but since all of these functions require and modify the same variables, I instead created a type containing all of the shared state and created methods. Let me know if you have ideas for improvement or even other design ideas.

+329 -207

13 comments

3 changed files

asdine

pr closed time in 8 days

PR opened sourcegraph/sourcegraph

Reviewers
Remove cloneInProgress option from the Repositories API

This removes the cloneInProgress option from the site-admin repositories status page. That option has been deprecated on 3.18 and must be removed from 3.19.

Fixes #12090

+25 -39

0 comment

7 changed files

pr created time in 8 days

create barnchsourcegraph/sourcegraph

branch : cloud/remove-clone-in-progress-option

created branch time in 8 days

Pull request review commentgenjidb/genji

Allow dot notation for update set.

 func (fb FieldBuffer) GetByField(field string) (Value, error) { 	return Value{}, ErrFieldNotFound } +// setFieldValue replaces a field if it already exists or creates one if not.+func (fb *FieldBuffer) setFieldValue(field string, reqValue Value) error {+	_, err := fb.GetByField(field)+	switch err {+	case ErrFieldNotFound:+		fb.Add(field, reqValue)+		return nil+	case nil:+		_ = fb.Replace(field, reqValue)+		return nil+	}++	return err+}++// setValueAtPath deep replaces or creates a field+// through the value path to get the value and create or replace it.+func (fb *FieldBuffer) setValueAtPath(v Value, p ValuePath, newValue Value) (Value, error) {++	switch v.Type {+	case DocumentValue:+		var buf FieldBuffer+		err := buf.Copy(v.V.(Document))

On line 174, we are already copying the entire Document, I don't think we need to do it here right? I think replacing l174 and this line by buf.ScanDocument instead will be more efficient as it won't decode values that are untouched

tzzed

comment created time in 9 days

delete branch genjidb/genji

delete branch : load-table-info

delete time in 9 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha 8456a969f111d4c3612e00f9e18926c9e2b1e131

Cache table info in memory

view details

Asdine El Hrychy

commit sha 940276333818f4892b9012f55f0c8e6ed16686c5

Test tableInfoStore

view details

Asdine El Hrychy

commit sha 533916e700c4d7aee4f153b84fff6b779c04081e

Apply suggestions from code review Co-authored-by: Yassine Ennebati <4570448+yaziine@users.noreply.github.com>

view details

push time in 9 days

PR merged genjidb/genji

Store table information in memory

This PR makes tableInfoStore keep table information in memory. Table information is loaded at database startup and kept up to date every time a table is created, altered or dropped. This change allows us to have access to table information without the need for a transaction, which is handy if we need to use this during parsing time.

It also fixes a bug where duplicate generated store id was overwritten.

+158 -104

0 comment

7 changed files

asdine

pr closed time in 9 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha 9bccef5192f2dc16aa967ab3cf88d44423e7dc1b

Apply suggestions from code review Co-authored-by: Yassine Ennebati <4570448+yaziine@users.noreply.github.com>

view details

push time in 9 days

create barnchasdine/find-me-again

branch : master

created branch time in 10 days

created repositoryasdine/find-me-again

created time in 10 days

create barnchasdine/find-me

branch : master

created branch time in 10 days

created repositoryasdine/find-me

created time in 10 days

Pull request review commentgenjidb/genji

Allow dot notation for update set.

 func (fb FieldBuffer) GetByField(field string) (Value, error) { 	return Value{}, ErrFieldNotFound } +// SetFieldValue replaces a field if it already exists or creates one if not.+func (fb *FieldBuffer) SetFieldValue(field string, reqValue Value) error {

I don't think it's worth it to export this method. Also, this only basically does an if and an else, I don't think it deserves being a function.

tzzed

comment created time in 11 days

Pull request review commentgenjidb/genji

Allow dot notation for update set.

 func (fb FieldBuffer) GetByField(field string) (Value, error) { 	return Value{}, ErrFieldNotFound } +// SetFieldValue replaces a field if it already exists or creates one if not.+func (fb *FieldBuffer) SetFieldValue(field string, reqValue Value) error {+	_, err := fb.GetByField(field)+	switch err {+	case ErrFieldNotFound:+		fb.Add(field, reqValue)+		return nil+	case nil:+		_ = fb.Replace(field, reqValue)+		return nil+	}++	return err+}++// SetValueFromValue deep replaces or creates a field+// through the value path to get the value to set or replace.+func (fb *FieldBuffer) SetValueFromValue(v Value, p ValuePath, newValue Value) (Value, error) {

Whenever a method starts with an uppercase letter, it means that it's exported and can be used by someone else's package. It is really important to choose carefully what we want to expose. For example here, based on the explanation, what is the difference between this method and Set? As a user of this package, I only need to be able to set a value at a given path, and Set seems like the right choice for that, why would I need to use SetValueFromValue?

This method should:

  • be unexported: this logic is internal to this package and shouldn't be exposed.
  • be named correctly: what exactly are you trying to do with it? Something like setValueAtPath that would be better
tzzed

comment created time in 11 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha 3741930953353aa4f2e3fa54f264200349d7b326

Apply suggestions from code review Co-authored-by: Yassine Ennebati <4570448+yaziine@users.noreply.github.com>

view details

tzzed

commit sha 70d12b50394ea63b8828816ffeb3f4261ad39424

Refactor Index struct by Replacing fields by Opts IndexConfig struct.

view details

push time in 11 days

PR merged genjidb/genji

Command .indexes displaying indexes of database or a table.

This PR fixes #100. Two options for the command .Indexes and .Indexes <table name> are implemented. Tests .tables and .indexes are added.

genji> .indexes
main skill index on users(skills.0)
idx_nen on users(nen)
genji>

Refactoring of struct Index. Let me know what you think about it

+179 -32

0 comment

8 changed files

tzzed

pr closed time in 11 days

issue closedgenjidb/genji

Add .indexes command

List all indexes:

genji> .indexes

List indexes of a specific table:

genji> .indexes user

closed time in 11 days

yaziine

push eventtzzed/genji

tzzed

commit sha 83a3f0944abd11ce4d12c72653679e7e07aaa45d

Refactor Index struct by Replacing fields by Opts IndexConfig struct.

view details

push time in 11 days

push eventtzzed/genji

Asdine El Hrychy

commit sha e5081167ae65ce4dcde37e2cabc259011c5a5a49

Add memoryengine

view details

Asdine El Hrychy

commit sha 8933f4a10685c2b07184e3c70bd04651952c01cb

Add badgerengine module

view details

Asdine El Hrychy

commit sha 79f36a020cfa702c7dc659b328f5655645b16e16

Use badgerengine module

view details

Asdine El Hrychy

commit sha 7bbbeee4df149cac0c622d227130978ef3a65646

Run go mod tidy

view details

Asdine El Hrychy

commit sha 15c1b4b1655b65ded0c6e9268dba54ff50cea27d

Remove bytesutil package

view details

Asdine El Hrychy

commit sha 65852b933cd92d655e30eeaa47ab21100d2cf337

Apply suggestions from code review Co-authored-by: Yassine Ennebati <4570448+yaziine@users.noreply.github.com>

view details

tzzed

commit sha ab6f05a20cf7fbc7e9ed21ccd25cf0d5af55264e

Refactor Index struct by Replacing fields by Opts IndexConfig struct.

view details

tzzed

commit sha 5bb649229fb160e66a4bee939a0a313c9724cd0f

Refactor Index struct by Replacing fields by Opts IndexConfig struct.

view details

push time in 11 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha e5081167ae65ce4dcde37e2cabc259011c5a5a49

Add memoryengine

view details

Asdine El Hrychy

commit sha 8933f4a10685c2b07184e3c70bd04651952c01cb

Add badgerengine module

view details

Asdine El Hrychy

commit sha 79f36a020cfa702c7dc659b328f5655645b16e16

Use badgerengine module

view details

Asdine El Hrychy

commit sha 7bbbeee4df149cac0c622d227130978ef3a65646

Run go mod tidy

view details

Asdine El Hrychy

commit sha 15c1b4b1655b65ded0c6e9268dba54ff50cea27d

Remove bytesutil package

view details

Asdine El Hrychy

commit sha 738fee9bfca323241be9a106f19e34067b735c9c

Cache table info in memory

view details

Asdine El Hrychy

commit sha c001a6fb2b7470a9ea0972023fc974bf76126a6f

Test tableInfoStore

view details

push time in 11 days

delete branch genjidb/genji

delete branch : remove-bytesutil

delete time in 11 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha 15c1b4b1655b65ded0c6e9268dba54ff50cea27d

Remove bytesutil package

view details

push time in 11 days

PR merged genjidb/genji

Remove bytesutil package

This PR removes the bytesutil package. It was necessary because of an issue in Tinygo (https://github.com/tinygo-org/tinygo/issues/1034) that was fixed since then.

+20 -213

0 comment

11 changed files

asdine

pr closed time in 11 days

delete branch genjidb/genji

delete branch : badger-submodule

delete time in 11 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha e5081167ae65ce4dcde37e2cabc259011c5a5a49

Add memoryengine

view details

Asdine El Hrychy

commit sha 8933f4a10685c2b07184e3c70bd04651952c01cb

Add badgerengine module

view details

Asdine El Hrychy

commit sha 79f36a020cfa702c7dc659b328f5655645b16e16

Use badgerengine module

view details

Asdine El Hrychy

commit sha 7bbbeee4df149cac0c622d227130978ef3a65646

Run go mod tidy

view details

Asdine El Hrychy

commit sha 1d0881d125568a0a213ca31af8f2bc27f2c74988

Remove bytesutil package

view details

push time in 11 days

PR merged genjidb/genji

Make badgerengine a submodule

This PR makes the badgerengine a submodule rather than being embedded in the main package. This is done to limit the number of dependencies and improve compile time.

+112 -52

0 comment

6 changed files

asdine

pr closed time in 11 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha 8933f4a10685c2b07184e3c70bd04651952c01cb

Add badgerengine module

view details

Asdine El Hrychy

commit sha 79f36a020cfa702c7dc659b328f5655645b16e16

Use badgerengine module

view details

Asdine El Hrychy

commit sha 7bbbeee4df149cac0c622d227130978ef3a65646

Run go mod tidy

view details

push time in 11 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha e5081167ae65ce4dcde37e2cabc259011c5a5a49

Add memoryengine

view details

Asdine El Hrychy

commit sha 99cd3ee3f3d36888a0ca83367998b36659e61861

Add badgerengine module

view details

Asdine El Hrychy

commit sha b8b72f03827050befccc21e0fd1e55f2f1a39638

Use badgerengine module

view details

Asdine El Hrychy

commit sha 1e5b92e5bef94e536f833f43614c2c22c880c1a0

Run go mod tidy

view details

push time in 11 days

delete branch genjidb/genji

delete branch : new-memoryengine

delete time in 11 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha e5081167ae65ce4dcde37e2cabc259011c5a5a49

Add memoryengine

view details

push time in 11 days

PR merged genjidb/genji

New memoryengine

This PR brings back the original memory engine to replace Badger as the main memory engine. This engine uses an in memory Btree and a sync.RWMutex to manage concurrency and transactions.

It is still possible to use Badger as a memory engine, it just needs to be done manually through the badgerengine.

+467 -21

0 comment

10 changed files

asdine

pr closed time in 11 days

issue commentsourcegraph/sourcegraph

Cloud: 3.19 Tracking issue

Last Week

Worked with @ryanslade and @unknwon on the product document. I analysed the code for external services usage and potential scaling issues. Worked on removing clone in progress option from the Repositories GraphQL API.

This week

With @ryanslade, we'll pair on preparing an RFC for allowing users to create external services for public code.

tsenart

comment created time in 11 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha 7edf0ffabe516e9c16957128817aacc1ae186acc

Test tableInfoStore

view details

push time in 12 days

PR opened genjidb/genji

Store table information in memory

This PR makes tableInfoStore keep table information in memory. Table information is loaded at database startup and kept up to date every time a table is created, altered or dropped. This change allows us to have access to table information without the need for a transaction, which is handy if we need to use this during parsing time.

+157 -103

0 comment

7 changed files

pr created time in 13 days

create barnchgenjidb/genji

branch : load-table-info

created branch time in 13 days

Pull request review commentgenjidb/genji

Command .indexes displaying indexes of database or a table.

 func (stmt InsertStmt) insertDocuments(t *database.Table, stack expr.EvalStack) 	var res Result  	for _, e := range stmt.Values {+		fmt.Println("values row:\n", e)

You forgot to remove this debug line 😉

tzzed

comment created time in 15 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha bc04637adbaf5bd078b41836f20ee5a250795e9c

Add memoryengine

view details

Asdine El Hrychy

commit sha a434151f4bf11171425d2869cb808fca67c4c47d

Add badgerengine module

view details

Asdine El Hrychy

commit sha 35d6f620789ae4080c807c5440932180b59c9276

Use badgerengine module

view details

Asdine El Hrychy

commit sha bc21d8f34f13199c1afcf580d67098d30eb44734

Run go mod tidy

view details

Asdine El Hrychy

commit sha 187a51e179140d3bd7695b2d411638dd2ce8e023

Remove bytesutil package

view details

push time in 15 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha bc04637adbaf5bd078b41836f20ee5a250795e9c

Add memoryengine

view details

Asdine El Hrychy

commit sha a434151f4bf11171425d2869cb808fca67c4c47d

Add badgerengine module

view details

Asdine El Hrychy

commit sha 35d6f620789ae4080c807c5440932180b59c9276

Use badgerengine module

view details

Asdine El Hrychy

commit sha bc21d8f34f13199c1afcf580d67098d30eb44734

Run go mod tidy

view details

push time in 15 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha bc04637adbaf5bd078b41836f20ee5a250795e9c

Add memoryengine

view details

push time in 15 days

PR opened genjidb/genji

Remove bytesutil package

This PR removes the bytesutil package. It was necessary because of an issue in Tinygo (https://github.com/tinygo-org/tinygo/issues/1034) that was fixed since then.

+20 -213

0 comment

11 changed files

pr created time in 16 days

create barnchgenjidb/genji

branch : remove-bytesutil

created branch time in 16 days

PR opened genjidb/genji

Make badgerengine a submodule

This PR makes the badgerengine a submodule rather than being embedded in the main package. This is done to limit the number of dependencies and improve compile time.

+112 -52

0 comment

6 changed files

pr created time in 16 days

create barnchgenjidb/genji

branch : badger-submodule

created branch time in 16 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha 5d148dd4201bba68de65425bc0fef9bb266123dc

Add CastAs methods

view details

Asdine El Hrychy

commit sha 595b04a9f7e1523b50681eb41459d683cf6358cc

Rename ConvertTo as CastAs

view details

Asdine El Hrychy

commit sha 44c3724309212a08b19182284a2e400ffc3c48c5

Add Cast tests

view details

Asdine El Hrychy

commit sha ec379b34a36ab7539d5c3fa8f493ec4d4e100655

Fix test

view details

Asdine El Hrychy

commit sha e1447b886a083f4c587919e96f3cc830d29a1135

Fix typo

view details

Asdine El Hrychy

commit sha e0613234c37b11b6126d3671b28ac4600903e0b7

Apply suggestions from code review Co-authored-by: Yassine Ennebati <4570448+yaziine@users.noreply.github.com>

view details

Asdine El Hrychy

commit sha e6f41168bf1e055a1f1953fb4647c4a536373077

Add memoryengine

view details

push time in 16 days

delete branch genjidb/genji

delete branch : fix/cast-function

delete time in 16 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha 5d148dd4201bba68de65425bc0fef9bb266123dc

Add CastAs methods

view details

Asdine El Hrychy

commit sha 595b04a9f7e1523b50681eb41459d683cf6358cc

Rename ConvertTo as CastAs

view details

Asdine El Hrychy

commit sha 44c3724309212a08b19182284a2e400ffc3c48c5

Add Cast tests

view details

Asdine El Hrychy

commit sha ec379b34a36ab7539d5c3fa8f493ec4d4e100655

Fix test

view details

Asdine El Hrychy

commit sha e1447b886a083f4c587919e96f3cc830d29a1135

Fix typo

view details

Asdine El Hrychy

commit sha e0613234c37b11b6126d3671b28ac4600903e0b7

Apply suggestions from code review Co-authored-by: Yassine Ennebati <4570448+yaziine@users.noreply.github.com>

view details

push time in 16 days

PR merged genjidb/genji

New implementation of the Cast function

This PR fixes the behavior of the CAST function by adding a new implementation that defines correctly how types are cast.

+404 -33

0 comment

9 changed files

asdine

pr closed time in 16 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha fbfc49a5ff91d8bcace6eedba0cac996c8bf5cb9

Apply suggestions from code review Co-authored-by: Yassine Ennebati <4570448+yaziine@users.noreply.github.com>

view details

push time in 16 days

PR opened genjidb/genji

New memoryengine

This PR brings back the origin memory engine to replace Badger as the main memory engine.

It is still possible to use Badger as a memory engine, it just needs to be done manually through the badgerengine.

+859 -54

0 comment

19 changed files

pr created time in 16 days

create barnchgenjidb/genji

branch : new-memoryengine

created branch time in 16 days

Pull request review commentgenjidb/genji

New implementation of the Cast function

+package document++import (+	"encoding/base64"+	"fmt"+	"strconv"+	"time"+)++// CastAs casts v as the selected type when possible.+func (v Value) CastAs(t ValueType) (Value, error) {+	if v.Type == t {+		return v, nil+	}++	// Null values always remain null.+	if v.Type == NullValue {+		return v, nil+	}++	switch t {+	case BoolValue:+		return v.CastAsBool()+	case IntegerValue:+		return v.CastAsInteger()+	case DoubleValue:+		return v.CastAsDouble()+	case DurationValue:+		return v.CastAsDuration()+	case BlobValue:+		return v.CastAsBlob()+	case TextValue:+		return v.CastAsText()+	case ArrayValue:+		return v.CastAsArray()+	case DocumentValue:+		return v.CastAsDocument()+	}++	return Value{}, fmt.Errorf("cannot cast %q as %q", v.Type, t)+}++// CastAsBool casts according to the following rules:+// Integer: true if truthy, otherwise false.+// Text: uses strconv.Parsebool to determine the boolean value,+// it fails if the text doesn't contain a valid boolean.+// Any other type is considered an invalid cast.+func (v Value) CastAsBool() (Value, error) {+	switch v.Type {+	case BoolValue:+		return v, nil+	case IntegerValue:+		return NewBoolValue(v.V.(int64) != 0), nil+	case TextValue:+		b, err := strconv.ParseBool(string(v.V.([]byte)))+		if err != nil {+			return Value{}, err+		}+		return NewBoolValue(b), nil+	}++	return Value{}, fmt.Errorf("cannot cast %q as bool", v.Type)+}++// CastAsInteger casts according to the following rules:+// Bool: returns 1 if true, 0 if false.+// Double: cuts off the decimal and remaining numbers.+// Text: uses strconv.ParseFloat to determine the double value,+// then casts it to an integer. it fails if the text doesn't+// contain a valid float value.+// Any other type is considered an invalid cast.+func (v Value) CastAsInteger() (Value, error) {+	switch v.Type {+	case IntegerValue:+		return v, nil+	case BoolValue:+		if v.V.(bool) {+			return NewIntegerValue(1), nil+		}+		return NewIntegerValue(0), nil+	case DoubleValue:+		return NewIntegerValue(int64(v.V.(float64))), nil+	case TextValue:+		f, err := strconv.ParseFloat(string(v.V.([]byte)), 64)

It's because we want to allow this:

genji> SELECT CAST('10.5' AS integer);
{
  "CAST('10.5' AS integer)": 10
}

Parsing as int would make this case fail

asdine

comment created time in 16 days

PR merged sourcegraph/sourcegraph

Add missing changelog entry

This adds a changelog entry for #12243

+1 -0

0 comment

1 changed file

asdine

pr closed time in 16 days

push eventsourcegraph/sourcegraph

Asdine El Hrychy

commit sha 69c4e4ee0faae6f75774ac53e2ec709452c3901f

Add missing changelog entry (#12359)

view details

push time in 16 days

delete branch sourcegraph/sourcegraph

delete branch : cloud/add-changelog-entry

delete time in 16 days

push eventgenjidb/genji

dependabot[bot]

commit sha c1cdafc5ba79507b6443c8c684ab49d99677cfd6

Bump lodash from 4.17.15 to 4.17.19 in /docs Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] <support@github.com>

view details

Asdine El Hrychy

commit sha 454cc983db979394c310a5a5df0e1180fb0f1447

Simplify type system

view details

Asdine El Hrychy

commit sha 6203af7dc99e440682c255ec66a42306b22c41df

Update documentation theme

view details

Asdine El Hrychy

commit sha 347e3c7f0333152ec17598d017b0130f04024c1c

Add parentheses expression

view details

Asdine El Hrychy

commit sha 3cfb8e9cf2caf76c50f2cae6cf7a8b9763a8ab24

Update tests

view details

Asdine El Hrychy

commit sha 9d9a9051bfebf7b3daedf64e7b5482f68b5c9009

Improve docstring

view details

Asdine El Hrychy

commit sha 672025a4bb36d74a5af1544439669cfe8e45fc8f

Fix InsertStmt tests

view details

Asdine El Hrychy

commit sha 075e204026fa61c04af3f19333af58695799e655

Remove ViewTable and UpdateTable methods

view details

Asdine El Hrychy

commit sha 58b895b1c25c5eaaf1fb51b674900136ec6087e5

Rename ConvertToText and ConvertToBlob to ConvertToString and ConvertToBytes

view details

Asdine El Hrychy

commit sha 4bf6b9aaa6155323f84f23c8ca49aaca24e216f0

Add CastAs methods

view details

Asdine El Hrychy

commit sha af68c5d580896907e21e90a47c373aa5a9b740d9

Rename ConvertTo as CastAs

view details

Asdine El Hrychy

commit sha 8bec846fd5d96ffb19f533a604664f986f4b9aa3

Add Cast tests

view details

Asdine El Hrychy

commit sha bcfa7182d969488149aebbcbcb87268e52b38054

Fix test

view details

Asdine El Hrychy

commit sha f5c6d67eb3d5ec864b2620c8f70629ed46460511

Fix typo

view details

push time in 16 days

delete branch genjidb/genji

delete branch : rename-convert-methods

delete time in 16 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha 58b895b1c25c5eaaf1fb51b674900136ec6087e5

Rename ConvertToText and ConvertToBlob to ConvertToString and ConvertToBytes

view details

push time in 16 days

PR merged genjidb/genji

Rename convert methods

The names ConvertToBlob and ConvertToText don't really make sense because these functions are used to get respectively get a []byte and string out of a value.

+20 -20

0 comment

7 changed files

asdine

pr closed time in 16 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha 6203af7dc99e440682c255ec66a42306b22c41df

Update documentation theme

view details

Asdine El Hrychy

commit sha 347e3c7f0333152ec17598d017b0130f04024c1c

Add parentheses expression

view details

Asdine El Hrychy

commit sha 3cfb8e9cf2caf76c50f2cae6cf7a8b9763a8ab24

Update tests

view details

Asdine El Hrychy

commit sha 9d9a9051bfebf7b3daedf64e7b5482f68b5c9009

Improve docstring

view details

Asdine El Hrychy

commit sha 672025a4bb36d74a5af1544439669cfe8e45fc8f

Fix InsertStmt tests

view details

Asdine El Hrychy

commit sha 075e204026fa61c04af3f19333af58695799e655

Remove ViewTable and UpdateTable methods

view details

Asdine El Hrychy

commit sha f4690faf9b9d7f13bd08bdc8c1b7fe8776a59c05

Rename ConvertToText and ConvertToBlob to ConvertToString and ConvertToBytes

view details

push time in 16 days

delete branch genjidb/genji

delete branch : remove-unnecessary-db-methods

delete time in 16 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha 075e204026fa61c04af3f19333af58695799e655

Remove ViewTable and UpdateTable methods

view details

push time in 16 days

PR merged genjidb/genji

Remove unnecessary db methods

ViewTable and UpdateTable used to be useful when Genji was doing code generation and before the introduction of SQL. They were used to limit the number of lines of generated code. They no longer make sense now as we want to encourage users to use SQL as much as possible. If there is a need to access tables, there is still the View and Update methods. Please let me know if you think otherwise

+14 -31

0 comment

2 changed files

asdine

pr closed time in 16 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha 6203af7dc99e440682c255ec66a42306b22c41df

Update documentation theme

view details

Asdine El Hrychy

commit sha 347e3c7f0333152ec17598d017b0130f04024c1c

Add parentheses expression

view details

Asdine El Hrychy

commit sha 3cfb8e9cf2caf76c50f2cae6cf7a8b9763a8ab24

Update tests

view details

Asdine El Hrychy

commit sha 9d9a9051bfebf7b3daedf64e7b5482f68b5c9009

Improve docstring

view details

Asdine El Hrychy

commit sha 672025a4bb36d74a5af1544439669cfe8e45fc8f

Fix InsertStmt tests

view details

Asdine El Hrychy

commit sha 712ef562eefe5bf30556aea30f5fa7cbfb433692

Remove ViewTable and UpdateTable methods

view details

push time in 16 days

delete branch genjidb/genji

delete branch : fix-parentheses-behavior

delete time in 16 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha 347e3c7f0333152ec17598d017b0130f04024c1c

Add parentheses expression

view details

Asdine El Hrychy

commit sha 3cfb8e9cf2caf76c50f2cae6cf7a8b9763a8ab24

Update tests

view details

Asdine El Hrychy

commit sha 9d9a9051bfebf7b3daedf64e7b5482f68b5c9009

Improve docstring

view details

Asdine El Hrychy

commit sha 672025a4bb36d74a5af1544439669cfe8e45fc8f

Fix InsertStmt tests

view details

push time in 16 days

PR merged genjidb/genji

Fix parentheses behaviour

This PR changes how parentheses were parsed by the parser. Previously, they were considered as lists of expressions, which after evaluation turned into an array. This behaviour prevented us from using parentheses as arithmetic sub expressions.

Before:

genji> select ((10 + 5 + 5) * 4) / 2;
{
  "((10 + 5 + 5) * 4) / 1": null
}
genji> select ((10 + 5 + 5) * 4);
{
  "((10 + 5 + 5) * 4)": [
    null
  ]
}

After:

genji> select ((10 + 5 + 5) * 4) / 2;
{
  "((10 + 5 + 5) * 4) / 1": 40
}
genji> select ((10 + 5 + 5) * 4);
{
  "((10 + 5 + 5) * 4)": 80
}
+44 -16

0 comment

4 changed files

asdine

pr closed time in 16 days

delete branch genjidb/genji

delete branch : update-docsy

delete time in 16 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha 6203af7dc99e440682c255ec66a42306b22c41df

Update documentation theme

view details

push time in 16 days

PR merged genjidb/genji

Update documentation theme

This PR updates the documentation theme submodule

+1 -1

0 comment

1 changed file

asdine

pr closed time in 16 days

push eventgenjidb/genji

dependabot[bot]

commit sha c1cdafc5ba79507b6443c8c684ab49d99677cfd6

Bump lodash from 4.17.15 to 4.17.19 in /docs Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] <support@github.com>

view details

Asdine El Hrychy

commit sha 454cc983db979394c310a5a5df0e1180fb0f1447

Simplify type system

view details

Asdine El Hrychy

commit sha b1b5ba39d2a80a30ccd378ccb1d405a34387f126

Add parentheses expression

view details

Asdine El Hrychy

commit sha 89a5913991067c1ddc84fed470c97f1092cbc0aa

Update tests

view details

Asdine El Hrychy

commit sha dca1f89c8a26201c9b0e21997f228f6098adb754

Improve docstring

view details

Asdine El Hrychy

commit sha b425b13058c2218d348adeb95003cd1c1391c2a2

Fix InsertStmt tests

view details

Asdine El Hrychy

commit sha a56605cef4ebc0e047ee6a4772b1572ad2747591

Remove ViewTable and UpdateTable methods

view details

Asdine El Hrychy

commit sha 97e466db11b129d9df87d3bea510b6895103c3df

Rename ConvertToText and ConvertToBlob to ConvertToString and ConvertToBytes

view details

push time in 16 days

push eventgenjidb/genji

dependabot[bot]

commit sha c1cdafc5ba79507b6443c8c684ab49d99677cfd6

Bump lodash from 4.17.15 to 4.17.19 in /docs Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] <support@github.com>

view details

Asdine El Hrychy

commit sha 454cc983db979394c310a5a5df0e1180fb0f1447

Simplify type system

view details

Asdine El Hrychy

commit sha b1b5ba39d2a80a30ccd378ccb1d405a34387f126

Add parentheses expression

view details

Asdine El Hrychy

commit sha 89a5913991067c1ddc84fed470c97f1092cbc0aa

Update tests

view details

Asdine El Hrychy

commit sha dca1f89c8a26201c9b0e21997f228f6098adb754

Improve docstring

view details

Asdine El Hrychy

commit sha b425b13058c2218d348adeb95003cd1c1391c2a2

Fix InsertStmt tests

view details

Asdine El Hrychy

commit sha a56605cef4ebc0e047ee6a4772b1572ad2747591

Remove ViewTable and UpdateTable methods

view details

push time in 16 days

push eventgenjidb/genji

dependabot[bot]

commit sha c1cdafc5ba79507b6443c8c684ab49d99677cfd6

Bump lodash from 4.17.15 to 4.17.19 in /docs Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] <support@github.com>

view details

Asdine El Hrychy

commit sha 454cc983db979394c310a5a5df0e1180fb0f1447

Simplify type system

view details

Asdine El Hrychy

commit sha b1b5ba39d2a80a30ccd378ccb1d405a34387f126

Add parentheses expression

view details

Asdine El Hrychy

commit sha 89a5913991067c1ddc84fed470c97f1092cbc0aa

Update tests

view details

Asdine El Hrychy

commit sha dca1f89c8a26201c9b0e21997f228f6098adb754

Improve docstring

view details

Asdine El Hrychy

commit sha b425b13058c2218d348adeb95003cd1c1391c2a2

Fix InsertStmt tests

view details

push time in 16 days

Pull request review commentgenjidb/genji

Fix parentheses behaviour

 type Operator interface { 	SetRightHandExpr(Expr) 	Token() scanner.Token }++// Parentheses is a special expression which turns+// any sub-expression as unary.+// It hides the underlying operator, if any, from the parser+// so that it doesn't get reordered by precedence.

In SQL, operators are ordered by precedence, for example, * has higher precedence than +, which means it must be evaluated first:

3 + 4 * 2
# 4 * 2 is evaluated first
3 + 8
# then + is evaluated
11

If you want to avoid that, you can use parentheses

(3 + 4) * 2
# 3 + 4 is evaluated first
7 * 2
# then * is evaluated
14

This behavior is done in the parser, when parsing the expression: https://github.com/genjidb/genji/blob/454cc983db979394c310a5a5df0e1180fb0f1447/sql/parser/expr.go#L30-L78

This function builds a tree based on operator precedence. To avoid an expression in parentheses to have its precedence analyzed and taken into account by that function (these two lines) we "hide" it by wrapping it in a type that doesn't implement the Operator interface so that in the eye of these two lines, that expression is unary, not binary.

asdine

comment created time in 16 days

delete branch genjidb/genji

delete branch : simpler-types

delete time in 16 days

push eventgenjidb/genji

Asdine El Hrychy

commit sha 454cc983db979394c310a5a5df0e1180fb0f1447

Simplify type system

view details

push time in 16 days

PR merged genjidb/genji

Simplifying the type system

This PR simplifies the type system by:

  • removing fixed int*
  • keeping the integer type, whose encoding size depends on the size of value it holds
  • renaming float64 to double to fit SQL standards
  • reassigning new values to document.ValueType enum so that adding new types in the future wouldn't require us to modify them

All of these changes can be seen in the document/value.go file, the rest of the PR is only about removing the use of the old types.

+705 -971

0 comment

41 changed files

asdine

pr closed time in 16 days

more