Skip to content

Instantly share code, notes, and snippets.

View cemremengu's full-sized avatar
😵

Cemre Mengu cemremengu

😵
View GitHub Profile
@cemremengu
cemremengu / snowflake-id.sql
Created April 29, 2022 11:14 — forked from beginor/snowflake-id.sql
Twitter Snowflake ID for PostgreSQL
CREATE SEQUENCE public.global_id_seq;
ALTER SEQUENCE public.global_id_seq OWNER TO postgres;
CREATE OR REPLACE FUNCTION public.id_generator()
RETURNS bigint
LANGUAGE 'plpgsql'
AS $BODY$
DECLARE
our_epoch bigint := 1314220021721;
seq_id bigint;
@cemremengu
cemremengu / bulk_processor_example1.go
Created February 9, 2018 19:28 — forked from olivere/bulk_processor_example1.go
Example #1 of bulk processor usage
// This is an example of using elastic's BulkProcessor with Elasticsearch.
//
// See https://github.com/olivere/elastic and
// and https://github.com/olivere/elastic/wiki/BulkProcessor
// for more details.
/*
* This example illustrates a simple process that performs bulk processing
* with Elasticsearch using the BulkProcessor in elastic.
*
@cemremengu
cemremengu / OracleDynamicParameters.cs
Created April 28, 2017 00:10 — forked from vijayganeshpk/OracleDynamicParameters.cs
OracleDynamicParameters class for Dapper
using Dapper;
using Oracle.ManagedDataAccess.Client;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
public class OracleDynamicParameters : Dapper.SqlMapper.IDynamicParameters {
private static Dictionary<SqlMapper.Identity, Action<IDbCommand, object>> paramReaderCache = new Dictionary<SqlMapper.Identity, Action<IDbCommand, object>>( );