GithubHelp home page GithubHelp logo

firesharkstudios / butterfly-server Goto Github PK

View Code? Open in Web Editor NEW
274.0 15.0 32.0 21.74 MB

The Everything is Real-Time C# Backend for Single Page Applications

License: Mozilla Public License 2.0

C# 44.03% HTML 19.35% JavaScript 10.97% Vue 18.63% Shell 7.02%
realtime push websocket webapp app server webserver database spa butterfly

butterfly-server's People

Contributors

bgrainger avatar firesharkstudios avatar johan-v-r avatar rosenbjerg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

butterfly-server's Issues

Timeout on UpdateAndCommitAsync()

I'm trying to run the Database example. I use a SqlServer but when i try to do the UpdateAndCommitAsync() an execption throw up.

// This will echo multiple Update data events to the Console because it impacts multiple records in the resultset
// Yes, that's pretty cool :)
Console.WriteLine("Updating user name to 'Mr. Spongebob'");
await database.UpdateAndCommitAsync("users", new
{
        id = spongebobId,
        name = "Mr. Spongebob"
});
await Task.Delay(500);  

This is the stack trace.

at Butterfly.SqlServer.SqlServerDatabase.ExecuteCommandAsync[T](Func`2 query, String executableSql, Dictionary`2 executableParams) in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.SqlServer\SqlServerDatabase.cs:line 268
 at Butterfly.SqlServer.SqlServerDatabase.DoSelectRowsAsync(String executableSql, Dictionary`2 executableParams, Int32 limit) in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.SqlServer\SqlServerDatabase.cs:line 73
 at Butterfly.Core.Database.Dynamic.DynamicView.GetImpactedRecordsAsync(KeyValueDataEvent keyValueDataEvent) in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\Dynamic\DynamicView.cs:line 252
 at Butterfly.Core.Database.Dynamic.DynamicViewSet.StoreImpactedRecordsInDataEventTransaction(TransactionState transactionState, DataEventTransaction dataEventTransaction) in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\Dynamic\DynamicViewSet.cs:line 115
 at Butterfly.Core.Database.Dynamic.DynamicViewSet.ProcessUncommittedDataEventTransactionAsync(DataEventTransaction dataEventTransaction) in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\Dynamic\DynamicViewSet.cs:line 100
 at Butterfly.Core.Database.BaseDatabase.PostDataEventTransactionAsync(TransactionState transactionState, DataEventTransaction dataEventTransaction) in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\BaseDatabase.cs:line 147
 at Butterfly.Core.Database.BaseTransaction.CommitAsync() in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\BaseTransaction.cs:line 258
 at Butterfly.Core.Database.BaseDatabase.UpdateAndCommitAsync(String updateStatement, Object vars) in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\BaseDatabase.cs:line 257
 at ConsoleApp1.Program.Run(IDatabase database) in c:\users\marcoc\source\repos\ConsoleApp1\ConsoleApp1\Program.cs:line 151

It seems that "ORDER BY" clause ignored by Butterfly.Core.Database.Memory.SelectRowsAsync()

DB Created as:

_database = new Butterfly.Core.Database.Memory.MemoryDatabase();
...
await _database.CreateFromSqlAsync(
                @"CREATE TABLE event_store(
                  Id BIGINT AUTO_INCREMENT,
                  Timestamp DATETIME,
                  TableId CHAR(36),
                  Players TEXT,
                  Memo TEXT,
                  GuessPosition INT,
                  
                  PRIMARY KEY (Id),
                  INDEX byTableId(TableId),
                  INDEX byTableIdAndTimestamp(TableId, Timestamp)
                );"
            );

Simple Dump() method

private void Dump()
        {
            var selectTask = _database.SelectRowsAsync("select Id, Timestamp, TableId, Players, Memo, GuessPosition from event_store order by Id desc");

            foreach (var record in selectTask.Result)
            {
                Log.Info(JsonUtil.Serialize(record));
            }
        }

Example Output:

2019-05-08 09:03:36,383  INFO [9] - {"Id":0,"Timestamp":"2019-05-08 16:03:14","TableId":"fc3897e4-9f40-4300-b9c3-a05f73ae85e1","Players":"[]","Memo":"[]","GuessPosition":0}
2019-05-08 09:03:36,385  INFO [9] - {"Id":1,"Timestamp":"2019-05-08 16:03:29","TableId":"fc3897e4-9f40-4300-b9c3-a05f73ae85e1","Players":"[{\"ScreenName\":\"someblock\",\"SessionId\":\"session-1\"}]","Memo":"[]","GuessPosition":0}
2

Expected to see record with Id 1 first.

How can I add the Butterfly JavaScript libraries to a jQuery site?

Hello,
I'd like to use Butterfly in a new project, where I have to display a report from data stored in a SQLite database. However, the web site will use jQuery with ASP.NET Core MVC, so I'm not sure how to add the Butterfly JavaScript libraries to the jQuery side.

I was able to find samples here in GitHub and on the Internet where they use Angular and npm to do that, but that is not my case.

Is there a way to accomplish this? Thanks for your help on this.

Regards,
Jorge

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.