text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_prefix|>/*
* To change this license header, choose License H<|fim_suffix|>g password);
public abstract void regist(User user);
}
<|fim_middle|>eaders in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cn.itcast.dao;
import c... | fim | DuGuQiuBai/Java | java |
<|fim_suffix|> finally {
if (br != null) {
try {
br.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
return flag;
}
@Override
public void regist(User user) {
... | fim | DuGuQiuBai/Java | java |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cn.itcast.pojo;
/**
*
* @author fqy
*/
public class User {
private String username;
private String password;
... | fim | DuGuQiuBai/Java | java |
<|fim_prefix|>/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cn.itcast.util;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.J... | fim | DuGuQiuBai/Java | java |
<|fim_prefix|>/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cn.itcast.view;
import cn.itcast.util.UiUtil;
import java.io.BufferedWriter;
import java.io.File;
import java.io... | fim | DuGuQiuBai/Java | java |
<|fim_prefix|>/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cn.itcast.view;
import cn.itcast.dao.UserDao;
import cn.itcast.dao.impl.UserDaoImpl;
import cn.itcast.util.UiUti... | fim | DuGuQiuBai/Java | java |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cn.itcast.view;
import cn.itcast.dao.UserDao;
import cn.itcast.dao.impl.UserDaoImpl;
import cn.itcast.pojo.User;
import cn.itc... | fim | DuGuQiuBai/Java | java |
<|fim_prefix|>package com.elient;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.aw<|fim_suffix|>
public class WinCenter {
public static void center(Window win){
Toolkit tkit = Toolkit.getDefaultToolkit();
Dimension sSize = tkit.getScreenSize();
Dimension wSize = win.getSize();
if(wSize.heig... | fim | DuGuQiuBai/Java | java |
<|fim_prefix|>package com.server;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.text.SimpleDateFormat;
import java.util.Date;
public class ClientThread extends Thread {
public Socket clientSocket;
public ServerThread serverThread;
... | fim | DuGuQiuBai/Java | java |
package com.server;
public class Server {
private ServerFrame serverFrame;
private ServerThread serverThread;
public ServerFrame getServerFrame() {
return serverFrame;
}
public void setServerFrame(ServerFrame serverFrame) {
this.serverFrame = serverFrame;
}
public Server(){}
public void startServ... | fim | DuGuQiuBai/Java | java |
<|fim_prefix|>package com.server;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
public class ServerThread extends Thread {
public ServerSocket serverSocket;
public Vector<St... | fim | DuGuQiuBai/Java | java |
<|fim_prefix|>package com.server;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Window;
p<|fim_suffix|>Size = win.getSize();
if(wSize.height > sSize.height){
wSize.height = sSize.height;
}
if(wSize.width > sSize.width){
wSize.width = sSize.width;
}
win.setLocation((sSize.width - ... | fim | DuGuQiuBai/Java | java |
<|fim_prefix|>open System.IO
open Fake.Core
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.Core.TargetOperators
open BuildHelpers
open BuildTools
initializeContext()
let clean proj = [ proj </> "bin"; proj </> "obj" ] |> Shell.cleanDirs
let createNuget proj =
clean proj
Tools.dotne<|fim_suffix|>env... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|> |> Array.Parallel.map Proc.run
let createProcess exe arg dir =
CreateProcess.fromRawCommandLine exe arg
|> CreateProcess.withWorkingDirectory dir
|> CreateProcess.ensureExitCode
let run proc arg dir =
proc arg dir
|> Proc.run
|> ignore
let runParallel processes =
process... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module BuildTools
open Fake.Core
open Fake.DotNet
module Tools =
let private findTool tool winTool =
let tool = if Environment.isUnix then tool else winTool
match ProcessUtils.tryFindFileOnPath tool with
| Some t -> t
| _ ->
let errorMsg =
... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|> splitOn)
let query5Option<'a,'b,'c,'d,'e> (this:IDbConnection) trans timeout cancellationToken (logFunction:LogFn option) (query, pars, splitOn) =
if logFunction.IsSome then (query, pars) |> logFunction.Value
let cmd = CommandDefinition(query, pars, ?transaction = trans, ?commandTimeout = ... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>[<AutoOpen>]
module Dapper.FSharp.MSSQL.Builders
open Dapper.FSharp
open System.Linq.Expressions
open System
open System.Collections.Generic
open LinqExpressionVisitors
[<AutoOpen>]
module FQ =
/// Fully qualified entity type name
type [<Struct>] FQName = private FQName of string
let fqNam... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>namespace Dapper.FSharp.MSSQL
open Dapper.FSharp.MSSQL.Evaluator
[<AbstractClass;Sealed>]
type Deconstructor =
static member select<'a> (q:SelectQuery) = q |> GenericDeconstructor.select1<'a> ev<|fim_suffix|>or.select5<'a,'b,'c,'d,'e> evalSelectQuery
static member insert (q:InsertQuery<'a>) = q... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|> | In of obj list
| NotIn of obj list
| Like of string
| NotLike of string
| IsNull
| IsNotNull
type BinaryOperation =
| And
| Or
type UnaryOperation =
| Not
type Where =
| Empty
| Column of string * ColumnComparison
| Binary of Where * BinaryOperation * Whe... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module internal Dapper.FSharp.MSSQL.Evaluator
open System.Text
let private inBrackets (s:string) =
s.Split('.')
|> Array.map (sprintf "[%s]")
|> String.concat "."
let private safeTableName schema table =
match schema, table with
| None, table -> table |> inBrackets
| Some schem... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module internal Dapper.FSharp.MSSQL.GenericDeconstructor
open Dapper.FSharp
let private extractFieldsAndSplit<'a> (j:Join) =
let table = j |> Join.tableName
let f = typeof<'a> |> Reflection.getFields
let fieldNames = f |> List.map (sprintf "%s.%s" table)
fieldNames, f.Head
let private ... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|> : CancellationToken) =
q |> Deconstructor.select<'a,'b,'c,'d,'e> |> IDbConnection.query5<'a,'b,'c,'d,'e> this trans timeout cancellationToken logFunction
member this.SelectAsyncOption<'a,'b> (q:SelectQuery, ?trans:IDbTransaction, ?timeout:int, ?logFunction, ?cancellationToken : CancellationT... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module internal Dapper.FSharp.MSSQL.JoinAnalyzer
open System.Linq
open Dapper.FSharp
ty<|fim_suffix|>arameterName, x.Key)
|> List.fold (fun (acc:Map<_,_>) item -> acc.Add item) m<|fim_middle|>pe JoinMetadata = {
Key : obj
ParameterName : string
}
let private extractJoins (joins:Join list)... | fim | Dzoukr/Dapper.FSharp | fsharp |
module internal Dapper.FSharp.MSSQL.LinqExpressionVisitors
open System.Linq.Expressions
open System
open System.Reflection
let notImpl() = raise (NotImplementedException())
let notImplMsg msg = raise (NotImplementedException msg)
[<AutoOpen>]
module VisitorPatterns =
let (|Lambda|_|) (exp: Expression) =
... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>[<RequireQualifiedAccess>]
module Dapper.FSharp.MSSQL.OptionTypes
open Dapper
open System
open Dapper.FSharp.OptionTypes
let register() =
SqlMapper.AddTypeHandler (OptionHandler<Guid>())
SqlMapper.AddTypeHandler (OptionHandler<byte>())
SqlMapper.AddTypeHandler (OptionHandler<int16>())
S... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module internal Dapper.FSharp.MSSQL.WhereAnalyzer
open System.Linq
open Dapper.FSharp.Reflection
type FieldWhereMetadata = {
Key : string * ColumnComparison
Name : string
ParameterName : string
}
let extractWhereParams (meta:FieldWhereMetadata list) =
let fn (m:FieldWhereMetadata) =
... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|> QuerySource<'T, InsertQuery<'T>>(newQuery, state.TableMappings)
/// Includes a column in the insert query.
[<CustomOperation("includeColumn", MaintainsVariableSpace = true)>]
member this.IncludeColumn (state: QuerySource<'T>, [<ProjectionParameter>] propertySelector) =
this.Inc... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>[<AutoOpen>]
module Dapper.FSharp.MySQL.Deconstructor
open Dapper.FSharp.MySQL.Evaluator
[<AbstractClass;Sealed>]
type Deconstructor =
static member select<'a> (q:SelectQuery) = q |> GenericDeconst<|fim_suffix|>uery) = q |> GenericDeconstructor.select4<'a,'b,'c,'d> evalSelectQuery
static member... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>[<AutoOpen>]
module Dapper.FSharp.MySQL.Domain
type OrderDirection =
| Asc
| Desc
type OrderBy = string * OrderDirection
type ColumnComparison =
| Eq of obj
| Ne of obj
| Gt of obj
| Lt of obj
| Ge of obj
| Le of obj
| In of obj list
| NotIn of obj list
| Li... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>nQuotes column) (inQuotes alias)
| Avg (column,alias) -> comparableName column alias, sprintf "AVG(%s) AS %s" (inQuotes column) (inQuotes alias)
| Sum (column,alias) -> comparableName column alias, sprintf "SUM(%s) AS %s" (inQuotes column) (inQuotes alias)
| Min (column,alias) -> comparableNam... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module internal Dapper.FSharp.MySQL.GenericDeconstructor
open Dapper.FSharp
let private extractFieldsAndSplit<'a> (j:Join) =
let table = j |> Join.tableName
let f = typeof<'a> |> Reflection.getFields
let fieldNames = f |> List.map (sprintf "%s.%s" table)
fieldNames, f.Head
let private ... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>n logFunction
member this.UpdateAsync<'a> (q:UpdateQuery<'a>, ?trans:IDbTransaction, ?timeout:int, ?logFunction, ?cancellationToken : CancellationToken) =
q |> Deconstructor.update<'a> |> IDbConnection.execute this trans timeout cancellationToken logFunction
member this.DeleteAsync (... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module internal Dapper.FSharp.MySQL.JoinAnalyzer
open System.Linq
open Dapper.FSharp
type JoinMetadata = {
Key : obj
ParameterName : string
}
let private extractJoins (joins:Join list) =
joins |> List.collect (fun j ->
match j with
| InnerJoin (_, j) -> j
| LeftJoi... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>pl()
visit (filter :> Expression)
/// Returns a list of one or more fully qualified column names: ["{schema}.{table}.{column}"]
let visitGroupBy<'T, 'Prop> (propertySelector: Expression<Func<'T, 'Prop>>) (qualifyColumn: MemberInfo -> string) =
let rec visit (exp: Expression) : string list =
... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>[<RequireQualifiedAccess>]
module Dapper.FSharp<|fim_suffix|>ionHandler<int64>())
SqlMapper.AddTypeHandler (OptionHandler<uint16>())
SqlMapper.AddTypeHandler (OptionHandler<uint>())
SqlMapper.AddTypeHandler (OptionHandler<uint64>())
SqlMapper.AddTypeHandler (OptionHandler<float>())
... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>d, comp); Name = field; ParameterName = parName } :: meta
|> List.rev
| Binary(w1, _, w2) -> [w1;w2] |> List.fold getWhereMetadata meta
| Unary(_, w) -> w |> getWhereMetadata meta<|fim_prefix|>module internal Dapper.FSharp.MySQL.WhereAnal<|fim_middle|>yzer
open System.Linq
open Dapper.FS... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.OptionTypes
open Dapper
open System
type OptionHandler<'T>() =
inherit SqlMapper.TypeHandler<option<'T>>()
override _.SetValue(param, value) =
let valueOrNull =
match value with
| Some x -> box x
| None -> null
param.Val... | fim | Dzoukr/Dapper.FSharp | fsharp |
[<AutoOpen>]
module Dapper.FSharp.PostgreSQL.Builders
open Dapper.FSharp
open Dapper.FSharp.PostgreSQL.LinqExpressionVisitors
open System.Linq.Expressions
open System
open System.Collections.Generic
[<AutoOpen>]
module FQ =
/// Fully qualified entity type name
type [<Struct>] FQName = private FQName of stri... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|> static member deleteOutput<'Output> (q:DeleteQuery) = q |> GenericDeconstructor.deleteOutput<'Output> evalDeleteQuery<|fim_prefix|>[<AutoOpen>]
module Dapper.FSharp.PostgreSQL.Deconstructor
open Dapper.FSharp.PostgreSQL
open Dapper.FSharp.PostgreSQL.Evaluator
[<AbstractClass;Sealed>]
type Deconstruc... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>[<AutoOpen>]
module Dapper.FSharp.PostgreSQL.Domain
type OrderDirection =
| Asc
| Desc
type OrderBy = string * OrderDi<|fim_suffix|>olumns: (string * obj) list
Fields : string list
Where : Where
}
type DeleteQuery = {
Schema : string option
Table : string
Where : Where
}<|f... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module internal Dapper.FSharp.PostgreSQL.Evaluator
open Dapper.FSharp.PostgreSQL
open Dapper.FSharp.PostgreSQL.WhereAnalyzer
open Dapper.FSharp.PostgreSQL.JoinAnalyzer
open System.Linq
open System.Text
let private specialStrings = [ "*" ]
let private inQuotes (s:string) =
s.Split('.')
|> Array... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>elds
| Some _, fields, _ -> fields
| None, _, setCols -> setCols |> List.map fst
let outputFields = typeof<'Output> |> Reflection.getFields
_update evalUpdateQuery q fields outputFields
let private _delete evalDeleteQuery (q:DeleteQuery) outputFields =
let meta = getWhereMeta... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>uery, ?trans:IDbTransaction, ?timeout:int, ?logFunction, ?cancellationToken : CancellationToken) =
q |> Deconstructor.select<'a,'b,'c,'d> |> IDbConnection.query4Option<'a,'b,'c,'d> this trans timeout cancellationToken logFunction
member this.SelectAsyncOption<'a,'b,'c,'d,'e> (q:SelectQuery, ?... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module internal Dapper.FSharp.PostgreSQL.JoinAnalyzer
open System.Linq
open Dapper.FSharp.PostgreSQL
type JoinMetadata = {
Key : obj
ParameterName : string
}
let private extractJoins (joins:Join list) =
joins |> List.collect (fun j ->
match j with
| InnerJoin (_, j) -> j
... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>v1, Value v2 ->
// Not implemented because I didn't want to embed logic to properly format strings, dates, etc.
// This can be easily added later if it is implemented in Dapper.FSharp.
notImplMsg("Value to value comparisons are not currently supported. Ex: w... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>[<RequireQualifiedAccess>]
module Dapper.FSharp.PostgreSQL.OptionTypes
open Dapper
open<|fim_suffix|>16>())
SqlMapper.AddTypeHandler (OptionHandler<int>())
SqlMapper.AddTypeHandler (OptionHandler<int64>())
SqlMapper.AddTypeHandler (OptionHandler<uint16>())
SqlMapper.AddTypeHandler (Optio... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module internal Dapper.FSharp.PostgreSQL.WhereAnalyzer
open Dapper.FSharp.Reflection
open Dapper.FSharp.PostgreSQL
open System.Linq
type FieldWhereMetadata = {
Key : string * ColumnComparison
Name : string
ParameterName : string
}
let extractWhereParams (meta:FieldWhereMetadata list) =
... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>ray")
.MakeGenericMethod([|lType|])
.Invoke(null, [|args|])<|fim_prefix|>module Dapper.FSharp.Reflection
open System
open System.Reflection
let mkSome (t<|fim_middle|>yp:Type) arg =
let unionType = typedefof<option<_>>.MakeGenericType typ
let meth = unionType.Get... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>r this.Run (state: QuerySource<'T>) =
state |> getQueryOrDefault
type DeleteExpressionBuilder<'T>() =
let getQueryOrDefault (state: QuerySource<'Result>) =
match state with
| :? QuerySource<'Result, DeleteQuery> as qs -> qs.Query
| _ ->
{ Table = ""
... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>cDeconstructor.select3<'a,'b,'c> evalSelectQuery
static member select<'a,'b,'c,'d> (q:SelectQuery) = q |> GenericDeconstructor.select4<'a,'b,'c,'d> evalSelectQuery
static member select<'a,'b,'c,'d,'e> (q:SelectQuery) = q |> GenericDeconstructor.select5<'a,'b,'c,'d,'e> evalSelectQuery
static me... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>[<AutoOpen>]
module Dapper.FSharp.SQLite.Domain
type OrderDirection =
| Asc
| Desc
type OrderBy = string * OrderDirection
type ColumnComparison =
| Eq of obj
| Ne of obj
| Gt of obj
| Lt of obj
| Ge of obj
| Le of obj
| In of obj list
| NotIn of obj list
| L... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module internal Dapper.FSharp.SQLite.Evaluator
open System.Text
let private inBrackets (s:string) =
s.Split('.')
|> Array.map (sprintf "[%s]")
|> String.concat "."
let private safeTableName table =
table |> inBrackets
let evalBinary = function
| And -> "AND"
| Or -> "O... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module internal Dapper.FSharp.SQLite.GenericDeconstructor
open Dapper.FSharp
let private extractFieldsAndSplit<'a> (j:Join) =
let table = j |> Join.tableName
let f = typeof<'a> |> Reflection.getFields
let fieldNames = f |> List.map (sprintf "%s.%s" table)
fieldNames, f.Head
let private... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>[<AutoOpen>]
module Dapper.FSharp.SQLite.IDbConnection
open Dapper.FSharp
open Dapper.FSharp.SQLite
open System.Data
open System.Threading
type IDbConnection with
member this.SelectAsync<'a> (q:SelectQuery, ?trans:IDbTransaction, ?timeout:int, ?logFunction, ?cancellationToken : CancellationToken) ... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module internal Dapper.FSharp.SQLite.JoinAnalyzer
open System.Linq
open Dapper.FSharp
type JoinMetadata = {
Key : obj
ParameterName : string
}
let private extractJoins (joins<|fim_suffix|>> List.distinct
let getJoinMetadata (joins:Join list) =
joins
|> extractJoins
|> extractCon... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module internal Dapper.FSharp.SQLite.LinqExpressionVisitors
open System.Linq.Expressions
open System
open System.Reflection
let notImpl() = raise (NotImplementedException())
let notImplMsg msg = raise (NotImplementedException msg)
[<AutoOpen>]
module VisitorPatterns =
let (|Lambda|_|) (exp: Expre... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>[<RequireQualifiedAccess>]
module Dapper.FSharp.SQLite.OptionTypes
open Dapper
open System
open Dapper.FSharp.OptionTypes
type SqliteBooleanHandler() = inherit TypeHandlerWithConverter<Boolean>(Convert.ToBoolean)
type SqliteByteHandler() = inherit TypeHandlerWithConverter<B... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>[<RequireQualifiedAccess>]
[<System.Obsolete("""This module is deprecated and will be removed in next version.
Please use function from a databa<|fim_suffix|>System.Obsolete("""This function is deprecated and will be removed in next version.
Please use function from a database vendor-scoped namespace.
Ex... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>xpr _ -> meta
| Column (field, comp) ->
let parName =
meta
|> List.filter (fun x -> System.String.Equals(x.Name, field, System.StringComparison.OrdinalIgnoreCase))
|> List.length
|> fun l -> sprintf "Where_%s%i" field (l + 1)
|> norma... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.Database
open System
open System.Threading.Tasks
let [<Literal>] DbName = "DapperFSharpTests"
let [<Literal>] TestSchema = "tests"
type ICrudInitializer =
abstract member InitPersons : unit -> Task<unit>
abstract member InitPersonsSimple : unit -> Task<unit>
abst... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.Extensions
open Dapper
type System.Data.IDbConnection with
member this.ExecuteIgnore (cmd:string) =
task {
let! _ = this.ExecuteAsync(cmd)
return ()
}
member this.ExecuteCatchIgnore (cmd:string) =
task {<|fim_suffix|>.Ex... | fim | Dzoukr/Dapper.FSharp | fsharp |
module Dapper.FSharp.Tests.MSSQL.AggregatesTests
open NUnit.Framework
open NUnit.Framework.Legacy
open Dapper.FSharp.MSSQL
open Dapper.FSharp.Tests.Database
[<TestFixture>]
[<NonParallelizable>]
type AggregatesTests () =
let personsView = table'<Persons.View> "Persons"
let dogsView = table'<Dogs.View> "Dogs"... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.MSSQL.Database
open Dapper.FSharp
open Dapper.FSharp.Tests.Database
open Dapper.FSharp.Tests.Extensions
open System.Data
open Microsoft.Data.SqlClient
open Microsoft.Extensions.Configuration
let getConnection () =
let conf = ConfigurationBuilder().AddJsonFile("settings.js... | fim | Dzoukr/Dapper.FSharp | fsharp |
module Dapper.FSharp.Tests.MSSQL.DeleteTests
open System.Threading
open System.Threading.Tasks
open NUnit.Framework
open NUnit.Framework.Legacy
open Dapper.FSharp.MSSQL
open Dapper.FSharp.Tests.Database
[<TestFixture>]
[<NonParallelizable>]
type DeleteTests () =
let personsView = table'<Persons.View> "Persons"
... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>
[<Test>]
member _.``Inserts and outputs subset of single record columns``() =
task {
do! init.InitPersons()
let r = Persons.View.generate 1 |> List.head
let! fromDb =
insert {
into personsView
v... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>terObj.Id)
}
|> conn.SelectAsync<Persons.View>
ClassicAssert.AreEqual(1, Seq.length resultsA)
ClassicAssert.AreEqual(5, resultsA |> Seq.head |> (fun x -> x.Position))
ClassicAssert.AreEqual(1, Seq.length resultsB)
ClassicAss... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.MSSQL.SelectTests
open System.Threading
open System.Threading.Tasks
open NUnit.Framework
open NUnit.Framework.Legacy
open Dapper.FSharp.MSSQL
open Dapper.FSharp.Tests.Database
[<TestFixture>]
[<NonParallelizable>]
type SelectTests () =
let personsView = table'<Person... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.MSSQL.UpdateTests
open System
open System.Threading
open System.Threading.Tasks
open NUnit.Framework
open NUnit.Framework.Legacy
open Dapper.FSharp.MSSQL
open Dapper.FSharp.Tests.Database
[<TestFixture>]
[<NonParallelizable>]
type UpdateTests () =
let personsView = table'... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>ogsView
values ds
} |> conn.InsertAsync
let fromDb =
select {
for p in personsView do
leftJoin d in dogsView on (p.Id = d.OwnerId)
countByDistinct (p.Id)
}
... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.MySQL.Database
open Dapper.FSharp
open Dapper.FSharp.Tests.Database
open Dapper.FSharp.Tests.Extensions
open System.Data
open Microsoft.Extensions.Configuration
open MySql.Data.MySqlClient
let getConnection () =
let conf = ConfigurationBuilder().AddJsonFile("settings.json... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|> let action () =
delete {
for p in personsView do
where (p.Position = 10)
} |> deleteCrud
Assert.ThrowsAsync<TaskCanceledException>(action) |> ignore
}
[<Test>]
member _.``Deletes more records``() =
task ... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.MySQL.InsertTests
open System
open System.Threading
open System.Threading.Tasks
open NUnit.Framework
open NUnit.Framework.Legacy
open Dapper.FSharp.MySQL
open Dapper.FSharp.Tests.Database
[<TestFixture>]
[<NonParallelizable>]
type InsertTests () =
let personsView = table<... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.MySQL.IssuesTests
open NUnit.Framework
open NUnit.Framework.Legacy
open Dapper.FSharp.MySQL
open Dapper.FSharp.Tests.Database
[<TestFixture>]
[<NonParallelizable>]
type IssuesTests () =
let personsView = table'<Persons.View> "Persons"
let dogsView = table'<Dogs.View> ... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>4)
} |> conn.SelectAsync<Persons.View>
ClassicAssert.AreEqual (rs |> List.find (fun x -> x.Position = 3), Seq.head fromDb)
ClassicAssert.AreEqual(1, Seq.length fromDb)
}
[<Test>]
member _.``Selects by orWhere``() =
task {
do! in... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.MySQL.UpdateTests
open System
open System.Threading
open System.Threading.Tasks
open NUnit.Framework
open NUnit.Framework.Legacy
open Dapper.FSharp.MySQL
open Dapper.FSharp.Tests.Database
[<TestFixture>]
[<NonParallelizable>]
type UpdateTests () =
let personsView = table'... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.PostgreSQL.AggregatesTests
open NUnit.Framework
open NUnit.Framework.Legacy
open Dapper.FSharp.PostgreSQL
open Dapper.FSharp.Tests.Database
[<TestFixture>]
[<NonParallelizable>]
type AggregatesTests () =
let personsView = table'<Persons.View> "Persons"
let dogsView = ... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.PostgreSQL.Database
open System
open Dapper.FSharp
open Dapper.FSharp.Tests.Database
open Dapper.FSharp.Tests.Extensions
open System.Data
open Microsoft.Extensions.Configuration
open Npgsql
let getConnection () =
let conf = ConfigurationBuilder().AddJsonFile("settings<|fi... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.PostgreSQL.DeleteTests
open System
open System.Threading
open System.Threading.Tasks
open NUnit.Framework
open NUnit.Framework.Legacy
open Dapper.FSharp.PostgreSQL
open Dapper.FSharp.Tests.Database
[<TestFixture>]
[<NonParallelizable>]
type DeleteTests () =
let personsVie... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.PostgreSQL.InsertTests
open System
open System.Threading
open System.Threading.Tasks
open NUnit.Framework
open NUnit.Framework.Legacy
open Dapper.FSharp.PostgreSQL
open Dapper.FSharp.Tests.Database
[<TestFixture>]
[<NonParallelizable>]
type <|fim_suffix|>Persons()
... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.PostgreSQL.IssuesTests
open NUnit.Framework
open NUnit.Framework.Legacy
open Dapper.FSharp.PostgreSQL
open Dapper.FSharp.Tests.Database
[<TestFixture>]
[<NonParallelizable>]
type IssuesTests () =
let personsView = table'<Persons.View> "Persons"
let dogsView = table'<D... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|> into personsView
values persons
} |> conn.InsertAsync
let! _ =
insert {
into dogsView
values dogs
} |> conn.InsertAsync
let! _ =
insert {
... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.PostgreSQL.UpdateTests
open System
open System.Threading
open System.Threading.Tasks
open NUnit.Framework
open NUnit.Framework.Legacy
open Dapper.FSharp.PostgreSQL
open Dapper.FSharp.Tests.Database
[<TestFixture>]
[<NonParallelizable>]
type UpdateTests () =
let personsVie... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|> for p in personsView do
innerJoin d in dogsView on (p.Id = d.OwnerId)
count "*" "Count"
}
|> conn.SelectAsync<{| Count:int |}>
|> taskToList
|> List.head
ClassicAssert.AreEqual(... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.SQLite.Database
open Dapper.FSharp
open Dapper.FSharp.Tests.Database
open Dapper.FSharp.Tests.Extensions
open System.Data
open Microsoft.Data.Sqlite
open Microsoft.Extensions.Configuration
let getConnection () =
let conf = ConfigurationBuilder().AddJsonFile("settings.json... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>s.View.generate 10
let! _ =
insert {
into personsView
values rs
} |> conn.InsertAsync
use cts = new CancellationTokenSource()
cts.Cancel()
let deleteCrud query =
conn.Del... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_prefix|>module Dapper.FSharp.Tests.SQLite.InsertTests
open System
open System.Threading
open System.Threading.Tasks
open NUnit.Framework
open NUnit.Framework.Legacy
open Dapper.FSharp.SQLite
open Dapper.FSharp.Tests.Database
[<TestFixture>]
[<NonParallelizable>]
type InsertTests () =
let personsView = tabl... | fim | Dzoukr/Dapper.FSharp | fsharp |
module Dapper.FSharp.Tests.SQLite.IssuesTests
open NUnit.Framework
open NUnit.Framework.Legacy
open Dapper
open Dapper.FSharp.SQLite
open Dapper.FSharp.Tests.Database
[<TestFixture>]
[<NonParallelizable>]
type IssuesTests () =
let personsView = table'<Persons.View> "Persons"
let dogsView = table'<Dogs.View> ... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>ons.View>
ClassicAssert.AreEqual(10, Seq.length fromDb)
ClassicAssert.AreEqual((persons.Head, dogs.Head, weights.Head, vaccinations.Head), (Seq.head fromDb))
}
[<Test>]
member _.``Selects with three inner joins - 1:N``() =
task {
do! init.I... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|> for p in personsView do
setColumn p.LastName "UPDATED"
where (p.Position = 2)
} |> updateCrud
Assert.ThrowsAsync<TaskCanceledException>(action) |> ignore
}
[<Test>]
member _.``Updates option field to None``() =
... | fim | Dzoukr/Dapper.FSharp | fsharp |
<|fim_suffix|>g.IsNullOrWhiteSpace(change.Name) || change.Name == last.Name
? ""
: change.Name,
Email = string.IsNullOrWhiteSpace(change.Email) || change.Email == last.Email
? ""
: change.Email,
... | fim | EduardoPires/EquinoxProject | csharp |
<|fim_prefix|>namespace Equinox.Application.EventSourcedNormalizers
{
public class CustomerHistoryData
{
public string Action { get; <|fim_suffix|>{ get; set; }
public string Email { get; set; }
public string BirthDate { get; set; }
public string Timestamp { get; set; }
... | fim | EduardoPires/EquinoxProject | csharp |
<|fim_prefix|>using Equinox.Application.ViewModels;
using Equinox.Domai<|fim_suffix|>l(this IEnumerable<Customer> customers)
{
return customers?.Select(c => c.ToViewModel());
}
public static Customer ToEntity(this CustomerViewModel customer)
{
if (customer == nu... | fim | EduardoPires/EquinoxProject | csharp |
<|fim_prefix|>using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Equinox.Application.EventSourcedNormalizers;
using Equinox.Application.ViewModels;
using FluentValidation.Results;
namespace Equinox.Application.Interfaces
{
public interface ICustomerAppService : IDisposable
{
... | fim | EduardoPires/EquinoxProject | csharp |
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Equinox.Application.EventSourcedNormalizers;
using Equinox.Application.Extensions;
using Equinox.Application.Interfaces;
using Equinox.Application.ViewModels;
using Equinox.Domain.Commands;
using Equinox.Domain.Interfaces;
using Equino... | fim | EduardoPires/EquinoxProject | csharp |
<|fim_prefix|>using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Equinox.Application.ViewModels
{
public class CustomerViewModel
{
[Key]
public Guid Id { get; set; }
[Required(ErrorMessage = "The Name is Required")]
[MinLength(2)]... | fim | EduardoPires/EquinoxProject | csharp |
<|fim_suffix|> public DateTime BirthDate { get; protected set; }
}
}<|fim_prefix|>using Syste<|fim_middle|>m;
using NetDevPack.Messaging;
namespace Equinox.Domain.Commands
{
public abstract class CustomerCommand : Command
{
public Guid Id { get; protected set; }
public string Name { ... | fim | EduardoPires/EquinoxProject | csharp |
<|fim_suffix|>return await Commit(_customerRepository.UnitOfWork);
}
public void Dispose()
{
_customerRepository.Dispose();
}
}
}<|fim_prefix|>using System;
using System.Threading;
using System.Threading.Tasks;
using Equinox.Domain.Events;
using Equinox.Domain.Interface... | fim | EduardoPires/EquinoxProject | csharp |
<|fim_suffix|>erCommandValidation().Validate(this);
return ValidationResult.IsValid;
}
}
}<|fim_prefix|>using System;
using Equinox.Domain.Commands.Valid<|fim_middle|>ations;
namespace Equinox.Domain.Commands
{
public class RegisterNewCustomerCommand : CustomerCommand
{
public ... | fim | EduardoPires/EquinoxProject | csharp |
<|fim_suffix|>omerCommand(Guid id)
{
Id = id;
AggregateId = id;
}
public override bool IsValid()
{
ValidationResult = new RemoveCustomerCommandValidation().Validate(this);
return ValidationResult.IsValid;
}
}
}<|fim_prefix|>us... | fim | EduardoPires/EquinoxProject | csharp |
<|fim_prefix|>using System;
using Equinox.Domain.Commands.Validations;
namespace Equinox.Domain.Commands
{
public class UpdateCustomerCommand : CustomerCommand
{
public UpdateCus<|fim_suffix|> }
public override bool IsValid()
{
ValidationResult = new UpdateCustomerComman... | fim | EduardoPires/EquinoxProject | csharp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.